Skip to main content

Claude Prompt to Prepare LLM Fine-Tuning Training Data

Build LLM fine-tuning datasets end-to-end: data strategy, JSON formatting, quality rubrics, synthetic generation, decontamination, and holdout eval splits.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt walks you through the full data pipeline for fine-tuning a specific LLM — from deciding what examples to collect, through formatting them correctly for the target model's API, to building a clean holdout evaluation set that will not bleed into training. It treats data preparation as an engineering problem with defined quality criteria, not a "gather some examples and hope" exercise.

The template is structured around ten sequential concerns that mirror how a serious fine-tuning project actually runs. Because you supply [base_model] explicitly, the formatting guidance stays model-specific — the JSONL schema for OpenAI's fine-tuning API differs meaningfully from the ShareGPT JSON format Axolotl expects for Llama, and this prompt forces that specificity up front. Providing [current_data] and [budget] anchors the collection strategy to what's actually achievable rather than theoretical.

What distinguishes it from generic fine-tuning prompts is the decontamination step (section 10) and the explicit quality rubric (section 4). These are the two things most practitioners skip, and they're the two things that most often produce a model that looks good on training loss but fails on real inputs.

When to use it

  • You have a base model (GPT-4o mini, Llama 3.1 8B, Mistral 7B) and a clear task but no structured dataset yet.
  • You're converting unstructured internal data (support tickets, code reviews, internal wikis) into fine-tuning examples.
  • You want to generate synthetic training data using a stronger model and need generation prompts plus quality filters to do it responsibly.
  • You're splitting a collected dataset and need stratification logic so your eval set reflects real production distribution.
  • You're debugging a fine-tuned model that underperforms and suspect data quality is the root cause.
  • You're working within a fixed budget and need to prioritize which examples to create manually vs. synthetically.

Example output

For [base_model]: gpt-4o-mini, [fine_tuning_purpose]: classify customer support tickets by urgency, [sample_count]: 3:

{"messages": [{"role": "system", "content": "Classify the support ticket urgency as LOW, MEDIUM, or HIGH. Reply with only the label."}, {"role": "user", "content": "My account was charged twice this month and I can't log in."}, {"role": "assistant", "content": "HIGH"}]}
{"messages": [{"role": "system", "content": "Classify the support ticket urgency as LOW, MEDIUM, or HIGH. Reply with only the label."}, {"role": "user", "content": "Can I change my newsletter preferences?"}, {"role": "assistant", "content": "LOW"}]}
{"messages": [{"role": "system", "content": "Classify the support ticket urgency as LOW, MEDIUM, or HIGH. Reply with only the label."}, {"role": "user", "content": "I submitted a refund request 10 days ago and have not heard back."}, {"role": "assistant", "content": "MEDIUM"}]}

The response also includes the quality rubric: score 1 if the label is ambiguous or the ticket is truncated, score 5 if the ticket contains enough signal for a human annotator to label it confidently within 10 seconds. Only examples scoring 4 or 5 enter the training split.

Pro tips

  • Lock the system prompt first. The system prompt in your training examples must be byte-for-byte identical to what you'll use in production inference. If it drifts — even whitespace — your fine-tuned model will underperform on the exact task it was trained for. Set it before generating a single example and treat it as frozen.
  • [target_size] anchors everything. Start with "1000 examples" and let the prompt reason backward — it will tell you how many synthetic vs. human-annotated examples that budget realistically allows, and where hand-labeling time is best spent.
  • Use [eval_size] as 5–10% of total, minimum 100 examples. For classification tasks, stratify by label so rare classes are represented. For generative tasks, sample from each difficulty tier. Ask the prompt to generate the eval set first, then hold it out before touching the training split.
  • Synthetic data needs a judge pass. When you use section 5 to generate synthetic examples, pipe those outputs back through a separate GPT-4o prompt scoring each against your section 4 rubric. Only keep scores of 4 or 5. This is cheap per-example and prevents low-quality noise from compounding across thousands of rows.
  • Decontamination is not optional. Before training, run fuzzy-match deduplication (MinHash or SimHash) between your eval and train splits. Even paraphrased overlaps inflate eval metrics and hide real generalization gaps — you'll ship a model that looks strong internally and collapses on production inputs.

Frequently Asked Questions

Does this prompt generate the actual training data, or does it give me a strategy to create it?
Both. Sections 1–4 give you strategy and formatting. Section 5 provides concrete prompts you can run to generate synthetic examples. Section 6 describes augmentation techniques. You get working JSONL samples in the exact format the target model's fine-tuning API expects, plus a repeatable process for creating the rest of the dataset yourself.
What should I put in [current_data] if I have nothing yet?
Describe whatever you do have access to, even if it's unlabeled: raw logs, PDFs, a spreadsheet of Q&A pairs, scraped content. The prompt uses that to recommend the most practical collection path — synthetic generation, human annotation, or a hybrid — given your [budget]. 'None yet' is a valid input; the response will focus entirely on synthetic generation strategies and sourcing approaches rather than assuming you have existing labeled examples to convert.
Will the output format actually match what my fine-tuning API or training framework expects?
Yes, provided you fill in [base_model] precisely and name the training stack if it's open-weight. For OpenAI models, the prompt produces JSONL with the messages array structure their fine-tuning API requires. For open-weight models, the format depends on your training framework — Axolotl expects ShareGPT JSON, TRL can consume either ShareGPT or completion-only JSONL, LlamaFactory has its own schema. Specify both the base model and the training library (e.g. 'Llama 3.1 8B via Axolotl') so the prompt generates the right structure rather than a generic approximation.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in AI & Machine Learning Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support