Preparing Data for Supervised and Reinforcement Fine-Tuning
This lesson explains the data shapes that Bedrock supervised fine-tuning and reinforcement fine-tuning need, and why the quality of a few thousand good examples matters more than the quantity of poor ones.
Learning outcomes
After completing this lesson, you will be able to:
- Format supervised fine-tuning data.
- Prepare prompts and reward functions for reinforcement fine-tuning.
- Apply a dataset quality checklist.
Supervised fine-tuning data
Supervised fine-tuning learns from labelled examples of the desired output. Bedrock accepts JSONL training and optional validation files in S3. Depending on the model, records use a prompt and completion pair or a conversational format with a system prompt and a list of user and assistant messages (multimodal models also accept image references). Examples should look exactly like production requests, including the same system prompt and instructions, and responses should be the ideal answer in the exact format required.
{"prompt": "Classify the ticket: 'Invoice shows the wrong VAT rate.'", "completion": "billing"}
{"prompt": "Classify the ticket: 'App crashes when I upload a photo.'", "completion": "technical"}Supervised fine-tuning data
Reinforcement fine-tuning data
Reinforcement fine-tuning does not need ideal responses. It uses prompts plus a reward function that scores the model's attempts: a rule-based grader for verifiable answers (for example, does generated SQL return the right rows, does code pass unit tests) or an AI-based judge for subjective qualities, typically implemented as a Lambda function. Prompts can come from an uploaded dataset or from Bedrock invocation logs. This suits tasks where correct answers are easy to check but hard to write in advance.
The following diagram shows how a team uses all 2,000 of its questions to fine-tune a text-to-SQL model when only 300 have correct SQL answers.

Supervised or reinforcement?
Dataset quality checklist
The quality of a fine-tuning dataset determines the quality of the fine-tuned model. The examples should be representative of real requests, balanced across task types, free of duplicates, contradictions and personal data, and within the model's token limits. They are split into training and validation sets, for example 90% and 10%, so training progress can be monitored.
A separate test set is held out to compare the customised model with the base model and with prompt engineering alone. Fine-tuning is worthwhile only if it clearly beats the simpler alternatives on that test set. The following table summarises the data each customisation method needs.
| Method | Data needed | Format |
|---|---|---|
| Supervised fine-tuning | Input and ideal output pairs | JSONL prompt/completion or conversation messages |
| Reinforcement fine-tuning | Prompts plus a reward function | JSONL prompts or invocation logs; Lambda grader |
| Distillation | Representative prompts (optionally pairs) | JSONL prompts or invocation logs |
| Continued pre-training | Large unlabeled domain text | Plain text corpus (on SageMaker AI) |
Ready to fine-tune?
SQL generation
A company wants a model that writes SQL for its data warehouse schema. It has 2,000 business questions but correct SQL for only 300 of them; executing a query against a test database shows whether the result matches the expected answer.
- Supervised fine-tuning on the 300 labelled pairs teaches the schema and SQL style.
- Reinforcement fine-tuning on all 2,000 questions uses a Lambda reward function that runs the generated SQL on a test database and scores correctness.
- A held-out set of 200 questions compares base model, SFT model and SFT plus RFT.
Reinforcement fine-tuning uses the 1,700 questions without written answers, because correctness can be verified automatically. Writing 1,700 SQL answers by hand for supervised fine-tuning would have been slow and expensive.
Why should fine-tuning prompts look exactly like production prompts?
Show answer
The model learns to respond to the format it is trained on, so a different format in production lowers quality.
Exam Tips
Remember for the exam
- Bedrock fine-tuning data: JSONL in S3, with training and validation files.
- Make training prompts look exactly like production prompts.
- Answers verifiable but hard to write: reinforcement fine-tuning with a reward function.
- Hold out a test set to compare against the base model.
- Quality and consistency of examples matter more than volume.