Retrieval-Augmented Generation is how a general model answers from your documents — the merchant onboarding policy, the fee schedule, the dispute procedure — with citations and no retraining. Here's exactly how it works, step by step.
A foundation model is trained on public data up to a cutoff date. It has never seen your onboarding policy, your fee schedule, or yesterday's dispute procedure update. Ask it "what's the representment window for a goods-not-received chargeback?" and it will answer confidently — and probably wrongly.
They can't see your onboarding policy (ACP-ONB-001), fee schedule, or dispute procedure — so on internal questions they guess.
Instead of retraining, RAG finds the relevant clauses and injects them into the prompt. The model reads them and answers — grounded and cited.
Text becomes vectors, so meaning can be compared. "Goods not received" and "item never arrived" sit close together even with different words.
Update the document and the next answer reflects it — no retraining, and the model can cite exactly where the answer came from.
Every RAG system follows the same flow. Here's what happens when a merchant-ops officer asks: "What's the representment window for a goods-not-received chargeback?" Click any step to explore it.
| Step | What happens | Payments example |
|---|---|---|
| ❓ Query | Someone asks in natural language | "Representment window for a goods-not-received chargeback?" |
| 🔢 Embed | The question becomes a vector | [0.42, 0.78, -0.11, ...] |
| 🔍 Search | Find chunks with the closest vectors | Searches all chunked policy, fee, and dispute docs |
| 📄 Retrieve | Top matches returned with scores | ACP-DIS-014 §3 (0.94), §6 (0.88), ACP-ONB-001 §5 (0.71) |
| 🧩 Build prompt | Instructions + retrieved chunks + question | "Using only this context: [§3][§6]… answer and cite the clause." |
| ✨ Generate | Model answers, grounded and cited | "7 calendar days (ACP-DIS-014 §3)." No hallucinated number. |
Walk a real payments query through the pipeline. Pick a scenario, then step through — or press play — to watch the query get embedded, matched against document chunks, and turned into a grounded, cited answer.
Before anything can be retrieved, your documents are split into chunks and embedded. How you chunk decides what can be found. Chunk too big and answers get diluted with irrelevant text; too small and you lose the context that makes a clause meaningful.
A whole policy in one chunk retrieves lots of noise around the answer — higher cost, less focus, weaker citations.
A single sentence loses its context — "7 days" without the clause it belongs to isn't a usable answer.
One coherent idea per chunk — a clause or sub-section — with a little overlap so context isn't cut mid-thought.
Tag each chunk with its document ID and section (ACP-DIS-014 §3) so the answer can cite precisely and retrieval can be scoped.
You don't have to assemble the pieces by hand. Amazon Bedrock Knowledge Bases manages ingestion, chunking, embedding, the vector store, and retrieval — so you connect your documents and query them.
Point it at your documents (e.g. in Amazon S3); it chunks and embeds them for you.
A vector database is provisioned and kept in sync as documents change — no infrastructure to run.
One API retrieves the relevant chunks and generates a grounded answer with source references.
Attach Bedrock Guardrails and contextual-grounding checks so answers stay safe and grounded (Modules 04–05).
| Approach | How it works | Best when |
|---|---|---|
| Paste full document | Copy the whole doc into the prompt | One short document, one-off question |
| RAG ✓ | Auto-retrieve relevant chunks, inject, generate with citations | Many documents, changing content, need to cite — most payments Q&A |
| Fine-tuning | Retrain the model on your data | A fixed style/format need — not for facts that change or must be cited |