{"id":1526,"date":"2026-08-11T09:00:00","date_gmt":"2026-08-11T00:00:00","guid":{"rendered":"https:\/\/blog.hancom.com\/rag-system-build-document-parsing-guide\/"},"modified":"2026-08-11T09:03:44","modified_gmt":"2026-08-11T00:03:44","slug":"rag-system-build-document-parsing-guide","status":"publish","type":"post","link":"https:\/\/blog.hancom.com\/en\/rag-system-build-document-parsing-guide\/","title":{"rendered":"Building your first RAG system? A step-by-step guide from document parsing to Q"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u201cThey\u2019re telling me to build a chatbot with internal documents, but I\u2019m not even sure what RAG is.\u201d<\/p>\n\n<p class=\"wp-block-paragraph\">\u201cThere are too many components\u2014where do I even start?\u201d<\/p>\n\n<p class=\"wp-block-paragraph\">Everyone faces challenges when first building a RAG (Retrieval-Augmented Generation) system. RAG is a technology in which an LLM retrieves external documents as supporting evidence before generating an answer, but a closer look reveals a string of unfamiliar terms such as chunking, embedding, and vector DB. This article provides a step-by-step overview of the entire workflow, from the concept of RAG and its seven core components to implementation methods using LangChain and LlamaIndex, as well as document parsing and preprocessing that determine accuracy.  <\/p>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<h2 class=\"wp-block-heading\"><strong>What is a RAG system? The concept of retrieval-augmented generation and why it emerged <\/strong><\/h2>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<p class=\"wp-block-paragraph\">RAG (retrieval-augmented generation) is a technique that searches external documents and uses them as evidence before an LLM answers, introduced to address the limits of training data and the hallucination problem.<\/p>\n\n<h3 class=\"wp-block-heading\"><strong>RAG concept and definition<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">RAG is a technique in which an LLM first retrieves relevant information from reliable external knowledge sources before generating an answer, then produces the answer grounded in that information. As the name suggests, it refers to a structure that combines three actions in order: Retrieval + Augmented + Generation. <\/p>\n\n<p class=\"wp-block-paragraph\">When documents run to thousands of pages, you can\u2019t feed them into an LLM all at once\u2014RAG retrieves only the necessary parts and provides them as evidence. The <a href=\"https:\/\/arxiv.org\/abs\/2005.11401\" target=\"_blank\" rel=\"noopener\">paper on general-purpose fine-tuning methods for RAG<\/a> also reports that combining an external retrieval index makes answers more specific and closer to factual.<\/p>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-concept-retrieval-augmented-generation-1024x576.png\" alt=\"Image explaining the three core stages of a RAG system&#x2014;Retrieval, Augmented, and Generation\" class=\"wp-image-1243\" srcset=\"https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-concept-retrieval-augmented-generation-1024x576.png 1024w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-concept-retrieval-augmented-generation-300x169.png 300w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-concept-retrieval-augmented-generation-768x432.png 768w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-concept-retrieval-augmented-generation-600x338.png 600w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-concept-retrieval-augmented-generation.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<h3 class=\"wp-block-heading\"><strong>Limitations of using an LLM alone and the hallucination problem<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">Because an LLM does not know information after its training point or domain knowledge it was never trained on, hallucinations can occur\u2014where it makes up unknown content as if it were fact.<\/p>\n\n<p class=\"wp-block-paragraph\">There are two causes: the knowledge cutoff, which prevents it from knowing information after training ends, and a lack of domain knowledge for internal policies or specialized documents it never learned. <a href=\"https:\/\/www.ibm.com\/think\/topics\/retrieval-augmented-generation\" target=\"_blank\" rel=\"noopener\">IBM<\/a> also explains that hallucinations are more likely when a model cannot learn new data. <\/p>\n\n<h3 class=\"wp-block-heading\"><strong>Why RAG is needed<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">Because RAG retrieves external data and uses it as evidence for answers, it can reflect up-to-date information and reduce hallucinations without retraining the model.<\/p>\n\n<p class=\"wp-block-paragraph\">Fine-tuning requires retraining the model, but RAG can reflect the latest information by updating only the external index. It can also present the documents used for retrieval, making it easier to verify the basis for an answer. Reflecting current information without retraining costs\u2014and being able to check sources\u2014are key reasons teams choose RAG.  <\/p>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<h2 class=\"wp-block-heading\"><strong>RAG system diagram: seven core components<\/strong><\/h2>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<h3 class=\"wp-block-heading\"><strong>RAG system diagram: from document extraction to LLM answers<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">A RAG system works in the order: document extraction \u2192 parsing \u2192 chunking \u2192 embedding \u2192 vector DB storage \u2192 retrieval \u2192 LLM answer. Even though it looks like many steps, it becomes easier to understand when you group them into two parts. <\/p>\n\n<ol class=\"wp-block-list\">\n<li>Document extraction \u2013 pulls content from the original document<\/li>\n\n\n\n<li>Parsing \u2013 extracts text and structural information<\/li>\n\n\n\n<li>Chunking \u2013 splits the document into smaller units<\/li>\n\n\n\n<li>Embedding \u2013 converts the split text into numeric vectors<\/li>\n\n\n\n<li>Vector DB storage \u2013 loads the converted vectors into a retrieval store<\/li>\n\n\n\n<li>Retrieval \u2013 finds the content most similar to the question<\/li>\n\n\n\n<li>LLM answer \u2013 generates an answer grounded in the retrieved content<\/li>\n<\/ol>\n\n<p class=\"wp-block-paragraph\">The first five steps are the indexing process that prepares data in advance, while the last two steps (retrieval and LLM answering) run each time a question comes in.<\/p>\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/docs.aws.amazon.com\/prescriptive-guidance\/latest\/retrieval-augmented-generation-options\/what-is-rag.html\" target=\"_blank\" rel=\"noopener\">AWS guide<\/a> also notes that embedding storage is a one-time step, while retrieval, augmentation, and generation repeat for every question. This distinction between one-time preparation and repeated execution becomes a key lens for understanding the implementation methods covered later. <\/p>\n\n<h3 class=\"wp-block-heading\"><strong>Document parsing: the first step in RAG and the baseline for quality<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">Document parsing is the step that extracts text and structural information from original documents in formats such as HWP, HWPX, and PDF, and it determines the quality of subsequent chunking, embedding, and retrieval.<\/p>\n\n<p class=\"wp-block-paragraph\"><strong>If structural information is damaged at this stage, every subsequent step inherits data with that structure already lost. <\/strong><a href=\"https:\/\/docs.unstructured.io\/open-source\/core-functionality\/partitioning\" target=\"_blank\" rel=\"noopener\">As described in Unstructured\u2019s open source<\/a>, the core of parsing is splitting a document into elements such as Title, NarrativeText, and Table\u2014but in the Korean environment, the difficulty rises further with HWP and HWPX, which are optimized for local use. Hancom Data Loader directly parses these HWP\/HWPX files from the original binary without converting them to PDF, preserving table structures, footnotes, and metadata.  <\/p>\n\n<h3 class=\"wp-block-heading\"><strong>The roles of chunking and embeddings<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">Chunking is the process of splitting a document into smaller units, and embedding is the process of converting those split texts into numeric vectors that capture meaning.<\/p>\n\n<p class=\"wp-block-paragraph\">If chunks are too large, different topics get mixed together and retrieval becomes inaccurate; if they\u2019re too small, context breaks and meaning becomes hard to interpret. Traditional approaches that cut text only by character count fail to reflect document structure such as titles and paragraphs. The <a href=\"https:\/\/arxiv.org\/abs\/2507.09935\" target=\"_blank\" rel=\"noopener\">study on RAG chunks and frameworks<\/a> points out that this approach cannot produce chunks with sufficient meaning. <\/p>\n\n<h3 class=\"wp-block-heading\"><strong>Vector databases and Top-K retrieval<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">A vector database is a retrieval-focused store that saves embedded vectors and quickly finds the vectors most similar to a user\u2019s question. Common vector databases include FAISS and Chroma. <\/p>\n\n<p class=\"wp-block-paragraph\">Top-K is the value that determines how many high-similarity items to return from retrieval results. If K is too large, low-relevance information may be pulled in; if it\u2019s too small, needed information can be missed\u2014so choosing an appropriate value matters. <\/p>\n\n<h3 class=\"wp-block-heading\"><strong>The LLM answer generation stage<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">The LLM takes the retrieved document chunks as context and generates the final answer based on a prompt that combines them with the user\u2019s question.<\/p>\n\n<p class=\"wp-block-paragraph\">A prompt is the combination of retrieved document content and the user\u2019s question. Because the model answers based on retrieved evidence rather than its own memory, how accurately the earlier stages retrieve the right materials largely determines answer quality. <\/p>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-search-flow-1024x576.png\" alt=\"Image showing the flow where documents go through chunking, embedding, and vector DB retrieval to generate an answer in a RAG system\" class=\"wp-image-1244\" srcset=\"https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-search-flow-1024x576.png 1024w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-search-flow-300x169.png 300w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-search-flow-768x432.png 768w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-search-flow-600x338.png 600w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-search-flow.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<h2 class=\"wp-block-heading\"><strong>How to build a RAG system: from preprocessing to answer generation<\/strong><\/h2>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<p class=\"wp-block-paragraph\">Building a RAG system can be divided into a preprocessing domain that extracts and structures documents, and a retrieval\/generation domain that handles everything from chunking to answer generation\u2014then connecting the two domains with the right solutions.<\/p>\n\n<h3 class=\"wp-block-heading\"><strong>Building a RAG system: documents<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">The RAG system build process is divided into a preprocessing domain that extracts and structures documents and a retrieval\/generation domain that handles everything from chunking to answer generation\u2014then connecting each domain with the right solutions.<\/p>\n\n<h4 class=\"wp-block-heading\"><strong>Step 1: Document structure analysis and RAG document preprocessing<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">In the document preprocessing stage, you analyze the original document\u2019s layout, tables, and paragraph hierarchy and convert them into structured data. The quality of this output determines chunking accuracy later.<\/p>\n\n<p class=\"wp-block-paragraph\">The core of this process is DLA (Document Layout Analysis), which distinguishes text, images, tables, and graphics and identifies their positions and relationships. The results are organized into a standard structure, like the Document objects produced by <a href=\"https:\/\/reference.langchain.com\/python\/langchain-core\/document_loaders\" target=\"_blank\" rel=\"noopener\">LangChain<\/a>\u2019s DocumentLoader. However, because you must account for formats, table structures, and Korean-language document characteristics, teams often place a specialized preprocessing solution at the front to handle this stage.  <\/p>\n\n<h4 class=\"wp-block-heading\"><strong>Step 2: Chunking, embedding, and vector DB storage<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">Preprocessed data is chunked, vectorized via an embedding model, and stored in a vector database for later retrieval.<\/p>\n\n<p class=\"wp-block-paragraph\">This is the indexing stage that prepares retrieval data in advance before questions arrive, and RAG frameworks typically handle chunking, embedding, and vector database storage.<\/p>\n\n<h4 class=\"wp-block-heading\"><strong>Step 3: Retrieval and LLM answer generation<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">When a user question comes in, it is vectorized with the same embedding model, similarity search is performed, and the retrieved documents are passed to the LLM to generate the final answer.<\/p>\n\n<p class=\"wp-block-paragraph\">This RAG retrieval process converts the question into an embedding, extracts relevant chunks via similarity search in the vector DB, assembles them into a prompt, and has the LLM answer. The question must be vectorized in the same way as stored documents to correctly find semantically similar content. <\/p>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-data-structuring-process-1024x576.png\" alt=\"Image showing the process where AI analyzes structured and unstructured documents and converts them into structured data such as JSON, CSV, and HTML when building a RAG system\" class=\"wp-image-1245\" srcset=\"https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-data-structuring-process-1024x576.png 1024w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-data-structuring-process-300x169.png 300w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-data-structuring-process-768x432.png 768w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-data-structuring-process-600x338.png 600w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-data-structuring-process.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<h2 class=\"wp-block-heading\"><strong>How to implement RAG: LangChain vs. LlamaIndex<\/strong><\/h2>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<p class=\"wp-block-paragraph\">RAG can be implemented with frameworks such as LangChain and LlamaIndex, and each framework differs in how it composes components from document loading through retrieval and generation.<\/p>\n\n<h3 class=\"wp-block-heading\"><strong>How to implement RAG with LangChain<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.langchain.com\/\" target=\"_blank\" rel=\"noopener\">LangChain<\/a> is a framework that builds a RAG pipeline by combining components such as DocumentLoader, Text Splitter, Retriever, and Chains.<\/p>\n\n<p class=\"wp-block-paragraph\">The implementation flow is: load documents with a DocumentLoader, split them with a Text Splitter, embed and store them in a vector store, retrieve results with a Retriever, connect them via a Chain, and call the LLM. Because it\u2019s a modular, component-assembly structure, it can flexibly support complex workflows. <\/p>\n\n<h3 class=\"wp-block-heading\"><strong>How to implement RAG with LlamaIndex<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.llamaindex.ai\/\" target=\"_blank\" rel=\"noopener\">LlamaIndex<\/a> is a framework specialized in indexing diverse data sources, with strengths in connecting documents and building indexes.<\/p>\n\n<p class=\"wp-block-paragraph\">The core is a data connector that converts content from multiple sources into Document objects and builds them into an index. The <a href=\"https:\/\/developers.llamaindex.ai\/python\/framework\/understanding\/rag\/loading\/\" target=\"_blank\" rel=\"noopener\">official LlamaIndex documentation<\/a> describes this loading process as a flow of loading, transforming, indexing, and storing. Even within RAG, if LangChain emphasizes chain\/agent composition, LlamaIndex\u2019s strengths lie in data indexing and retrieval optimization. <\/p>\n\n<h3 class=\"wp-block-heading\"><strong>Criteria for choosing RAG document preprocessing tools<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">The right RAG document preprocessing tool depends on the document formats you need to handle and the complexity of their structure. Plain text and PDFs are often fine with basic document loaders, but complex tables or Korean domestic formats typically require separate preprocessing.<\/p>\n\n<p class=\"wp-block-paragraph\">LangChain and LlamaIndex document loaders handle pipeline wiring\u2014such as chunking, retrieval, and chain composition\u2014well, but because they\u2019re optimized mainly for PDFs and text, they may struggle to preserve structure for tables with merged cells or domestic formats like HWP and HWPX.<\/p>\n\n<p class=\"wp-block-paragraph\">According to reporting by <a href=\"https:\/\/www.aitimes.com\/news\/articleView.html?idxno=158910\" target=\"_blank\" rel=\"noopener\">AI Times<\/a>, Hancom Data Loader is a solution that extracts text and various objects from PDFs and Office documents and preprocesses them into data for AI training. It later expanded support to structured data extraction across HWP, HWPX, PDF, and OOXML overall, based on DLA and OCR (Optical Character Recognition) and TSR (Table Structure Recognition). <\/p>\n\n<p class=\"wp-block-paragraph\">\ud83d\udca1 If table structures or HWP\/HWPX parsing are bottlenecks in your RAG pipeline, you can upload real documents in the Hancom Data Loader live demo and check the extraction results directly.<\/p>\n\n<p class=\"wp-block-paragraph\">\ud83d\udc49 <a href=\"https:\/\/livedemo.sdk.hancom.com\/dataloader\" target=\"_blank\" rel=\"noopener\">Go to Hancom Data Loader Live Demo<\/a><\/p>\n\n<h3 class=\"wp-block-heading\"><strong>LangChain vs. LlamaIndex: what\u2019s different?<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">LangChain is strong at composing diverse LLM chains and agents, while LlamaIndex excels at indexing large document sets and optimizing retrieval\u2014so the right choice depends on your project goals.<\/p>\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.ibm.com\/think\/topics\/llamaindex-vs-langchain\" target=\"_blank\" rel=\"noopener\">IBM<\/a> distinguishes LangChain as an orchestration framework for LLM applications and LlamaIndex as a data orchestration framework.<\/p>\n\n<h4 class=\"wp-block-heading\"><strong>Comparison of strengths and best-fit use cases for LangChain and LlamaIndex<\/strong><\/h4>\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Category<\/strong><\/td><td><strong>LangChain<\/strong><\/td><td><strong>LlamaIndex<\/strong><\/td><\/tr><tr><td>Strength area<\/td><td>Workflow orchestration such as chains and agents<\/td><td>Data indexing and retrieval optimization<\/td><\/tr><tr><td>Best fit<\/td><td>Complex workflows, integrating a variety of tools<\/td><td>Large-scale document Q, lightweight RAG<\/td><\/tr><tr><td>Specialization<\/td><td>General-purpose LLM application composition<\/td><td>Connecting data sources and building indexes<\/td><\/tr><\/tbody><\/table><\/figure>\n\n<p class=\"wp-block-paragraph\">However, for both frameworks, performance ultimately depends on the quality of the input documents. No matter how well you assemble the pipeline, it\u2019s hard to overcome the limits of poor initial extraction. <\/p>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-ai-document-processing-flow-1024x576.png\" alt=\"Image showing the AI document processing flow&#x2014;from document input and analysis to data extraction and utilization&#x2014;when building a RAG system\" class=\"wp-image-1246\" srcset=\"https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-ai-document-processing-flow-1024x576.png 1024w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-ai-document-processing-flow-300x169.png 300w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-ai-document-processing-flow-768x432.png 768w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-ai-document-processing-flow-600x338.png 600w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/rag-system-build-ai-document-processing-flow.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<h2 class=\"wp-block-heading\"><strong>Common issues when building a RAG system and how to address them<\/strong><\/h2>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<p class=\"wp-block-paragraph\">Common issues in RAG builds include hallucinations and reduced retrieval accuracy due to loss of table and hierarchical structure\u2014both of which are directly tied to the quality of input document preprocessing.<\/p>\n\n<h3 class=\"wp-block-heading\"><strong>Core principles for preventing hallucinations in RAG<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">To reduce hallucinations in RAG, a key principle is to explicitly instruct the prompt to answer only from the retrieved context, and to constrain the model to say it doesn\u2019t know when the answer cannot be found in that context.<\/p>\n\n<p class=\"wp-block-paragraph\">Even so, RAG reduces hallucinations but does not eliminate them entirely. According to the <a href=\"https:\/\/arxiv.org\/abs\/2505.04847\" target=\"_blank\" rel=\"noopener\">study on LLM errors<\/a>, even when relevant context is provided, LLMs still often include unsupported information or contradictions. In other words, the fundamental path to reducing hallucinations ultimately lies in document quality at the input stage. <\/p>\n\n<h3 class=\"wp-block-heading\"><strong>TSR: how to extract merged cells and multi-level headers<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">TSR is a technique that restores row\/column relationships between cells, converting tables with merged cells and multi-level headers into structured data.<\/p>\n\n<p class=\"wp-block-paragraph\">In many cases, retrieval accuracy drops because table structure is lost at the input stage. When a table is handled as plain text, the linkage information between cells\u2014what tells you which values belong to which fields\u2014disappears. <\/p>\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/arxiv.org\/abs\/2605.00318\" target=\"_blank\" rel=\"noopener\">study on the STC (Structure-Aware Tabular Chunking) framework<\/a> measured accuracy metrics (MRR and Recall@1; closer to 1 means it finds the correct answer well) on table-heavy data such as legal contracts, evaluating how well question-relevant document chunks rise to the top of retrieval results.<\/p>\n\n<p class=\"wp-block-paragraph\">As a result, when chunking preserved table structure, the metric improved from around 0.36 to about 0.6\u20130.75 depending on the retrieval method. This indicates that structure-preserving chunking helps improve retrieval performance. Therefore, using a preprocessing solution that supports TSR can help increase retrieval accuracy even for documents with many complex tables.  <\/p>\n\n<h3 class=\"wp-block-heading\"><strong>The relationship between document preprocessing quality and RAG performance<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">Document preprocessing quality determines the upper bound of overall RAG system performance, and errors introduced during extraction propagate \uadf8\ub300\ub85c into chunking, retrieval, and generation.<\/p>\n\n<p class=\"wp-block-paragraph\">Text without structural information is hard to split into meaningful units, and when context-broken chunks are retrieved, the LLM generates answers that don\u2019t fit the context. In ChatDOC\u2019s own <a href=\"https:\/\/arxiv.org\/abs\/2401.12599\" target=\"_blank\" rel=\"noopener\">comparative test<\/a>, structure-aware parsing produced better results\u201447% better, 38% tied, and 15% worse\u2014than general extraction. Ultimately, checking from the document extraction stage is the key to building RAG.  <\/p>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<h2 class=\"wp-block-heading\"><strong>Building a RAG system: where should you start?<\/strong><\/h2>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<h3 class=\"wp-block-heading\"><strong>Pre-build checklist for RAG<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">Before building a RAG system, you should first review four items: the document formats to process, the security environment, infrastructure constraints, and the proportion of tables\/images.<\/p>\n\n<p class=\"wp-block-paragraph\">These four items are important criteria that determine which solution combination you need. By checking where your documents and environment fall before choosing a model, you can significantly reduce trial and error.<\/p>\n\n<h4 class=\"wp-block-heading\"><strong>Four items to review before building RAG and what to check<\/strong><\/h4>\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Review item<\/strong><\/td><td><strong>What to check<\/strong><\/td><\/tr><tr><td>Document formats<\/td><td>Do you need to handle domestic formats such as HWP\/HWPX?<\/td><\/tr><tr><td>Security environment<\/td><td>Is it a closed network environment where external transfer is restricted?<\/td><\/tr><tr><td>Infrastructure constraints<\/td><td>Do you need to run in a constrained environment, such as CPU-only?<\/td><\/tr><tr><td>Table\/image proportion<\/td><td>Are there many complex tables\/images, making AI pipeline integration important?<\/td><\/tr><\/tbody><\/table><\/figure>\n\n<p class=\"wp-block-paragraph\">If you\u2019re in a closed network where it\u2019s difficult to send documents outside, an on-premises approach installed directly on internal servers is a good fit. If you want to start with a small validation first, a SaaS approach billed per page works well for pilot use.<\/p>\n\n<h3 class=\"wp-block-heading\"><strong>What to check when you get stuck on document preprocessing<\/strong><\/h3>\n\n<p class=\"wp-block-paragraph\">If tables or Korean document structure break during document preprocessing, the cause is often not the RAG framework but the preprocessing solution that structures the input documents.<\/p>\n\n<p class=\"wp-block-paragraph\">The hallucinations, table-structure loss, and reduced retrieval accuracy we\u2019ve covered may look different on the surface, but they share one common cause: document preprocessing quality.<\/p>\n\n<p class=\"wp-block-paragraph\">According to reporting by <a href=\"https:\/\/www.cio.com\/article\/3519644\/\" target=\"_blank\" rel=\"noopener\">CIO Korea<\/a>, RAG is drawing attention as a way to reduce LLM hallucinations, but extracting data from unstructured enterprise documents is often not easy. As a result, preprocessing technology that refines documents into AI-friendly forms is becoming increasingly important. <\/p>\n\n<h4 class=\"wp-block-heading\"><strong>\u2705 Loss of table and hierarchical structure<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">If tables with merged cells or multi-level headers, or the hierarchy between titles and body text, are not properly distinguished in retrieval results, it\u2019s highly likely that structure is being lost during extraction.<\/p>\n\n<h4 class=\"wp-block-heading\"><strong>\u2705 Domestic document formats and closed-network environments<\/strong><\/h4>\n\n<p class=\"wp-block-paragraph\">If HWP\/HWPX make up a large share or you\u2019re in an environment where external transfer is blocked, general-purpose document loaders have limits\u2014so it\u2019s worth considering a separate preprocessing solution.<\/p>\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/hancom-data-loader-key-features-1024x576.png\" alt=\"Image explaining key features of Hancom Data Loader, including structured conversion for HWP\/HWPX\/PDF\/OOXML, DLA\/OCR\/TSR pipelines, and on-premises support\" class=\"wp-image-1247\" srcset=\"https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/hancom-data-loader-key-features-1024x576.png 1024w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/hancom-data-loader-key-features-300x169.png 300w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/hancom-data-loader-key-features-768x432.png 768w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/hancom-data-loader-key-features-600x338.png 600w, https:\/\/blog.hancom.com\/wp-content\/uploads\/2026\/08\/hancom-data-loader-key-features.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n<h3 class=\"wp-block-heading\"><strong>\ud83d\udcbb <\/strong><a href=\"https:\/\/sdk.hancom.com\/services\/1?type=DATA_LOADER\" target=\"_blank\" rel=\"noopener\"><strong>Hancom Data Loader<\/strong><\/a><\/h3>\n\n<p class=\"wp-block-paragraph\">Hancom Data Loader is a document parsing solution that converts HWP, HWPX, PDF, and OOXML into structured data. Based on DLA, OCR, and TSR, it extracts not only text but also structural information such as tables, hierarchies, and coordinates, and it supports on-premises environments that do not transmit data externally. <\/p>\n\n<p class=\"wp-block-paragraph\">In practice, in the <a href=\"https:\/\/biz.chosun.com\/it-science\/ict\/2025\/07\/28\/BRTM3WIVIFEHJM5ZZOUKXH2ROM\/\" target=\"_blank\" rel=\"noopener\">Gyeonggi-do Office of Education AI Digital Platform \uad6c\ucd95 project<\/a>, Hancom Data Loader converted AI-trainable data from about 2,800 school websites, around 40,000 guidance materials, and about 7,000 guideline\/legal datasets. Based on this data, HancomPedia is providing accurate QA to faculty and staff.<\/p>\n\n<p class=\"wp-block-paragraph\">What matters in building RAG is not simply choosing a model, but verifying that your company\u2019s documents are properly converted into data that AI can read.<\/p>\n\n<p class=\"wp-block-paragraph\">You can start with document preprocessing that agents can trust\u2014with Hancom Data Loader.<\/p>\n\n<p class=\"wp-block-paragraph\">\ud83d\udc49 <a href=\"https:\/\/sdk.hancom.com\/services\/1?type=DATA_LOADER\" target=\"_blank\" rel=\"noopener\">Explore Hancom Data Loader<\/a><\/p>\n\n<p class=\"wp-block-paragraph\">\ud83d\udc49 <a href=\"https:\/\/sdk.hancom.com\/contacts\/create\" target=\"_blank\" rel=\"noopener\">Inquire About Hancom Data Loader<\/a><\/p>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\"><strong>References<\/strong><\/h2>\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/arxiv.org\/abs\/2005.11401\" target=\"_blank\" rel=\"noopener\">arXiv<\/a>, \u201cRetrieval-Augmented Generation for Knowledge-Intensive NLP Tasks,\u201d 2020<\/li>\n\n\n\n<li><a href=\"https:\/\/www.ibm.com\/think\/topics\/retrieval-augmented-generation\" target=\"_blank\" rel=\"noopener\">IBM Think<\/a>, \u201cWhat is RAG (Retrieval Augmented Generation)?\u201d<\/li>\n\n\n\n<li><a href=\"https:\/\/docs.aws.amazon.com\/prescriptive-guidance\/latest\/retrieval-augmented-generation-options\/what-is-rag.html\" target=\"_blank\" rel=\"noopener\">AWS Prescriptive Guidance<\/a>, \u201cUnderstanding Retrieval Augmented Generation\u201d<\/li>\n\n\n\n<li><a href=\"https:\/\/docs.unstructured.io\/open-source\/core-functionality\/partitioning\" target=\"_blank\" rel=\"noopener\">Unstructured<\/a>, \u201cPartitioning\u201d<\/li>\n\n\n\n<li><a href=\"https:\/\/arxiv.org\/abs\/2507.09935\" target=\"_blank\" rel=\"noopener\">arXiv<\/a>, \u201cEnhancing Retrieval Augmented Generation with Hierarchical Text Segmentation Chunking\u201d, 2025<\/li>\n\n\n\n<li><a href=\"https:\/\/www.ibm.com\/think\/topics\/llamaindex-vs-langchain\" target=\"_blank\" rel=\"noopener\">IBM Think<\/a>, \u201cLlamaindex vs Langchain: What&#8217;s the difference?\u201d<\/li>\n\n\n\n<li><a href=\"https:\/\/arxiv.org\/abs\/2605.00318\" target=\"_blank\" rel=\"noopener\">arXiv<\/a>, \u201cStructure-Aware Chunking for Tabular Data in Retrieval-Augmented Generation\u201d, 2026<\/li>\n\n\n\n<li><a href=\"https:\/\/arxiv.org\/abs\/2401.12599\" target=\"_blank\" rel=\"noopener\">arXiv<\/a>, \u201cRevolutionizing Retrieval-Augmented Generation with Enhanced PDF Structure Recognition,\u201d 2024<\/li>\n\n\n\n<li><a href=\"https:\/\/arxiv.org\/abs\/2505.04847\" target=\"_blank\" rel=\"noopener\">arXiv<\/a>, \u201cBenchmarking LLM Faithfulness in RAG with Evolving Leaderboards\u201d, 2025<\/li>\n\n\n\n<li><a href=\"https:\/\/www.aitimes.com\/news\/articleView.html?idxno=158910\" target=\"_blank\" rel=\"noopener\">AI Times<\/a>, \u201cHancom launches \u2018Hancom Data Loader,\u2019 which extracts AI data from documents\u201d, 2024<\/li>\n\n\n\n<li><a href=\"https:\/\/www.cio.com\/article\/3519644\/%EB%AC%B8%EC%84%9C%EC%97%90%EC%84%9C-ai-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%B6%94%EC%B6%9C-%ED%95%9C%EA%B8%80%EA%B3%BC%EC%BB%B4%ED%93%A8%ED%84%B0-sdk-%ED%95%9C%EC%BB%B4-%EB%8D%B0%EC%9D%B4%ED%84%B0.html\" target=\"_blank\" rel=\"noopener\">CIO Korea<\/a>, \u201c\u2018Extracting AI data from documents\u2019\u2026 Hancom releases the Hancom Data Loader SDK globally\u201d, 2024<\/li>\n\n\n\n<li><a href=\"https:\/\/biz.chosun.com\/it-science\/ict\/2025\/07\/28\/BRTM3WIVIFEHJM5ZZOUKXH2ROM\/\" target=\"_blank\" rel=\"noopener\">ChosunBiz<\/a>, \u201cHancom participates in the Gyeonggi-do Office of Education AI Digital Platform project\u201d<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u201cThey\u2019re telling me to build a chatbot with internal documents, but I\u2019m not even sure what RAG is.\u201d \u201cThere are too many components\u2014where do I even start?\u201d Everyone faces challenges &#8230; <a title=\"Building your first RAG system? A step-by-step guide from document parsing to Q\" class=\"read-more\" href=\"https:\/\/blog.hancom.com\/en\/rag-system-build-document-parsing-guide\/\" aria-label=\"Read more about Building your first RAG system? A step-by-step guide from document parsing to Q\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":1527,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,10],"tags":[],"class_list":["post-1526","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ax-insight","category-10"],"_links":{"self":[{"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/posts\/1526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/comments?post=1526"}],"version-history":[{"count":1,"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/posts\/1526\/revisions"}],"predecessor-version":[{"id":1528,"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/posts\/1526\/revisions\/1528"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/media\/1527"}],"wp:attachment":[{"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/media?parent=1526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/categories?post=1526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hancom.com\/en\/wp-json\/wp\/v2\/tags?post=1526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}