Training data format (JSONL)
Fine-tuning data for Bedrock is typically a JSON Lines (JSONL) file where each line is a standalone JSON object. Each example usually contains aprompt and a completion that demonstrate the desired input → output behavior.
Example JSONL (each line is a separate JSON object):
Preparing S3 locations and IAM role
When using the Bedrock console or SDK, you will point the customization job at:- Training data (S3): e.g.,
s3://mybucket/customer-tone/train.jsonl - Output location (S3): e.g.,
s3://mybucket/customer-tone/output/ - IAM role: a role with permissions to read the training S3 object and write job output
Creating a customization (fine-tuning) job with boto3
Use the Bedrock control-plane client (bedrock) to create the customization job. For inference, use the Bedrock Runtime client (bedrock-runtime) — see the callout below.
When creating the SDK client, use the Bedrock control-plane API (service name
bedrock) for operations such as creating customization jobs. Use the Bedrock Runtime API (service name bedrock-runtime) only for inference requests.Key customization parameters
Notes on hyperparameters:
epochCount: number of passes over the dataset.batchSize,learningRate,learningRateWarmupSteps: tune to control convergence and stability.- The best values depend on dataset size, base model, and desired trade-offs (quality vs. cost/time).
Hosting options and ARNs
After successful customization, your model artifacts appear in your account under custom models (not the public/shared catalog). You can host the model in two primary ways:- Serverless (on-demand): call the custom model ARN directly for inference. Ideal for variable, low-volume usage.
- Provisioned throughput: deploy a provisioned model contract and use the provisioned model ARN when invoking inference. This provides predictable capacity for production workloads. Note: you are billed for provisioned capacity whether or not it is used.
After hosting, use the Bedrock Runtime API for inference requests (e.g.,
invoke_model).
Invoking a hosted (provisioned) model with boto3
Example using the Bedrock Runtime client. Replaceprovisioned_model_arn with your provisioned model ARN (or use the custom model ARN for on-demand).
- Use lower
temperaturefor more deterministic responses. - Optionally include generation constraints (max tokens, stop sequences) in the
textGenerationConfigdepending on the runtime schema.
What to expect from fine-tuning
Benefits of fine-tuning include:- More consistent outputs: the model learns the mapping you provided in training examples.
- Reduced prompt complexity: fewer prompt-engineering tricks are often needed.
- Better alignment with business needs: top-level behavior and style can be internalized.
- Improved user experience: outputs more closely match real-world expectations.


Next steps: multimodal models (text + images)
The next lesson explores multimodal capabilities: combining text prompts with image inputs, constructing multimodal examples, and running inference across text + image modalities.
Links and references
- Bedrock boto3 client (control plane): https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock.html
- Bedrock Runtime (inference): https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-runtime.html
- Amazon Bedrock documentation: https://docs.aws.amazon.com/bedrock/
- Best practices for fine-tuning and prompt design: AWS developer guides and model vendor docs
Tip: Start with a small dataset and conservative hyperparameters to validate workflows and end-to-end permissions before scaling to larger training sets and longer epoch counts.