Retext
ChatGPTAI AssistantFor ML Engineers

ChatGPT Prompts for ML Engineers

ML engineers need help with training and evaluation code, data pipelines, debugging shape and dtype errors, and making models reliable and fast in production. These ChatGPT prompts start from that: fill in your situation once and reuse it. The worked example below is a debugging task, one of the most common for ml engineers.

Installs as a snippet — type ;ml-chatgpt to paste this prompt anywhere on your Mac.
Prompt Template
I'm a ml engineer and need help with [task, e.g. model training and tuning].

What I have:
- [the material involved: code, draft, notes or data]

What a good result looks like:
- [the outcome and its format]

Ask me one clarifying question if something important is missing, then give the result.

About my work
- Framework and hardware: [e.g. PyTorch 2.3, single GPU with 24 GB]
- Model and data: [e.g. fine-tuning a text classifier, 200k labeled examples, 5 classes]
- Production constraints: [e.g. p95 latency under 100 ms, CPU inference only]

Context
- Reference material: [paste it below, or attach the file]

How to use this prompt

  1. 1

    Open ChatGPT

    Start a new chat in ChatGPT and paste the prompt.

  2. 2

    Give it context

    Upload or paste the material the prompt works on below the instructions.

  3. 3

    Review and iterate

    Reply in the same chat to refine, and quote the part you want changed.

  4. 4

    Save what you repeat

    Preferences you want in every chat (tone, audience, format) belong in ChatGPT's custom instructions. For a prompt you reuse with fixed files, a custom GPT or project works too.

Working in ChatGPT

  • •Custom instructions apply to every chat, so keep task-specific rules in the prompt, not there.
  • •If the reply drifts from the format, paste the format line again and ask it to redo only that part.
  • •Start a new chat for unrelated work so earlier messages don't color the answer.

Example task: Debugging

What you give it

Symptom: add_tag returns tags from earlier calls. Calling add_tag("a") then add_tag("b") gives ["a", "b"] on the second call instead of ["b"].
Environment: Python 3.11, local script.

def add_tag(tag, tags=[]):
    tags.append(tag)
    return tags

What changed: nothing, it has always done this.

What a good answer looks like (shortened)

1. Mutable default argument (very likely). The list [] is created once, when the function is defined, and every call without a tags argument reuses that same list.
   Check: print(id(tags)) inside the function. If the id is the same on every call, this is the cause.

2. A caller is passing the same list in each time (less likely, since the calls you showed pass only one argument).
   Check: search for calls to add_tag that pass a second argument.

Run check 1 first. If confirmed, the fix is:
def add_tag(tag, tags=None):
    if tags is None:
        tags = []
    tags.append(tag)
    return tags

Tips for better results

  • •Include tensor shapes and the full traceback when debugging. Most training errors are shape or device mismatches that are obvious once the AI sees the actual dimensions.
  • •Upload or paste the material the prompt works on below the instructions.
  • •Check this before you use the output: check evaluation code for leakage between train and test data and confirm reported metrics are computed the way you think, since a small bug can make a model look far better than it is.

Check before you use it: Check evaluation code for leakage between train and test data and confirm reported metrics are computed the way you think, since a small bug can make a model look far better than it is.

Get the free prompt pack

Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.

Variations

Task

Debugging: Replace the first line with: Help me debug a problem. I want to find the cause, not just patch the symptom.

Intermittent bug

Add this line to Symptom: It only happens [e.g. 1 in 20 requests, under load, after midnight UTC]. Focus on timing, concurrency and caching causes.

Second task

Change the task line to: [ML pipeline development].

Save it as a Retext snippet

Retext is a free text expander for Mac. Save this prompt once, then type ;ml-chatgpt in any app (ChatGPT, Claude, your editor, a browser tab) and the full prompt is pasted in.

  1. Click Add to Retext. The prompt installs as a snippet with the trigger ;ml-chatgpt.
  2. Change the trigger in Retext if you prefer a different one.
  3. Type the trigger wherever you want the prompt, then fill in the brackets.

Frequently asked questions

Can AI help tune hyperparameters?

It can suggest sensible ranges and a search strategy based on your model and data size. The actual best values still have to come from experiments on your validation set.

Should this go in custom instructions?

No. Custom instructions apply to every chat. Keep this prompt for the task and paste it (or expand it with a Retext snippet) when you need it.

Can I make this a custom GPT?

Yes, if you run it often with the same files. Put the prompt in the GPT's instructions and upload the reference files once.

How do I reuse this prompt without copying it every time?

Click Add to Retext to save it as a snippet. Then type ;ml-chatgpt in any Mac app, including your AI tool, and the full prompt is pasted in.

Related Templates

Get the free prompt pack

Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.