Skill 1.2.9: Prepare data for FM fine-tuning, continuous pre-training, and model distillation
Question 1 - Data Format for Amazon Bedrock Fine-Tuning
A financial services company is building a custom foundation model that must generate investment research summaries in the firm's proprietary writing style. The ML team decides to perform supervised fine-tuning using Amazon Bedrock. The team has collected a dataset containing successful research reports written by senior analysts and wants to transform this data into the correct format for the Bedrock fine-tuning API.
The team's requirements are:
- The fine-tuned model must produce outputs matching the firm's tone and structure
- Minimum data transformation effort using AWS managed capabilities
- The dataset must be schema-compliant with what the Amazon Bedrock fine-tuning job expects
Which preparation approach should the team use? (Select ONE)
- A) Upload the raw research reports as PDFs to an S3 bucket, configure a Bedrock Knowledge Base data source to chunk and embed them, and trigger an ingestion job before starting fine-tuning.
- B) Convert the research reports into
JSONLformat with each row containing apromptfield (e.g., a summary request or report section header) paired with acompletionfield (the corresponding text excerpt), then upload to S3 and reference the URI inFineTuningJobConfig. - C) Use Amazon Comprehend to detect PII in the reports, then use AWS Glue to reshape the text into a CSV with columns
feature_1,feature_2, andlabelfor the Bedrock training job. - D) Load the reports as unlabeled raw text into an S3 bucket and configure the Bedrock custom model import to use them directly as training data for unsupervised domain adaptation.
- E) Convert each report into a text file with one sentence per line, then use SageMaker Data Wrangler to apply TF-IDF vectorization before passing the vectors to the Bedrock fine-tuning endpoint.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
- B is Correct: Amazon Bedrock supervised fine-tuning requires label-structured data in
JSONLformat. Each line contains aprompt(the instruction or context) and acompletion(the desired model response). This is the standard schema expected by theFineTuningJobConfigAPI. No custom vectorization or chunking is needed—the raw text goes directly into the fine-tuning job.
Distractor Analysis
- A is Incorrect: Cleaning, chunking, and embedding documents into a knowledge base is the preparation path for RAG retrieval, not supervised fine-tuning. This option confuses knowledge retrieval with weight modification.
- C is Incorrect: Amazon Comprehend PII detection is a redaction step, not a format conversion for fine-tuning. Bedrock fine-tuning jobs expect JSONL prompt/completion pairs, not tabular CSV files with feature-label columns.
- D is Incorrect: Bedrock continued pre-training uses unlabeled raw text, but the question explicitly asks about fine-tuning to match tone and structure. Uploading raw unlabeled text to S3 and expecting Bedrock fine-tuning to consume it directly is invalid—fine-tuning requires labeled examples.
- E is Incorrect: TF-IDF vectorization converts text to sparse vector representations used in traditional ML models (e.g., logistic regression). Foundation model fine-tuning operates on raw tokenized text, not pre-computed TF-IDF vectors, and Bedrock does not accept vectorized input for supervised fine-tuning.
Key Takeaway: Fine-tuning preparation produces prompt-completion JSONL; continued pre-training consumes large raw text; distillation consumes a prompt set. Getting the artifact format right is the first exam signal.
Question 2 - Distinguishing Fine-Tuning vs. Continued Pre-Training vs. Distillation
A healthcare startup has licensed a foundation model and wants to adapt it for clinical documentation. The team has three different data assets available:
- Asset A: 500,000 de-identified clinical progress notes (unlabeled, raw prose)
- Asset B: 10,000 prompt-response pairs mapping medical abbreviations to expanded clinical terms
- Asset C: 250,000 diverse medical prompts (no responses) covering documentation generation tasks
The team's chief ML engineer makes the following claims:
- "Asset A should be used for continued pre-training to absorb medical vocabulary."
- "Asset B should be used for supervised fine-tuning to learn instruction-following behavior."
- "Asset C should be used for distillation, where a larger teacher model generates the responses."
Which statements are correct? (Select TWO)
- A) Asset A for continued pre-training is correct because unlabeled clinical text helps the model absorb domain vocabulary and statistical patterns.
- B) Asset B for supervised fine-tuning is incorrect because the responses are just expanded abbreviations and don't teach instruction-following.
- C) Asset C for distillation is correct because distillation requires only a prompt set, and the teacher model generates responses to train a smaller student.
- D) Asset A should instead be used for fine-tuning because the prose naturally contains implicit prompt-response structure.
- E) Asset C should instead be used for continued pre-training because the prompts are unlabeled medical text.
Click to reveal Answer & Explanation
Correct Answers: A and C
Correct Options Analysis
- A is Correct: Continued pre-training (domain adaptation) uses large corpora of unlabeled domain text (clinical progress notes) to update the model's understanding of specialized vocabulary, terminology, and statistical patterns without labeled targets.
- C is Correct: Distillation uses a prompt set (no pre-written responses). The larger teacher model generates responses to those prompts, and those teacher-generated responses are used to fine-tune the smaller student model. Asset C fits this exactly.
Distractor Analysis
- B is Incorrect: Although "abbreviation expansion" sounds simplistic, prompt-response pairs are exactly the format for supervised fine-tuning. The claim that the responses "don't teach instruction-following" is wrong—mapping abbreviations to expansions is a legitimate instruction-following task.
- D is Incorrect: Raw unlabeled prose does not contain implicit prompt-response structure. Neural networks are not capable of intuitively recognizing implicit labels in prose; supervised fine-tuning requires explicitly paired prompt and completion data.
- E is Incorrect: Distillation prompts and continued pre-training text serve different purposes. The 250,000 medical prompts are designed to elicit responses (making them suitable for distillation), not to serve as raw domain prose for unsupervised learning. Additionally, continuous pre-training generally requires substantive running text rather than sparse prompt phrases.
Key Takeaway: Memorize the three preparation artifacts: fine-tuning → paired examples (JSONL), continued pre-training → unlabeled domain text, distillation → prompt set (no responses).
Question 3 - PII Redaction Before Model Training
A bank is preparing a proprietary dataset to fine-tune a foundation model for customer support email summarization. The dataset contains 15,000 support email threads with customer names, account numbers, and Social Security numbers. The bank's compliance team mandates that no personally identifiable information (PII) can exist in the training data, and the team must provide evidence that the data was automatically scanned and cleaned before training.
The team wants a solution with the least operational overhead while ensuring all PII is removed.
Which pipeline should the team use? (Select ONE)
- A) Use Amazon Macie to automatically discover and report sensitive data in the S3 bucket containing the email threads. Then manually review and redact flagged files using a Jupyter notebook.
- B) Use Amazon Comprehend
DetectPiiEntitiesto identify PII in the email text, then use AWS Glue with a custom PySpark job to replace the detected entities with generic tokens (e.g.,[NAME],[SSN]). Then export the cleaned dataset to S3 for fine-tuning. - C) Use Amazon Bedrock Guardrails to automatically redact PII during the fine-tuning job—no pre-processing is needed because Guardrails runs in the training loop.
- D) Configure AWS Glue DataBrew with a recipe that shuffles rows to anonymize the data, ensuring individuals can no longer be identified, then trigger the Bedrock fine-tuning job directly from DataBrew.
- E) Use Amazon SageMaker Data Wrangler to load the dataset, then apply a built-in "Anonymize" transformation that replaces all string fields with random integers.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
- B is Correct: Amazon Comprehend's
DetectPiiEntitiesAPI is a managed service that detects PII entities in text. Pairing it with AWS Glue (a serverless ETL tool) allows building a transform that masks or redacts detected entities with placeholder tokens ([NAME],[SSN]). This removes PII before training with minimal infrastructure and satisfies the compliance requirement. The solution is fully serverless and requires no manual intervention.
Distractor Analysis
- A is Incorrect: Amazon Macie is a discovery and reporting tool that identifies where sensitive data exists in S3 buckets, but it does not perform redaction or masking. Also, manually reviewing and redacting 15,000 emails using a Jupyter notebook is operationally heavy and unscalable.
- C is Incorrect: Amazon Bedrock Guardrails is a runtime moderation mechanism that filters prompts and model responses during inference. It does not operate inside the fine-tuning training loop to redact training data. Additionally, the compliance requirement explicitly states that PII must be removed from the training data.
- D is Incorrect: Shuffling rows does not anonymize data—if the PII still appears in the text fields, an individual can still be identified. Also, AWS Glue DataBrew cannot trigger Bedrock fine-tuning jobs directly. Anonymization and row shuffling are not equivalent concepts.
- E is Incorrect: SageMaker Data Wrangler does not have a built-in "Anonymize" transformation that replaces string fields with random integers. True anonymization is not achieved by simple type casting; it requires removing or obfuscating identifying attributes while preserving statistical utility where possible.
Key Takeaway: Detection (Macie) and redaction (Comprehend + Glue) are separate steps—Macie locates sensitive files, but Code/Comprehend performs the actual masking, redaction, or anonymization before training.
Question 4 - Data Validation and Quality Control for Fine-Tuning
A product company is ready to fine-tune a foundation model for generating product descriptions. The team has assembled a dataset in JSONL format with 8,000 prompt-completion pairs. Before launching the Bedrock fine-tuning job, the team lead wants to ensure that:
- The JSONL file contains no malformed JSON objects.
- No prompt-completion pair exceeds the model's context window.
- No suspiciously low-quality samples (e.g., empty completions, non-English text) remain.
Which combination of AWS services will validate the dataset with the LOWEST operational overhead? (Select ONE)
- A) Use Amazon SageMaker Processing with a pre-built PySpark container to run data quality checks: parse JSON, count tokens, and filter empty completions; write the cleaned dataset back to S3.
- B) Use Amazon Augmented AI (A2I) with a private workforce to manually review all 8,000 pairs for quality before training.
- C) Use AWS Glue Studio with a visual ETL job: use a
Parse JSONtransform, a customFiltertransform that checks field lengths against the context window limit, and a conditionalDelete Rowstransform for empty completions. Run on a scheduled basis. - D) Deploy the JSONL dataset to an Amazon DynamoDB table, then use DynamoDB Streams and AWS Lambda to validate serialization, check for empty messages, and reject anomalous records.
- E) Use Amazon SageMaker Data Wrangler to load the JSONL file, then apply a "Data Quality and Insights" report that automatically detects malformed JSON and token counts, and export the validated dataset back to S3.
Click to reveal Answer & Explanation
Correct Answer: A
Correct Answer Analysis
- A is Correct: Amazon SageMaker Processing provides a fully managed ephemeral compute environment for running custom data validation scripts (e.g., PySpark or plain Python). A Processing job can parse each line of the JSONL file, catch JSON exceptions, count tokens using a tokenizer (e.g., tiktoken or nltk), filter empty completions or suspicious language, and output a clean dataset to S3. This is a standard, low-overhead approach for programmatic data quality checks without needing to manage a cluster.
Distractor Analysis
- B is Incorrect: Amazon Augmented AI (A2I) is used for human review of ML predictions—not for data quality validation during model training. Manually reviewing 8,000 pairs is time-intensive, error-prone, and operationally heavy.
- C is Incorrect: While AWS Glue Studio can parse JSON and filter rows, AWS Glue (as a managed ETL service) is optimized for large-scale batch transformations, not granular token counting or context window validation against an arbitrary model limit. Also, a scheduled job is not necessary—the cleaning needs to happen once prior to the fine-tuning job, not on a recurring basis.
- D is Incorrect: Deploying DynamoDB + DynamoDB Streams + Lambda to validate a static JSONL dataset is architectural overkill. The data is not a high-velocity streaming input; it is a static file that needs simple batch validation. Additional operational complexity is incurred for zero benefit.
- E is Incorrect: SageMaker Data Wrangler's Data Quality and Insight report provides statistical summaries (e.g., missing values, distributions, outliers) for tabular data. It is not designed to validate JSONL prompt-completion pairs or measure context window token length within a text prompt.
Key Takeaway: Use SageMaker Processing for custom, programmatic validation of JSONL training data when your checks go beyond row-level ETL (e.g., token counting, JSON schema validation, language filtering).
Question 5 - Tokenization and Context Window Management
A legal research platform is preparing to fine-tune a foundation model that has a 2,048-token context window. The platform's dataset contains 1,000 legal case summaries in JSONL format, each with a prompt (e.g., "Summarize this case: ...") and a completion (the summary). The team observes that:
- 200 of the samples have a combined prompt+completion length exceeding 2,048 tokens.
- Some of the completions are truncated mid-sentence.
Which approach must the team take before fine-tuning? (Select ONE)
- A) Use Amazon SageMaker Data Wrangler to apply a
StandardScalertransformation to the token counts, normalizing them to fit within the 2,048 window. - B) Split over-length samples into multiple sub-samples using a sliding window approach, preserving continuity across adjacent chunks by overlapping tokens.
- C) Use Amazon Comprehend's
SplitDocumentsAPI to automatically divide over-length documents into semantically meaningful segments. - D) Remove the over-length samples from the dataset entirely, even if it means discarding 20% of the training data.
- E) Increase the context window of the model by configuring an extended
MaxTokenLengthparameter in the Bedrock fine-tuning job.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
- B is Correct: When samples exceed the context window, a standard technique is to split them into smaller overlapping chunks (sliding window) so that important information spanning the boundary between chunks is not lost. Each sub-chunk forms a new prompt-completion pair. This is commonly done with a tokenizer-aware splitter and overlap (e.g., 10-15%). It preserves data utility rather than discarding useful training examples.
Distractor Analysis
- A is Incorrect:
StandardScaleris a feature scaling transform used to center and rescale numeric tabular features. It has no meaning for text sequences and cannot "compress" token counts. Token count is not a continuous variable that can be normalized into a model input—the model processes fixed-length sequence windows. - C is Incorrect: Amazon Comprehend does not have a
SplitDocumentsAPI. While Comprehend hasDetectEntities,DetectKeyPhrases,DetectPiiEntities,DetectSentiment, etc., there is no built-in document splitting capability for chunking long text into token-aware segments. - D is Incorrect: Discarding 20% of training data may be a valid fallback if splitting is not possible or if the over-length samples are of poor quality. However, in this scenario, the over-length legal summaries likely contain long factual context rather than noise. Splitting with overlap better preserves the rich training signal than deletion.
- E is Incorrect: The context window is a fixed property of the foundational model architecture (e.g., 2,048 tokens for certain variants) and cannot be dynamically extended via an API parameter in Bedrock fine-tuning. Some models (e.g., Claude) support longer context via prompt engineering, but fine-tuning context window is determined by the model checkpoint.
Key Takeaway: Tokenization is the first quality gate for fine-tuning prep—use a tokenizer to validate lengths, then split (with overlap) or truncate, never assume the model will auto-handle overflow.
Question 6 - Metadata Extraction for RAG Document Chunking
An e-commerce company is building a RAG application for its customer support portal. The document corpus consists of 3,000 product manuals in PDF format, spanning multiple product categories (e.g., electronics, kitchenware, sports equipment). The company wants to enable:
- Filtering retrieved chunks by product category before performing semantic search.
- Citation of the source manual (title, page number) in the generated answer.
- The ability to re-chunk only a subset of documents when a specific product manual is updated.
Which ingestion strategy will meet these requirements with the LEAST custom code? (Select ONE)
- A) Write a custom Python script using PyPDF to extract text from PDFs, chunk them using the
RecursiveCharacterTextSplitterwith custom metadata headers, and write the chunks to a CSV file for upstream processing. - B) Use an AWS Glue job with a PySpark script that reads PDFs from S3 via
spark.read.format("pdf"), extracts page numbers, creates a DataFrame withcategoryandmanual_titlecolumns, and writes the output to Parquet. - C) Configure a Bedrock Knowledge Base with an S3 data source. Use the native ingestion job (
StartIngestionJob) to automatically parse PDFs, split documents by a fixed token-size chunking strategy, extract document metadata (e.g., file name, S3 path), and generate embeddings that are stored in an OpenSearch Serverless vector collection with metadata fields. - D) Use Amazon Comprehend's
DetectDocumentTypeAPI to detect PDF types, then use SageMaker Processing to manually chunk documents using semantic segmentation and attach metadata as JSON attributes before upload to a custom vector store. - E) Use Amazon Textract to perform OCR on the PDFs and output raw text to S3, then use SageMaker Feature Store to store the chunks as feature vectors with the metadata as feature group labels.
Click to reveal Answer & Explanation
Correct Answer: C
Correct Answer Analysis
- C is Correct: Amazon Bedrock Knowledge Bases is a managed service that handles the heavy lifting of RAG ingestion: parsing documents from S3, chunking text into fixed-size or semantic chunks, extracting file-level metadata (S3 URI, file name, content type), invoking an embedding model via Bedrock, and writing vectors to an OpenSearch Serverless collection. It requires no custom chunking or metadata extraction code, which aligns with "least custom code." Metadata filtering by product category can be achieved using S3 prefixes (or metadata assigned at ingestion), and citations can use the file name and page number (if available).
Distractor Analysis
- A is Incorrect: Writing custom Python with PyPDF and recursive chunking introduces unnecessary operational complexity. Additionally, the custom script must manually manage metadata extraction (product category, page number) and re-chunk only updated manuals, which requires building custom logic for differential updates.
- B is Incorrect: AWS Glue with PySpark can read PDFs and create structured tables, but it does not natively handle embedding generation or vector store indexing. This option leaves a large portion of the RAG pipeline (embedding, vector indexing, retrieval) unbuilt. It also produces Parquet, not vector embeddings in a searchable vector store.
- D is Incorrect: Amazon Comprehend does not have a
DetectDocumentTypeAPI. Also, meaningful semantic segmentation and metadata processing are not part of Comprehend's feature set. Building custom chunking in SageMaker Processing reintroduces heavy custom code that the question seeks to avoid. - E is Incorrect: SageMaker Feature Store is designed to store and serve traditional ML features (numeric vectors for tabular models), not high-dimensional dense text embeddings for vector similarity search. It lacks the required vector search engine and metadata filtering capabilities that OpenSearch or a vector database provides.
Key Takeaway: For RAG ingestion with minimal code, Bedrock Knowledge Bases handles chunking, metadata extraction, embedding generation, and vector store indexing natively—don't rebuild it with Lambda + custom parsers.
Question 7 - Masking vs. Redaction vs. Anonymization
A privacy-conscious company is preparing a dataset of customer service transcripts for use in fine-tuning a foundation model. The dataset contains:
- Customer names and email addresses
- Phone numbers and mailing addresses
- Order IDs (not considered PII)
The company's legal team requires:
- PII must be irreversibly removed (not just hidden).
- Order IDs must remain in the text because they are needed for downstream model evaluation with ground-truth labels.
- The transformation must preserve the linguistic structure of the text.
Which approach should the ML engineer take? (Select ONE)
- A) Mask customer names, emails, phone numbers, and addresses with placeholder tokens (e.g.,
[CUSTOMER_NAME],[EMAIL_ADDRESS]) to preserve shape and order IDs remain untouched. - B) Redact PII by removing the detected entities entirely (e.g., replacing them with empty strings), which irreversibly removes the information while keeping order IDs intact.
- C) Anonymize the entire dataset by shuffling order IDs with customer names and addresses, making it statistically impossible to re-identify an individual while preserving all tokens in the text.
- D) Delete the entire transcript whenever any PII is detected, to guarantee removal and avoid complex transformation pipelines.
- E) Encode PII using a reversible hash function so it remains structurally consistent with the original text, but cannot be reversed by unauthorized personnel.
Click to reveal Answer & Explanation
Correct Answer: B
Correct Answer Analysis
- B is Correct: Redaction removes the sensitive entity entirely (replacing with empty string or whitespace), making the information irreversibly gone—which satisfies the legal requirement. Order IDs are not PII and are preserved. The surrounding non-sensitive text remains intact, preserving linguistic structure. The requirement that PII be irreversibly removed is specifically a redaction use case.
Distractor Analysis
- A is Incorrect: Masking hides a value while maintaining its shape and format (e.g.,
***@***.com,(555) 123-****). The original value can sometimes be inferred or reconstructed if the masking pattern is too weak (e.g., only masking the last 4 digits of a phone number). The legal team specifically required irreversible removal, which masking does not guarantee. - C is Incorrect: Anonymization modifies the dataset so individuals can no longer be identified, but shuffling PII tokens with non-PII tokens does not achieve this. The shuffled PII tokens are still present in the data. Also, anonymization should preserve utility where possible; shuffling order IDs and customer names across different transcripts breaks the relationship between order IDs and customer context, rendering the dataset useless for model evaluation.
- D is Incorrect: Deleting entire transcripts whenever PII exists would remove large portions of the training data, reducing its value and potentially introducing selection bias. The company wants to use the data, not discard it.
- E is Incorrect: Reversible hashing is a form of pseudonymization, not irreversible removal. Since the hash is reversible, the original PII can be recovered, which violates the legal requirement. Additionally, reversible hashing can produce unnatural text that degrades training signal.
Key Takeaway: Masking hides while maintaining shape; redaction removes entirely; anonymization transforms data so no individual can be identified. Match the method to the legal requirement.
Question 8 - Domain-Specific Text Augmentation for Low-Resource Fine-Tuning
A startup is building a fine-tuned foundation model for summarizing medical discharge instructions. The team has only 200 high-quality labeled examples, which is considered low-resource for fine-tuning a 7B-parameter model. The team wants to augment the dataset to improve model robustness and prevent overfitting.
Which augmentation techniques are appropriate? (Select TWO)
- A) Back-translation: Translate English medical instructions to Spanish and back to English using Amazon Translate, producing paraphrased versions of the original text while preserving medical terminology.
- B) Synonym replacement using domain ontology: Use Amazon Comprehend Medical to extract medical entities, then replace those entities with semantically equivalent terms from a curated clinical ontology (e.g., "hypertension" ↔ "high blood pressure").
- C) Random word deletion: Randomly delete words from the medical text to force the model to learn typo-invariance at fine-tuning time.
- D) Image augmentation with horizontal flips: Mirror the text sequences to increase variability and make the model rotation-invariant.
- E) Noise injection via random character scrambling: Randomly scramble characters in every sentence to make the model robust to variance.
Click to reveal Answer & Explanation
Correct Answers: A and B
Correct Options Analysis
- A is Correct: Back-translation is a well-established text augmentation technique. Translating domain text to another language and back creates paraphrased versions that preserve the underlying semantic content while varying superficially in word choice and sentence structure. Amazon Translate can perform this transformation at scale and is a native AWS service.
- B is Correct: Synonym replacement using a domain-specific ontology is a powerful augmentation method for specialized fields like medical language. Amazon Comprehend Medical extracts medical entities (e.g., conditions, medications, procedures), and replacing them with clinically equivalent terms from a curated ontology (e.g., SNOMED CT) increases the diversity of the training data while preserving medical correctness.
Distractor Analysis
- C is Incorrect: Random word deletion can produce grammatically broken text that does not match the distribution of real-world medical documentation. If the model is expected to summarize actual discharge instructions, training on corrupted text will degrade real-world performance. Word deletion is more appropriate for general NLP robustness tasks, not domain-specific instruction-following.
- D is Incorrect: Horizontal flips are an image augmentation technique for computer vision tasks. Text data cannot be "flipped horizontally" without destroying the sequential structure and meaning. This option does not apply to text fine-tuning.
- E is Incorrect: Random character scrambling destroys the structure of clinical terminology and would teach the model to operate on corrupted input. Fine-tuning data should represent the distribution of real-world input; if real discharge instructions do not contain random character scrambling, training on scrambled text will degrade performance.
Key Takeaway: Domain-specific text augmentation (back-translation, ontology-based synonym replacement) should preserve semantic correctness and match the inference-time data distribution.
Question 9 - Instruction Tuning Data Format and System Prompts
A company wants to fine-tune a foundation model using Amazon Bedrock to handle customer support queries for its SaaS product. The team has assembled 5,000 examples in JSONL format. The team lead wants to ensure that the fine-tuning data properly teaches the model the desired instruction-following behavior.
The team lead asks you to review the dataset and identify any issues before submitting the fine-tuning job.
Which of the following are valid considerations for the JSONL fine-tuning dataset? (Select TWO)
- A) Each line in the JSONL file should contain a
promptfield with the instruction or context, and acompletionfield with the desired model output. The dataset should be uploaded to an S3 bucket and referenced in theFineTuningJobConfig. - B) System prompts (e.g., "You are a helpful customer support assistant for a SaaS company") should be included in the
promptfield of each training example to help the model learn the assistant role—if system prompts are omitted, the fine-tuned model will not respond correctly when the system prompt is used at inference time. - C) The
completionfield can be left empty in 10% of the examples to teach the model to recognize low-quality inputs and produce a refusal response. - D) The JSONL file should be compressed with GZIP before uploading to S3, as Bedrock fine-tuning only supports
.jsonl.gzformat. - E) The dataset should include diverse examples covering edge cases, error messages, and ambiguous customer requests to prevent the model from overfitting to a narrow distribution of prompts.
Click to reveal Answer & Explanation
Correct Answers: A and E
Correct Options Analysis
- A is Correct: Amazon Bedrock fine-tuning requires JSONL format with paired
promptandcompletionfields per row. The dataset must reside in an S3 bucket and be referenced using theFineTuningJobConfigAPI parameter. This is the standard format documented by AWS. - E is Correct: Data diversity is a core principle in fine-tuning. Including edge cases, error scenarios, and varied phrasings of the same task prevents model overfitting and improves generalization to real-world customer queries. A narrow distribution leads to a brittle model that only works for prompts closely resembling the training examples.
Distractor Analysis
- B is Incorrect: While system prompts can be included in the
promptfield as part of the formatting strategy, it is not an absolute requirement for all Bedrock models. The instruction should be judged based on the chosen model and desired behavior. Additionally, including a static system prompt in every example does not guarantee that the fine-tuned model will automatically recognize the system prompt at inference—consistent formatting is more important than any single token. This option overstates the importance of system prompts in Bedrock fine-tuning. - C is Incorrect: Empty completions would teach the model to produce empty responses. To train a model to refuse low-quality or harmful inputs, the completion field should contain an explicit refusal response (e.g., "I'm sorry, I cannot assist with that request."), not be left empty. An empty completion provides no learning signal.
- D is Incorrect: Amazon Bedrock fine-tuning accepts
.jsonlfiles in S3. Compression is not required, and the service does not exclusively require.jsonl.gz. Some AWS fine-tuning APIs accept multiple file formats, but plain JSONL remains the canonical supported format.
Key Takeaway: Fine-tuning JSONL must be diverse, tabularly formatted (prompt/completion per line), and reference the S3 URI in the job config—never rely on empty completions or file compression tricks to satisfy format requirements.
Question 10 - Distillation Dataset Preparation Pipeline
A machine learning team at a logistics company wants to compress a large, expensive proprietary foundation model into a smaller, fine-tuned model for real-time route optimization queries. The team will use Amazon Bedrock model distillation. The goal is to train a smaller student model that imitates the teacher model's responses to domain-specific prompts.
The team has:
- A large set of 50,000 real-world routing queries from their production system (all without ideal responses).
- Access to the teacher model through Amazon Bedrock.
- An S3 bucket for storing intermediate data.
Which pipeline should the team implement for distillation with the LOWEST ongoing operational cost? (Select ONE)
- A) Write a Python script that iterates over all 50,000 prompts, calls the Bedrock teacher model (
InvokeModel) to generate responses, saves the prompt-response pairs to a JSONL file in S3, then launches a Bedrock fine-tuning job using the JSONL to train the student model. - B) Use AWS Step Functions with a Map state to invoke the teacher model concurrently for each prompt, accumulate the responses in S3, then trigger a separate Bedrock fine-tuning job using the generated JSONL. Run this pipeline daily on a schedule.
- C) Upload the 50,000 prompts to Bedrock as unlabeled data for continued pre-training, which will directly update the smaller model's weights to match the teacher's behavior without needing labeled responses.
- D) Configure a Bedrock Knowledge Base with the 50,000 prompts as data sources, enable "distillation mode" that automatically uses teacher responses to fine-tune a student model, and enable scheduled updates to keep the student model in sync.
- E) Use Amazon SageMaker Ground Truth to have human annotators label the 50,000 prompts with optimal responses, then use those labels to fine-tune a student model via the Bedrock fine-tuning API.
Click to reveal Answer & Explanation
Correct Answer: A
Correct Answer Analysis
- A is Correct: The distillation workflow involves (1) collecting a prompt set, (2) invoking the teacher model via Bedrock's
InvokeModelAPI to generate responses, (3) saving the prompt-completion pairs as JSONL, and (4) launching a Bedrock fine-tuning job on the student model with the teacher-generated responses. This is the standard managed distillation path in Bedrock. It uses a single-pass batch generation approach, which is cost-effective for a one-time distillation run. Ongoing operational costs are minimal because no recurring scheduled job is needed.
Distractor Analysis
- B is Incorrect: Step Functions Map state is useful for distributed task orchestration, but it introduces unnecessary complexity for a one-time batch generation. Additionally, running the pipeline daily on a schedule is unnecessary—the routing domain does not change daily, and repeated distillation runs would rack up unnecessary inference and training costs.
- C is Incorrect: Continued pre-training uses unlabeled raw text to update the model's domain knowledge, but it does not train the student model to specifically imitate the teacher's outputs. This would not achieve behavioral cloning (the core of distillation). It also ignores the teacher model entirely, which is central to distillation.
- D is Incorrect: As of this writing, Amazon Bedrock Knowledge Bases does not have a "distillation mode" that automatically uses teacher responses to fine-tune a student model. Knowledge Bases is designed for RAG ingestion (chunking, embedding, and vector indexing), not model compression or distillation.
- E is Incorrect: SageMaker Ground Truth is a data labeling service that uses human annotators. Using human annotators to label 50,000 prompts is expensive, slow, and contradicts the purpose of distillation, which is to use the teacher model's generated outputs (not human labels) as the training target.
Key Takeaway: Distillation prep produces a prompt set; the teacher model (via
InvokeModel) generates the responses, and those pairs are used to fine-tune a student. There is no managed "one-click distillation" feature in Bedrock—you orchestrate the teacher invocation step yourself.