Course menuMLA-C02

Exams / MLA-C02 / Study guide / Embeddings and document prep for RAG

Embeddings and document prep for RAG: MLA-C02 study notes and practice questions

What to know about Embeddings and document prep for RAG for the MLA-C02 exam, from the Data Preparation for ML and AI domain (28% of the exam guide), then 2 free questions to test it. Part of the MLA-C02 study guide.

Last verified against current AWS documentation ·How we write our questions

What to know for the exam

These questions describe poor answers from a RAG app and trace the cause to how documents were parsed, chunked or tagged.

Parsing

  • The default parser extracts text and can flatten tables and layouts.
  • Advanced parsing with Bedrock Data Automation or a foundation model parser keeps tables, charts and complex layouts readable.
  • Clean out boilerplate (headers, footers, navigation) that adds noise.

Chunking strategies in Bedrock knowledge bases

Strategy Fits
Default / fixed-size Uniform text; set token size and overlap
Hierarchical Long structured documents: search small child chunks, return larger parent chunks for context
Semantic Split where meaning changes, so each chunk stays on one idea
No chunking Documents already split into small units, such as FAQ entries
Custom (Lambda) Your own logic, or LangChain and LlamaIndex splitters

Chunks that are too small lose context; too large dilute relevance and use more tokens. Overlap keeps sentences that cross a boundary.

Embeddings

  • Use one embedding model (such as Amazon Titan Text Embeddings V2 or Cohere Embed) for both documents and queries.
  • Choose dimensions and multilingual support to fit the content; changing the model means re-embedding.
  • Multimodal embeddings handle images.

Metadata

  • Add a <file>.metadata.json next to each S3 document with attributes such as department, product or date.
  • Metadata filters at query time restrict retrieval to matching documents, which improves relevance and keeps users to their own content.

Keeping it current

A sync (ingestion job) processes new, changed and deleted files in the data source and updates their vectors; it doesn’t rebuild everything.

Common traps

  • Tuning prompts when tables were broken at parsing time.
  • Separate knowledge bases per product when metadata filters do the job.
  • Bigger chunks to fix retrieval of the wrong product’s documents.

Try the 2 practice questions

A dental chain has built an Amazon Bedrock knowledge base over its insurance-plan documents, covering several plan types. Patients ask questions such as what a crown costs under the Gold plan, and the assistant sometimes quotes text from the Silver plan.

The fix must restrict retrieval to documents for the patient's own plan without editing the documents. The application already knows each patient's plan and can pass it with every query.

Which change meets these requirements?

Choose one answer.

  1. A. Lower the chunk size from 300 tokens to 100 tokens so that each chunk contains only one benefit description.
  2. B. Add a metadata file next to each plan document with the plan type as an attribute, and pass a filter on that attribute with each retrieval request.
  3. C. Create a separate knowledge base for each plan type, and have the application route each question to the knowledge base that matches the patient's plan.
  4. D. Ask the foundation model in the prompt to ignore any plan other than the patient's, and rely on it to follow that rule.
Show the answer and explanation

Answer: B

  • A. Wrong: Smaller chunks may split benefits more finely, but they do not stop Silver text from being retrieved for a Gold patient. The retrieval still searches all plans.
  • B. Right: Correct. Bedrock knowledge bases can attach metadata attributes to documents through metadata files, and retrieval can filter on them. Each query then searches only the documents for the patient's plan. Learn more: Include metadata in a data source to improve knowledge base queries (opens in a new tab)
  • C. Wrong: Separate knowledge bases can restrict retrieval, but the team would run several data sources and sync jobs and maintain routing logic for each plan. Metadata filtering achieves the same restriction within one knowledge base.
  • D. Wrong: A prompt instruction is not a retrieval control, and the model can still be given the Silver text. The stem asks for a change that restricts what is retrieved.

Explanation

Metadata files give each document attributes such as plan type, and a retrieval filter on that attribute makes each query search only the matching plan. Chunk size does not restrict which plan is searched. Separate knowledge bases add sync jobs and routing to maintain, and prompt instructions rely on the model instead of restricting retrieval.

Study

A logistics broker is building a Bedrock knowledge base over PDF rate sheets. Each sheet holds tables of lane rates, fuel surcharges and accessorial fees, with a header row that repeats across pages.

When the knowledge base uses default fixed-size chunking on plain text extraction, answers quote rates from the wrong lane because a table row is split across two chunks. The fix must keep each table row intact and must not require the broker to convert the PDFs by hand.

Which change meets these requirements?

Choose one answer.

  1. A. Increase the chunk size so that most rate sheets fit into one chunk, and keep plain text extraction.
  2. B. Export every rate sheet to a spreadsheet by hand each month, and upload the spreadsheets to the data source in place of the PDFs.
  3. C. Choose a parsing option that understands tables in PDFs, such as Bedrock Data Automation or a foundation model parser, and chunk the parsed output.
  4. D. Switch the vector store from Amazon OpenSearch Serverless to Amazon Aurora PostgreSQL with pgvector, and keep the same parsing and chunking settings.
Show the answer and explanation

Answer: C

  • A. Wrong: Large chunks can hold a whole sheet, but retrieval then returns too much text for the model and dilutes the relevant lane. The stem asks to keep table rows intact in a retrievable form.
  • B. Wrong: This would handle tables, but manual conversion each month conflicts with the requirement. The team would also lose the source PDFs as the authoritative documents.
  • C. Right: Correct. The default parser extracts only plain text, while Bedrock Data Automation and foundation model parsers extract tables with their structure before chunking. The broker keeps the original PDFs and needs no manual conversion. Learn more: Parsing options for your data source (opens in a new tab)
  • D. Wrong: The vector store stores embeddings and does not decide how a PDF table is split into chunks. Changing it does not address the split row.

Explanation

The rows are split because the default parser flattens the PDF tables into plain text before chunking. A parsing option that understands tables, such as Bedrock Data Automation or a foundation model parser, preserves the table structure, and chunking then works on structured content. Larger chunks, manual spreadsheets and a different vector store do not change how the tables are parsed.

Study

Want more on Embeddings and document prep for RAG? The 5 full-length practice sets have 8 more Embeddings and document prep for RAG questions, 325 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets

Study Embeddings and document prep for RAG

More Data Preparation for ML and AI topics