AWS Builder Center

Chunking and Embeddings: Why They Matter in RAG

What splitting documents and turning text into numbers actually do in a RAG system, explained through a financial report example.

Grad Student
While working on my financial RAG project, I started with something simple: extracting text from a PDF and searching for words like “net revenue.”
It worked. But finding those words didn’t always give me the information I needed. Some pages mentioned revenue without showing the actual figures. Others discussed a different year.
That helped me understand why preparing and searching the document deserves as much attention as generating the answer.
Two parts I’m learning about are chunking and embeddings.
Why split a document into chunks?
Chunking means dividing a document into smaller sections.
Imagine a company report with more than 100 pages. If someone asks how revenue changed in 2025, most of those pages probably won’t help answer the question.
Instead of passing the whole report to the language model each time, a RAG application can search smaller sections and retrieve the relevant ones. This helps manage the amount of text sent to the model and can reduce unnecessary processing.
But deciding where to split matters.
Suppose a report contains this made-up example:
Net revenue, in millions: 2025: $112 2024: $100
If one chunk contains the numbers while another contains the heading and years, the information becomes harder to interpret. Does 112 mean dollars, millions of dollars, or something else?
A useful chunk should preserve enough context to make sense on its own. For financial reports, that can mean keeping a table together with its title, column headings, and units.
Small chunks can lose context. Large chunks can include too much unrelated information. There isn’t one chunk size that works best for every document.
What do embeddings add?
An embedding is a numerical representation of text. An embedding model turns a passage into a list of numbers that captures aspects of its meaning.
For example, a user might ask:
“How much money did the company make from sales?”
The report might use the phrase:
“Annual net revenue.”
These phrases use different words, but their meanings are related. Embeddings can help a search system find that connection.
In a typical vector-based RAG system, we create embeddings for the document chunks and store them in a searchable index. When someone asks a question, we embed that question too, then search for chunks with similar representations.
This is useful, but similarity does not guarantee that a passage answers the question. A section about 2024 revenue might look very similar to one about 2025. We still need to check the year, company, and other details.
How does this connect to the LLM?
Chunking and embeddings help with finding the reference material. The language model then receives the retrieved text alongside the question and generates an answer.
The stored embeddings usually aren’t what the answering model reads directly. They help locate the text that will be included in its prompt.
Also, this process does not retrain the language model on the report. We are giving it information to use for that particular response.
What I’m taking away
I’m starting to see that a wrong answer can begin before the question reaches the language model.
If a chunk loses its table headings, or retrieval selects the wrong year, the model may be working with incomplete or irrelevant information.
As I continue building, I want to inspect the retrieved chunks alongside the final answers. For a financial question, I should be able to point to the exact passage, confirm the units and year, and check any calculation.
That gives me something concrete to test as I learn.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article