Adoption and operations
RAG Preprocessing Explained: The Document Preparation That Determines Answer Quality, Complete Guide
Korea Deep LearningPublished
RAG preprocessing is the preparatory work that analyzes documents for retrieval-augmented generation, organizes them so that their structure and meaning are kept, and turns them into searchable chunks. It is the step that determines the quality of the material the model uses as evidence.
Why RAG Preprocessing Is Necessary
Sometimes changing the model does not improve answers.
Organizations that adopt generative AI often report the same thing. They attached a good model, but questions about their work still get wrong answers. Tracing the cause back, the problem is often not the model but the material it was given. Administrative documents, manuals and statutes are stored as PDFs and Korean word processor files, and those files were pasted in as plain text.
The problem is that the structure disappears the moment only the text is extracted. Suppose a document explaining the return procedure has a table split into multi-level headers for state funds and local funds, balances and interest. If that table is unfolded into a list of sentences, it is no longer possible to tell which account falls under which condition. The model then produces plausible-sounding sentences on top of this scrambled material. Low answer quality usually has its origin here.
Precise Definition of RAG Preprocessing: How It Differs from Text Extraction
Text Extraction and RAG Preprocessing, Three Axes of Difference
First, the target differs. Text extraction targets the characters written in a document. RAG preprocessing targets, in addition to the characters, the hierarchy of titles and body text, the rows and columns of tables, the relationship between figures and their descriptions, and the connection between footnotes and body text. It is not reading the document but carrying over its framework along with its content.
Second, the goal differs. The goal of text extraction is to pull out the content without omission. The goal of RAG preprocessing is to arrange the material so that when a question comes in later, exactly the right passage is retrieved. So the same document is divided into chunks in different ways depending on the questions it is expected to receive.
Third, the metrics differ. Text extraction is measured by character accuracy. RAG preprocessing is measured by the accuracy of the final answer. In one tax administration validation, an evaluation set made of documents and questions was built to check both structuring and retrieval quality. Because the preprocessing stage is hard to score on its own, preparing pairs of questions and correct answers in advance is practically essential.
The two tasks are not alternatives. If character recognition is inaccurate, even well-divided content will retrieve wrong material. The right order is to build structure restoration on top of recognition, and chunking on top of that.
Six Conditions of RAG Preprocessing That Protect Answer Quality
The Six Conditions for RAG Preprocessing in Practice
First, the conversion must preserve structure. It must remain marked what is a title, a section, a table, a list or a figure description, so that the retrieval stage can use them. Separating the structural elements with tags and producing both markup and structured data gives more options later.
Second, chunk boundaries must match the logical units of the document. Cutting by character count alone breaks tables in the middle and splits articles into two chunks. Prefer section-level or table-level boundaries first, and treat length as a secondary condition. That is the safer approach.
Third, tables must be handled separately. Tables differ in nature from sentences, and cutting them the same way as text makes retrieval work poorly. Keeping a whole table as a single chunk while attaching which section it belongs to is a practical setup.
Fourth, metadata must be carried along. Document title, issuing agency, effective date, revision history and source page number should be attached to each chunk so that answers can cite their evidence. An answer that cannot show its evidence is not used in work.
Fifth, personal information must be de-identified. When public data is moved into a retrieval purpose, masking or replacing items that could identify a person is close to a precondition. This must be done before the chunks are made, so that original values do not remain in the search index.
Sixth, an evaluation set must be built first. To judge whether a change in preprocessing made things better or worse, you need a baseline to compare against using the same questions. Building an evaluation set of several hundred items early on makes later improvement measurable.
Practical Application of RAG Preprocessing
Classify the Document Assets First
The first task of a project is not conversion but understanding the nature of the target documents. Statutes and notices with clear article structure, manuals where sections and items form a hierarchy, short independent official letters, and application forms where tables are the body each need to be split in a different way.
In one metropolitan local government case, administrative documents were structured and then divided into text, tables and images. Markup, structured data, chunks and keywords were generated together and loaded into a knowledge repository. Converting a document once into several outputs means that when the search method changes later, the original does not have to be processed again.
Separate Structuring from Chunking
If structuring and chunking are bundled into a single process, the document has to be analyzed again every time the chunk size is adjusted. Separating the two steps lets you keep the structuring results as they are and experiment only with the chunking rules.
In real setups, the document is converted into structured data, the text is split into fixed-length units, and the results are sorted. Overlapping the neighboring chunks slightly reduces the problem of sentences being cut at a boundary and losing their meaning.
RAG Preprocessing in the Korean Context
A large share of Korean public document assets are stored in the Korean word processor format. Whether this format can be processed as it is becomes the first gate. If the table structure is lost when converting to another format, for example because merged table cells lose their information, later stages have no way to recover it.
The documents themselves also have their own features. Official letters, manuals, statutes and reports are mixed in one repository, and multi-level tables, circled-number item markers typical of government forms, and stamps that run over tables come in together. Revisions are also frequent in Korean public documents, so it is better to treat keeping the latest version and tracking the change history as requirements of the preprocessing stage.
On top of this, in environments with network separation, calls to external embedding services are restricted. Confirm whether the setup can carry out everything from document conversion through chunk creation to embedding inside the internal network.
Keep Sources Linked to Chunks
If an answer is built only from the retrieved chunks, the user has no way to check the evidence. If each chunk stores its original file, page number and position within the document, the answer can carry its sources.
This link matters a great deal in work. What an administrative officer needs when looking up policy information is not only the answer sentence but also which page of which guideline the evidence is on. The officer must be able to open the original and check it before submitting a decision based on the answer.
When implementing it, a simple approach is to use the identifier assigned at chunk creation in both the index and the original repository. Even when an original is replaced later, you can then trace which chunks are affected.
Update Chunks When Documents Are Revised
Public and financial document assets are revised often. Guidelines change, forms are revised, and statutes split by effective date. If the original has changed but the index has not, the model answers based on a regulation that has been repealed.
So the preprocessing pipeline needs an update path. When a new version arrives, find the chunks of that document and replace them, and either delete the previous version or mark its effective period so it is excluded from search. If effective and repeal dates are attached to the document as metadata, this process can be automated.
Reprocessing everything each time becomes harder to manage as volume grows. It is best to design the structure from the start to process only the documents that have changed.
Collect Retrieval Failure Cases and Feed Them Back
Preprocessing quality is not completed in one pass. Once real questions start coming in, unexpected failures appear.
The three most common types are these. The wording of the question differs from the wording of the document, so nothing is retrieved. The relevant content is scattered across several chunks, so only one of them is retrieved. Or the information in a table does not match a question phrased as a sentence.
Collecting these failure cases shows the way to respond. Wording differences are handled by attaching keywords to the chunks, scattered content is handled by redrawing chunk boundaries, and tables are handled by storing a summary sentence alongside them. The more failure cases accumulate, the thicker the evaluation set becomes, so the basis for improvement and the measurement criteria grow together.
Frequently asked questions
If answer quality is low, will changing the model help?
Usually not. The cause is often that the document structure was damaged at the preprocessing stage. Check first whether the retrieved chunks match the question, which is usually faster.
How many characters should a chunk be?
It depends on the nature of the document. Boundaries matter more than length, so first decide the section or table unit and then adjust the length within it.
Can documents with many tables be used for retrieval?
Yes. An effective approach is to keep each table in its structure as a single chunk, without expanding it into sentences, and attach information about the section it belongs to.
Can Korean word processor documents be processed?
Yes. However, table structure is easily lost in conversion, so check whether the original format can be processed as it is.
What about documents that contain personal information?
De-identification is performed before the chunks are made. If it is done after the index is built, original values can remain in search results.
Do I need to rebuild the whole index when a document is revised?
No. A structure that finds only the chunks of the changed document and replaces them is enough. If effective and repeal dates are attached to the document as metadata, the previous version can be excluded from search automatically.
Can tables and sentences be kept in the same index?
Yes, but it is better to store a summary sentence alongside each table. Tables differ in form from questions written as sentences, so without that summary they may not be retrieved.
How is preprocessing quality measured?
Build an evaluation set of questions and correct answers and measure against it. In one validation case, the target documents were defined, questions were prepared, and structuring and retrieval quality were checked together.
Send one document you plan to search and we will return the structuring and chunking results as they are.
Contact us



