<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kurian Kevin on Medium]]></title>
        <description><![CDATA[Stories by Kurian Kevin on Medium]]></description>
        <link>https://medium.com/@kuriankevin?source=rss-5fd13834ef5f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Xh0A5PEJ3pepyfV4ij49JQ.png</url>
            <title>Stories by Kurian Kevin on Medium</title>
            <link>https://medium.com/@kuriankevin?source=rss-5fd13834ef5f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 04:02:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kuriankevin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Gap Between an Ingestion Script and an Ingestion Pipeline Is Orchestration]]></title>
            <link>https://medium.com/@kuriankevin/the-gap-between-an-ingestion-script-and-an-ingestion-pipeline-is-orchestration-a860f31dc6f6?source=rss-5fd13834ef5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a860f31dc6f6</guid>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[data-ingestion]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Kurian Kevin]]></dc:creator>
            <pubDate>Tue, 15 Sep 2026 14:00:32 GMT</pubDate>
            <atom:updated>2026-09-15T14:00:32.942Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>A changed policy, a duplicate file, a failed PDF, and a sensitive record show what orchestration must add when ingestion runs again.</em></strong></p><blockquote><em>This article was written with the assistance of AI and edited by the author.</em></blockquote><figure><img alt="On the left, documents pass through isolated processing stages before the path ends beside a failed document. A glass bridge leads to the right, where the same stages connect to organised storage through a returning loop and a separate recovery branch." src="https://cdn-images-1.medium.com/max/1024/1*fSHevLZ1J_g96wq3GTHy3w.png" /><figcaption>A script runs the steps. Orchestration connects them to prior state, recovery, and the next run. AI-generated illustration.</figcaption></figure><p>An ingestion script can take a known set of documents through extraction, chunking, embeddings, and vector storage. It can prove that the stages work and show how ingestion decisions affect what retrieval finds.</p><p>For a controlled demonstration, that is enough to answer one useful question: <strong>Can we ingest these documents?</strong></p><p>The production problem begins with the next question: <strong>What happens when we run it again?</strong></p><h3>The second run changes the problem</h3><p>Imagine that an employee handbook has been ingested successfully. A week later, its source folder changes. Most documents are untouched. One leave policy has been updated. The benefits guide now appears in two folders. A scanned PDF fails during extraction. Another file contains personal information that should not become searchable.</p><p>Now the system must decide what to skip, replace, retry, divert as a duplicate, and stop or redact before storage. These are coordination questions, not extraction, chunking, or embedding questions.</p><p>This is the orchestration layer: it connects each run to prior state, recovery, quality checks, and storage. <a href="https://github.com/IBM/docling-pipelines">Docling Pipelines</a> provides one way to express that layer as a flow of dependent operators.</p><p>The <a href="https://github.com/kevin-kurian/blog-code/tree/main/medium/phase02-blog02">companion flow and setup instructions</a> use Docling Pipelines to make these ideas concrete.</p><h3>Repeatability belongs to the flow</h3><p>Executing the same script twice is not enough. A repeatable pipeline must apply the same decisions in the same order and know what the earlier run produced.</p><p>Extraction settings, chunking strategy, embedding model, and storage target should not live in someone’s memory or a sequence of copied terminal commands. They belong in the flow.</p><p>A declared flow makes its stages, configuration, and dependencies inspectable. If a configuration change requires every document to pass through the flow again, that decision should be explicit. When results change, the team can compare the flow rather than reconstructing an undocumented sequence of steps.</p><figure><img alt="Two parallel streams of documents follow identical illuminated paths through aligned glass processing chambers, producing matching stacks of organised pages." src="https://cdn-images-1.medium.com/max/1024/1*X8aZDqEM9q-HOtubklFjPw.png" /><figcaption>A declared flow keeps processing order and configuration consistent across runs. AI-generated illustration.</figcaption></figure><h3>History makes ingestion incremental</h3><p>On the first run, every document is new. Later runs must distinguish between documents that are new, changed, unchanged, removed, or previously failed.</p><p>A pipeline can track each document by its source identity and modification time. Unchanged documents can bypass work they have already completed, while new and changed documents re-enter the flow.</p><p>Missing documents need a separate deletion policy. Removing a source file and removing its searchable representation are different events, so the pipeline must connect them deliberately.</p><p>Consider a leave policy that changes in 2026. The pipeline should treat it as a new state of the same source, then retire the old searchable representation rather than leaving both versions eligible for retrieval.</p><p>Incremental ingestion is therefore more than a performance optimisation. It gives each document a defined route through the next run.</p><figure><img alt="Two glass archive towers represent consecutive runs. An unchanged document bypasses the central processing chamber, an updated document passes through it, a removed document dissolves before reaching the new archive, and a new document waits on an illuminated entry point." src="https://cdn-images-1.medium.com/max/1024/1*iVX59gWQUa3WoKdi5MeLqw.png" /><figcaption>History gives each document a different route through the next run: bypass, reprocess, remove, or wait. AI-generated illustration.</figcaption></figure><h3>Failure becomes a recorded state</h3><p>A demonstration usually follows the happy path. Real collections include damaged PDFs, unreadable scans, unavailable sources, and interrupted runs.</p><p>Restarting everything can repeat hours of work. Continuing from an unknown point is worse because no one knows which documents completed.</p><p>An orchestrated run records which documents were processed, skipped, or failed. After the cause of a failure is fixed, a later run can retry that document without repeating work on unchanged documents.</p><p>Recovery becomes a selective rerun rather than a blind restart.</p><figure><img alt="Completed document bundles remain untouched inside a circular glass archive. In the foreground, one repaired document with a golden seam follows an illuminated recovery path toward the archive’s only open compartment." src="https://cdn-images-1.medium.com/max/1024/1*WEs8_J0DQUkeDNBFULD-Dg.png" /><figcaption>A rerun preserves completed work and gives only the repaired document a path back into the pipeline. AI-generated illustration.</figcaption></figure><p>A recorded outcome also makes the run auditable: the team can see what was processed, skipped, or failed.</p><h3>Quality belongs before storage</h3><p>Quality checks lose leverage when they run after storage. A duplicate may already have produced many chunks and vectors. A name, phone number, or employee identifier may already exist in extracted text, overlapping chunks, and metadata.</p><p>Quality checks can include deduplication, PII and harmful-content detection, redaction, and filtering. A flow can place those checks before embeddings and vector storage, where they can still prevent unwanted representations from spreading.</p><p>The order matters as much as the operator. Quality is part of ingestion, not a cleanup task after it.</p><figure><img alt="Documents move through transparent quality gates on the way to an archive; a duplicate is diverted into a side tray, and a document enters an amber gate before the path continues to storage." src="https://cdn-images-1.medium.com/max/1024/1*yIuYS3OsAyl4vy54Qy90Qg.png" /><figcaption>Deduplication diverts repeated content, while sensitive-content checks can redact protected information before embedding and storage. AI-generated illustration.</figcaption></figure><h3>The flow is the orchestration contract</h3><p>A basic retrieval-augmented generation, or RAG, ingestion path can be described as:</p><p><strong>Document → structured content → chunks → embeddings → vector store</strong></p><p>A declared flow adds the execution rules. Each stage has a name, configuration, and dependencies. Together, those declarations can express <strong>ingest → extract → quality → chunk → embed → store</strong>, while the runtime resolves the graph and runs eligible work.</p><p>The value is not that a flow eliminates code. It makes the process inspectable: what may enter, what must finish first, what can be skipped, and what should be stopped.</p><figure><img alt="A continuous illuminated loop connects five glass stations where documents become structured pages, chunks, embedding points, and organised stored records." src="https://cdn-images-1.medium.com/max/1024/1*SwyaCEPj3gY6TTBuJD3lKQ.png" /><figcaption>The flow declares the stages and dependencies; orchestration decides what is eligible to run. AI-generated illustration.</figcaption></figure><p>At this point, we are no longer proving that one document can reach a vector store. We are managing how an evolving collection moves through ingestion over time.</p><h3>The gap appears beyond the happy path</h3><p>A script can prove that the ingestion steps work:</p><blockquote><em>“Can we ingest this document?”</em></blockquote><p>It can also be rerun. But repetition alone does not make the behaviour of the next run clear. A production ingestion flow must also answer:</p><blockquote><em>“What changed, what succeeded, what needs another attempt, and what should be removed?”</em></blockquote><p>The difference is not the number of functions, the size of the codebase, or simply whether it runs more than once. It is explicit flow, remembered state, selective recovery, and quality before storage.</p><p>Extraction still decides what survives. Chunking decides what travels together. Storage decides what remains searchable. Orchestration decides when those choices run, what can be reused, and how the next run differs from the last.</p><p><strong>The gap between an ingestion script and an ingestion pipeline is orchestration.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a860f31dc6f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Retrieval Quality Was Decided Before the User Ever Asked a Question]]></title>
            <link>https://medium.com/@kuriankevin/your-retrieval-quality-was-decided-before-the-user-ever-asked-a-question-8fddc18223c5?source=rss-5fd13834ef5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fddc18223c5</guid>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Kurian Kevin]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 18:28:06 GMT</pubDate>
            <atom:updated>2026-09-15T04:16:00.311Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>A scanned PDF, a misplaced chunk boundary, an embedding map, and an outdated vector record show how ingestion choices quietly reshape the evidence behind an answer.</em></strong></p><blockquote>This article was written with the assistance of AI and edited by the author.</blockquote><figure><img alt="Two parallel paths carry a document through extraction, chunking, embeddings, and vector storage. The tangled amber path and organized teal path produce different evidence for the same user question." src="https://cdn-images-1.medium.com/max/1024/1*yT2l9qe4dWTNfnyV7L5qHA.png" /><figcaption>Extraction, chunking, embeddings, and storage shape whether retrieval reaches confused or useful evidence. AI-generated illustration.</figcaption></figure><p>A retrieval-augmented generation, or RAG, interaction appears to begin when a user asks a question. The system searches, places a few passages in front of a language model, and produces an answer.</p><p>But retrieval can only search the representation created earlier, during ingestion.</p><p>Before the question arrived, the system had already decided:</p><ul><li>how to extract information from the source document;</li><li>how to divide that information into chunks;</li><li>how to represent those chunks as embeddings; and</li><li>how to identify, update, and store those chunks as vectors.</li></ul><p>Each decision can remove, separate, mis-rank, or preserve the evidence needed later.</p><p>To make that effect visible, we compare failing and passing approaches to extraction, chunking, and storage while keeping the question, Ollama models, similarity metric, and retrieval limit unchanged. Only one ingestion decision changes between the two paths. Embeddings are shown as an illustrative comparison because one convenient question is not enough to evaluate a model reliably.</p><p>The companion demonstration uses nomic-embed-text:v1.5 for embeddings, a small local language model for the answer, and an in-memory Qdrant vector store. The <a href="https://github.com/kevin-kurian/blog-code/tree/main/medium/phase02-blog01">code and setup instructions</a> remain separate so the article can stay focused on the decisions rather than becoming a tutorial.</p><h3>Decision one: extraction determines what survives the document</h3><p>Our first source is an image-only PDF containing this policy:</p><blockquote><strong><em>Leave carryover</em></strong><em><br>Employees may carry forward up to four unused leave days. Carried-over days must be used by 31 January of the following year.</em></blockquote><p>The page is readable to a person, but its words exist only as pixels. There is no digital text layer inside the PDF.</p><p>The question is:</p><blockquote><em>“How many unused leave days can employees carry, and when must they use them?”</em></blockquote><h4>Failing extraction</h4><p>The first path uses an extractor that reads only the PDF’s digital text layer. Because the document is a scan, it returns an empty string.</p><p>The file entered the ingestion process, but its policy did not become searchable. No embedding or vector-store setting can recover words that never left the page.</p><p>The evidence check fails:</p><pre>Retrieved evidence: [none]<br>Required facts: missing</pre><h4>Passing extraction</h4><p>The second path uses <a href="https://docling-project.github.io/docling/concepts/OCR/">Docling with OCR</a>. OCR recognises the pictured letters, and the extracted representation contains both required facts: <strong><em>four unused days</em></strong> and <strong><em>31 January</em></strong>.</p><p>The same question can now retrieve the policy because ingestion produced content that can be embedded and stored.</p><figure><img alt="A digital-text-only extractor finds no searchable evidence in a scanned PDF, while OCR-aware extraction recovers the complete leave rule." src="https://cdn-images-1.medium.com/max/1024/1*TFoVd0SHbkLT7XcSEbuTaw.png" /><figcaption>A scanned document becomes searchable only when OCR recovers the words stored as pixels. AI-generated illustration.</figcaption></figure><p>The difference is not the language model. It is not the vector database. It is the earlier decision to use an extraction method appropriate for the document.</p><p>Extraction establishes the first limit on retrieval: <strong>information that is not extracted cannot be retrieved.</strong></p><h3>Decision two: chunking determines what travels together</h3><p>For the second experiment, we start with correctly extracted text. The policy still contains the same two facts:</p><blockquote><em>Employees may carry forward up to four unused leave days. Carried-over days must be used by 31 January of the following year.</em></blockquote><p>The question asks for both the allowance and the deadline:</p><blockquote><em>“How many unused leave days can I carry, and when must I use them?”</em></blockquote><h4>Failing chunking</h4><p>The failing path divides the document into fixed groups of eight words with no overlap. One chunk contains the allowance:</p><blockquote><em>“carry forward up to four unused leave days.”</em></blockquote><p>Another contains the deadline. With a retrieval limit of one, only the strongest matching chunk reaches the language model.</p><p>The evidence is genuine, but incomplete. The system can answer how many days may be carried forward without having evidence for when they expire.</p><h4>Passing chunking</h4><p>The passing path converts the Markdown policy into a structured DoclingDocument and applies <a href="https://docling-project.github.io/docling/concepts/chunking/">Docling’s </a><a href="https://docling-project.github.io/docling/concepts/chunking/">HierarchicalChunker</a>. The chunker uses the document structure to keep the two policy sentences together and attaches the section heading as context.</p><p>The contextualized chunk sent for embedding now contains the heading and the complete answer:</p><blockquote><em>“Employees may carry forward up to four unused leave days. Carried-over days must be used by 31 January of the following year.”</em></blockquote><figure><img alt="Fixed-size chunks separate the allowance from its deadline, while a section-aware chunk preserves the complete rule and its section context." src="https://cdn-images-1.medium.com/max/1024/1*9J0fjREFcr2mOb-M8kY62w.png" /><figcaption>Section-aware chunking keeps the leave allowance, its deadline, and the section context together for retrieval. AI-generated illustration.</figcaption></figure><p>Again, the document and question are unchanged. The embedding model and vector store are unchanged. The difference was created by the chunk boundary.</p><p>Chunking establishes the second limit on retrieval: <strong>information can be present in the index and still arrive without the context required to answer.</strong></p><h3>Decision three: embeddings determine what appears similar</h3><p>Once a document has been divided into chunks, an embedding model converts each chunk into a <strong><em>vector: a list of numbers that represents its meaning</em></strong>. The user’s question is converted in the same way, allowing the system to search for passages whose vectors are nearby.</p><p>That map of meaning depends on the model. A poorly matched embedding model may focus on broad vocabulary and place a question about carrying leave close to a passage about booking a holiday. A better-suited model may recognise that the question is specifically about a leave-carryover policy and place the relevant passage closer.</p><figure><img alt="The same leave question enters two embedding models. A poorly matched model places it near a holiday-booking passage, while a better-suited model places it near the leave-carryover policy." src="https://cdn-images-1.medium.com/max/1024/1*FgDaKofKPHlSY9MPfTymzA.png" /><figcaption>Different embedding models can rank the same passages differently because each represents semantic similarity in its own way. AI-generated illustration.</figcaption></figure><p>The documents and question have not changed. What changed is the model’s representation of their similarity, which can change the order in which passages are retrieved.</p><p>Embeddings establish the third limit on retrieval: <strong>relevant evidence can be present and well-formed but still rank below a weaker semantic match.</strong></p><h3>Decision four: vector storage determines which version remains searchable</h3><p>The final controlled experiment begins with a policy change.</p><p>The previous version said:</p><blockquote><strong><em>2025:</em></strong><em> Employees may carry forward five unused leave days and use them until 31 March.</em></blockquote><p>The current version says:</p><blockquote><strong><em>2026:</em></strong><em> Employees may carry forward up to four unused leave days and use them by 31 January.</em></blockquote><p>The user asks:</p><blockquote><em>“May employees carry five unused leave days until 31 March?”</em></blockquote><p>The wording closely resembles the old policy. A useful system should still retrieve the current rule so the answer can correct the outdated assumption.</p><h4>Failing storage</h4><p>The failing path assigns a new record ID every time the document is ingested. When the policy changes, the current vectors are added without replacing the previous vectors.</p><p>Both versions remain searchable. Because the question uses the old wording, the stale passage can be the closest match and become the evidence supplied to the language model.</p><p>Nothing is wrong with the source document, extraction, chunking, or embedding model. The problem is that ingestion never told the store that the new record replaces the old one.</p><h4>Passing storage</h4><p>The passing path creates a stable ID from the document and section identity. Re-ingesting the updated section performs an upsert using the same ID, replacing the old vector and payload.</p><p>The same search now has only the current policy available. It retrieves four days and 31 January.</p><figure><img alt="Append-only ingestion leaves an outdated policy searchable, while a stable identifier lets the current version replace it." src="https://cdn-images-1.medium.com/max/1024/1*tnqusBWm5rrc_u3pjJMAww.png" /><figcaption>Stable record identifiers let an updated policy replace its outdated version instead of leaving both searchable. AI-generated illustration.</figcaption></figure><p>This is not primarily a choice between vector-database brands. It is a choice about record identity and update behaviour.</p><p>Vector storage establishes the fourth limit on retrieval: <strong>correct evidence can be stored while stale evidence remains eligible to win.</strong></p><h3>The generated answer cannot tell you which stage failed</h3><p>These four failure modes occur at different places:</p><ol><li>Extraction produced no searchable text.</li><li>Chunking separated two facts that belonged together.</li><li>Embeddings can rank a weaker semantic match above the relevant passage.</li><li>Storage left an outdated version in the searchable collection.</li></ol><p>From the chat interface, they may look similar. The answer is missing a deadline, draws from a loosely related passage, cites an old policy, or confidently states something unsupported.</p><p>The final answer alone does not identify the responsible stage. A fluent response can even hide the failure by filling the missing space with a plausible guess.</p><p>That is why the demonstration checks the retrieved evidence separately from the generated answer. For each runnable failing and passing path, it displays:</p><ul><li>the passage returned by the vector search;</li><li>the record or extraction path it came from;</li><li>its similarity score;</li><li>whether the required facts are present; and</li><li>the answer generated from that evidence.</li></ul><p>The generated answer tells us what the user experienced. The intermediate evidence tells us where to investigate.</p><h3>Retrieval begins during ingestion</h3><p>Query-time retrieval still matters. Filters decide which records are eligible, similarity search finds candidates, and reranking can improve their order.</p><p>But those steps cannot OCR a page that produced no text, reconnect facts that were split into separate chunks, reliably recover a relevant passage pushed outside the candidate set by its embedding, or distinguish a current policy from an old one when ingestion preserved no stable identity.</p><p><strong>Retrieval can only choose from what ingestion made retrievable.</strong></p><p>Whether the implementation is a small demonstration or a production system, the lesson is the same: retrieval quality cannot be repaired only at query time. It must be designed, tested, and observed during ingestion.</p><p><strong>By the time a user asks a question, retrieval is already working within the limits ingestion created.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fddc18223c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Retrieval: How a Question Finds the Right Passage]]></title>
            <link>https://medium.com/@kuriankevin/retrieval-how-a-question-finds-the-right-passage-14bf4726064c?source=rss-5fd13834ef5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/14bf4726064c</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Kurian Kevin]]></dc:creator>
            <pubDate>Sun, 13 Sep 2026 05:19:27 GMT</pubDate>
            <atom:updated>2026-09-13T05:19:27.372Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>A beginner’s guide to how retrieval filters, ranks, and selects the passages that give a language model useful evidence for an answer.</em></strong></p><blockquote>This article was written with the assistance of AI and edited by the author.</blockquote><figure><img alt="A question moves through a filter, vector search, and ranking cards before two source-linked passages reach an AI assistant." src="https://cdn-images-1.medium.com/max/1024/1*D5mefTfUyqKxliaucAq1fQ.png" /><figcaption>Retrieval turns a question into a small set of source-linked passages that a language model can use. AI-Illustration</figcaption></figure><p>In the previous article, we stored the chunks from our fictional employee handbook alongside their embeddings and source information. A vector index made it possible to search those records efficiently.</p><p>Now an employee asks:</p><blockquote>“I am on probation. Can I carry my unused leave into next year?”</blockquote><p>The handbook contains a general carryover rule, an exception for employees on probation, and older versions of both policies. Several passages may look related to the question, but not all of them should be used in the answer.</p><p>The system must decide which passages are merely similar and which ones provide the right evidence. That process is called <strong>retrieval</strong>.</p><p>Retrieval is the part of a RAG system that finds possible matches, removes inapplicable results, and selects the passages that should be placed in front of the language model.</p><h3>Search produces candidates</h3><p>The first step is similar to what we saw in the vector-store article. The question is converted into an embedding, and the vector store finds chunk vectors that are nearby.</p><p>Those matches are best treated as <strong>candidates</strong>, not final answers.</p><p>For the question about probation, the candidate set might include:</p><ul><li>the general leave carryover rule;</li><li>the probation exception;</li><li>an expired version of the leave policy; and</li><li>a passage about taking leave during probation.</li></ul><p>All four passages discuss similar subjects. Only some of them help answer the employee’s exact question.</p><figure><img alt="An employee’s question is connected to four policy cards. The general rule and probation exception are highlighted, while an expired policy and a loosely related passage are faded." src="https://cdn-images-1.medium.com/max/1024/1*8JpXpv0zqyJCosKnTl6iBQ.png" /><figcaption>Search produces several related candidates, but only some contain current, applicable evidence. AI-Illustration</figcaption></figure><h3>Similarity is not the same as relevance</h3><p>Vector similarity answers a useful question:</p><blockquote>“Which passages have meaning similar to this question?”</blockquote><p>It does not automatically answer:</p><blockquote>“Which passages contain the complete and applicable evidence?”</blockquote><p>The general rule may be very similar to the employee’s wording:</p><blockquote>Employees may carry forward up to four unused leave days.</blockquote><p>But the handbook also contains a more specific rule:</p><blockquote>Employees on probation may not carry leave forward.</blockquote><p>If the system retrieves only the general rule, the language model may give an answer that is supported by a real passage but still wrong for this employee.</p><p>Good retrieval therefore considers more than closeness between vectors.</p><h3>Filters remove results that should not compete</h3><p>Metadata can narrow the search before passages are selected. For this employee, the application might search only records where:</p><ul><li>the office is <strong>India</strong>;</li><li>the version status is <strong>current</strong>;</li><li>the document type is <strong>employee handbook</strong>; and</li><li>the document’s access rules allow the employee to view it.</li></ul><p>These filters remove outdated, inaccessible, or unrelated records even when their wording is similar to the question.</p><p>Filtering does not decide which remaining passage answers the question best. It defines which records are eligible to compete.</p><h3>Different kinds of search notice different clues</h3><p>Embeddings are useful when the wording differs. They can connect “<em>unused leave</em>” with “<em>remaining vacation day</em>s” and “<em>carry forward</em>” with “r<em>oll over.</em>” This is often called <strong>semantic search</strong> because it searches by meaning.</p><p>Exact words still matter. A policy number, product code, person’s name, or error message may be easier to find with keyword search than with an embedding.</p><p>Many retrieval systems therefore combine semantic and keyword search. This is called <strong>hybrid search</strong>. One method finds passages with related meaning, while the other protects exact clues that should not be lost.</p><p>Not every RAG system needs hybrid search. The useful approach depends on the questions people ask and the documents being searched.</p><h3>Reranking takes a closer look</h3><p>An initial search is designed to find a manageable set of promising candidates. A second step can then compare those candidates with the complete question more carefully.</p><p>This step is called <strong>reranking</strong>. A reranker takes the initial results and places the most useful ones first.</p><p>For our example, it should recognise that the probation exception is more important than the general carryover rule because the employee explicitly said, “<em>I am on probation.</em>” The general rule may still be useful as background, but it should not hide the exception.</p><p>Reranking does not create new evidence. It improves the order of the evidence already found.</p><figure><img alt="Four policy cards pass through reranking. The probation exception rises to the top, followed by the general rule, while the loosely related and expired policies move lower and fade." src="https://cdn-images-1.medium.com/max/1024/1*zhnV9-sDbTMTJuRxwrdepQ.png" /><figcaption>Reranking moves the passage that addresses the employee’s probation status above more general or weaker matches. AI-Illustration</figcaption></figure><h3>The application selects the context</h3><p>After filtering and ranking, the application chooses which passages to send to the language model. These selected passages become the <strong>retrieved context</strong>.</p><p>Returning too few passages can omit an exception, condition, or deadline. Returning too many can surround the answer with repeated or unrelated text. The goal is not to fill the context window. It is to provide the smallest set of passages that contains enough evidence to answer well.</p><p>For this question, the retrieved context should include the probation exception and may also include the general rule it overrides. Each passage should remain connected to its document, section, page, and version so the final answer can point back to its source.</p><p>Sometimes no candidate is relevant enough. In that case, the system should not force a weak match into the context. An assistant that says it could not find supporting information is safer than one that answers from unrelated evidence.</p><h3>Retrieval connects the question to the evidence</h3><p>The preparation side of the pipeline now looks like this:</p><p><strong>Document → structured content → chunks → embeddings → vector store</strong></p><p>When a question arrives, the path continues:</p><p><strong>Question → filters and search → candidates → reranking and selection → retrieved context</strong></p><p>The language model can then use that context to write an answer grounded in the handbook:</p><blockquote>“No. Employees on probation may not carry unused leave forward, according to the current probation policy in the employee handbook.”</blockquote><p>Retrieval does not guarantee a correct answer, but it gives the model relevant evidence to work from instead of leaving it to guess.</p><p>Across this series, we have followed information from the original document through extraction, chunking, embeddings, storage, and retrieval. The result is a path from a user’s question back to the passages that can support its answer.</p><p><strong>Previous:</strong> <a href="https://medium.com/@kuriankevin.dev/vector-store-how-similarity-becomes-something-you-can-actually-search-37462b643553">Vector Store: How Similarity Becomes Something You Can Actually Search</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14bf4726064c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vector Store: How Similarity Becomes Something You Can Actually Search]]></title>
            <link>https://medium.com/@kuriankevin/vector-store-how-similarity-becomes-something-you-can-actually-search-37462b643553?source=rss-5fd13834ef5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/37462b643553</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Kurian Kevin]]></dc:creator>
            <pubDate>Sun, 13 Sep 2026 04:11:23 GMT</pubDate>
            <atom:updated>2026-09-13T04:11:23.800Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>A beginner’s guide to how vector stores make embeddings searchable while preserving their connection to the passages and source documents they represent.</em></strong></p><blockquote>This article was written with the assistance of AI and edited by the author.</blockquote><figure><img alt="An abstract field of blue vector clusters on a warm background. An amber point follows a curved path from the left toward a teal cluster near the centre, where the closest matching points glow more brightly." src="https://cdn-images-1.medium.com/max/1024/1*EjIbxwptZ92jMO7yIwoz5g.png" /><figcaption>A search moves through a field of stored vectors and finds the closest group of related information. AI-Illustration</figcaption></figure><p>In the previous article, we created an embedding for every chunk in our fictional employee handbook. We can also create an embedding for each question and compare it with those chunk embeddings.</p><p>As more handbooks, support articles, and internal guides are added, the number of vectors grows. We need somewhere to keep them, a way to search them, and a reliable connection back to the passages they represent.</p><p>That is the role of a <strong>vector store</strong>: it manages records built around embeddings and makes those records searchable by similarity.</p><h3>A useful record contains more than a vector</h3><p>A vector is only a list of numbers. Finding a similar vector helps only when the application can recover the passage behind it.</p><p>A record in a vector store usually contains or connects these pieces:</p><ul><li><strong>Vector:</strong> The embedding used for similarity search.</li><li><strong>Passage:</strong> The original chunk, or a reference that can be used to retrieve it.</li><li><strong>Metadata:</strong> Details such as the document title, section, page, office, language, and version.</li><li><strong>Identifier:</strong> A unique value used to find or update this particular record.</li></ul><p>For our leave policy, one record might contain this passage:</p><blockquote>Employees may carry forward up to four unused leave days. Carried-over days must be used by 31 January of the following year.</blockquote><p>Its metadata might identify the source as <strong>Employee handbook</strong>, the section as <strong>Leave carryover</strong>, the office as <strong>India</strong>, and the version as <strong>2026</strong>.</p><figure><img alt="A single vector-store record labelled policy-042. Its passage says employees may carry forward up to four unused leave days. It also contains a decimal embedding and metadata for the Employee handbook, Leave carryover section, India office, and 2026 version." src="https://cdn-images-1.medium.com/max/1024/1*kqrEg8AgJ3pRsfbU3qqzKA.png" /><figcaption>A useful stored record keeps the passage, its embedding, and its source information connected. AI-Illustration</figcaption></figure><p>Some vector stores keep the passage inside the record. Others keep a reference that points to the passage somewhere else. In either case, the connection must remain intact so a numerical match can lead back to readable information.</p><h3>What happens when a question arrives?</h3><p>Return to the employee’s question:</p><blockquote>“Do my remaining vacation days roll over?”</blockquote><p>The search now follows a clear sequence:</p><ol><li>The application sends the question to the same embedding model used for the handbook chunks.</li><li>The embedding model returns a vector for the question.</li><li>The vector store searches for chunk vectors that are close to the question vector.</li><li>The store returns the best-matching records, including their passages and source details.</li></ol><p>One of those records can lead back to the leave policy:</p><blockquote>Employees may carry forward up to four unused leave days. Carried-over days must be used by 31 January of the following year.</blockquote><p>The embedding model creates the vectors. The vector store organises and searches them. The language model can then use the returned passage to answer the question.</p><h3>The store holds records; the index helps find them</h3><p>With a small collection, software can compare the question vector with every stored vector. As the collection grows, checking every record for every question requires more work.</p><p>A <strong>vector index</strong> organises the vectors so the search can move towards promising candidates instead of treating every record in the same way. The nearby candidates it finds are often called <strong>nearest neighbours</strong>.</p><figure><img alt="An amber question vector sits inside a circular neighbourhood containing three nearby teal vectors. Short lines show their distance from the question vector, while many farther vectors remain pale grey outside the neighbourhood." src="https://cdn-images-1.medium.com/max/1024/1*UHD283WDfYb1Y0OypejXGA.png" /><figcaption>The vectors closest to the question vector become its nearest neighbours and the strongest candidates for the search. AI-Illustration</figcaption></figure><p>The distinction is straightforward: the <strong>store</strong> manages the records, while the <strong>index</strong> organises their vectors for efficient search. A vector database typically combines both functions.</p><h3>Metadata helps choose the applicable policy</h3><p>A collection may contain several versions of the employee handbook or separate policies for different offices. Their leave sections may discuss the same subject while applying to different people.</p><p>Vector similarity helps answer, “<em>Which passages discuss something like this?</em>” Metadata helps answer, “<em>Which of those passages applies here?</em>”</p><p>For an employee in India, the application might limit the search to records where:</p><ul><li>the office is <strong>India</strong>;</li><li>the version status is <strong>current</strong>;</li><li>the document type is <strong>employee handbook</strong>; and</li><li>the employee has permission to access the document.</li></ul><figure><img alt="Filters at the top specify Office India and Version Current. Below them, the current India leave policy is highlighted with a check mark, while the previous India policy and current UK policy remain unselected." src="https://cdn-images-1.medium.com/max/1024/1*YJ6duSGcTu1VllPSqXampw.png" /><figcaption>Metadata narrows the search to records for the correct office and the current policy version. AI-Illustration</figcaption></figure><p>Most of these labels are attached while the documents and chunks are prepared, then stored with each record. When a question arrives, the application combines that metadata with the employee’s permissions to decide which records are eligible for the search. This allows similarity search and <strong>explicit</strong> business rules to work together.</p><h3>A vector store keeps the path back to the source</h3><p>A vector store is more than a collection of numbers. It keeps embeddings searchable and preserves the path from each embedding to the passage and source it represents.</p><p>The pipeline so far now looks like this:</p><p><strong>Document → structured content → chunks → embeddings → vector store</strong></p><p>When a question arrives, the vector store can return one or more focused passages instead of disconnected numerical matches. The language model then receives the information it needs in a readable form.</p><p>We have seen how vector stores organise embeddings and return candidate passages. But finding nearby vectors is only one part of deciding what information should reach the language model. The next article explores <strong>retrieval</strong>: how a system filters, ranks, and selects the best evidence for a question.</p><p><strong>Previous: </strong><a href="https://medium.com/@kuriankevin.dev/embeddings-the-hidden-numbers-that-help-ai-find-relevant-data-68a27ab31b7d?postPublishedType=repub">Embeddings: The Hidden Numbers That Help AI Find Relevant Data</a></p><p><strong>Next: </strong><a href="https://medium.com/@kuriankevin.dev/retrieval-how-a-question-finds-the-right-passage-14bf4726064c">Retrieval: How a Question Finds the Right Passage</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37462b643553" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embeddings: The Hidden Numbers That Help AI Find Relevant Data]]></title>
            <link>https://medium.com/@kuriankevin/embeddings-the-hidden-numbers-that-help-ai-find-relevant-data-68a27ab31b7d?source=rss-5fd13834ef5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/68a27ab31b7d</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Kurian Kevin]]></dc:creator>
            <pubDate>Sat, 12 Sep 2026 03:51:26 GMT</pubDate>
            <atom:updated>2026-09-12T07:21:05.819Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>A beginner’s guide to how embeddings capture meaning, allowing questions to be matched with relevant passages even when the wording differs.</em></strong></p><blockquote>This article was written with the assistance of AI and edited by the author.</blockquote><figure><img alt="A question and a differently worded policy passage pass through the same embedding process and become nearby groups of points. An unrelated group appears farther away." src="https://cdn-images-1.medium.com/max/1024/1*LQAk5qg8YleC8IYZ4ILbuQ.png" /><figcaption>Embeddings help software recognise related meaning even when a question and a document use different words. AI-Illustration</figcaption></figure><p>In the previous articles, we extracted content from a company handbook and divided it into focused chunks. Those chunks keep related facts together and remain connected to their source.</p><p>But the person asking a question may use very different words from the document that contains the answer.</p><p>Consider this rule from our fictional handbook:</p><blockquote>Employees may carry forward up to four unused leave days. Carried-over days must be used by 31 January of the following year.</blockquote><p>An employee might ask:</p><blockquote>“Do my remaining vacation days roll over?”</blockquote><p>We can see the connection. “<em>Vacation days</em>” refers to leave, and “<em>roll over</em>” refers to carrying it forward. A simple keyword search may struggle because the question and the policy share few exact words.</p><p>An <strong>embedding</strong> gives software a way to compare their meaning instead.</p><h3>From text to numbers</h3><p>A text embedding is an ordered list of numbers created by an <strong>embedding model</strong>. A shortened, made-up example might look like this:</p><blockquote>`[0.12, -0.34, 0.81, 0.06, …]`</blockquote><p>This list of numbers is called a <strong>vector</strong>. Each position in the vector is called a <strong>dimension</strong>. A real embedding may contain hundreds or thousands of dimensions, depending on the model.</p><figure><img alt="The question “Do my remaining vacation days roll over?” enters an embedding model. The output is the vector 0.12, negative 0.34, 0.81, 0.06, followed by an ellipsis." src="https://cdn-images-1.medium.com/max/1024/1*HkTgCeiHg9Vb2N8KcOtb1A.png" /><figcaption>An embedding model converts a piece of text into a vector: an ordered list of numbers that software can compare. AI-Illustration</figcaption></figure><p>The values are not word counts, and individual dimensions do not usually have simple labels such as “<em>leave</em>”, “<em>deadline</em>”, or “<em>employee</em>”. The meaning is spread across the full vector.</p><p>You do not need to understand each number separately. What matters is how the complete vector compares with the vector created for another piece of text.</p><h3>The numbers capture patterns in context</h3><p>An embedding model has been trained to recognise patterns in language. When it receives a sentence or passage, it uses those learned patterns to create the vector.</p><p>The model considers how words are used together. For example, “<em>I need to take leave</em>” and “<em>I need to leave the building</em>” contain the same word but mean different things. At the same time, “<em>unused leave</em>” and “<em>remaining vacation days</em>” can express related ideas even though they use different words.</p><p>Creating an embedding for the company handbook does not retrain the model or permanently teach it the policy. It creates a numerical representation of the text supplied at that moment.</p><p>For a particular embedding model and configuration, a short question and a longer passage become vectors with the same number of dimensions. That consistent format allows software to compare texts of different lengths.</p><h3>Similar meaning produces nearby vectors</h3><p>Imagine a map where every point represents a piece of text. Texts with related meanings tend to appear near each other, while unrelated texts tend to appear farther apart.</p><p>On this imaginary map, the question about vacation days rolling over should be near the passage about carrying leave forward. A passage about office parking should be farther away.</p><figure><img alt="A simplified embedding map. Three sentences about vacation days, unused leave, and carrying leave forward are grouped together on the left. A sentence about staff parking appears separately on the right." src="https://cdn-images-1.medium.com/max/1024/1*yXxvqn8FObD2vMNCyaE9_w.png" /><figcaption>Related questions and passages appear close together in this simplified embedding space, while unrelated text appears farther away. AI-Illustration</figcaption></figure><p>The map is only a visual analogy. Real embeddings have far more dimensions than we can draw on a page. Software uses a mathematical similarity calculation to compare the vectors and produce a score.</p><p>That score can be used to rank the chunks. A chunk whose vector is more similar to the question’s vector can be placed above less similar chunks.</p><h3>Embeddings are created at two different times</h3><p>The same embedding process is normally used in two places:</p><ol><li><strong>When the documents are prepared:</strong> The system creates an embedding for every chunk and saves it for later.</li><li><strong>When a person asks a question:</strong> The system creates an embedding for the question and compares it with the saved chunk embeddings.</li></ol><p>The question and chunk embeddings need to be compatible. They are normally created with the same embedding model and configuration so their numbers belong to the same comparison space.</p><p>In our example, the similarity between “<em>vacation days roll over</em>” and “<em>carry forward unused leave</em>” should help the correct handbook passage rank above unrelated sections.</p><p>The embedding does not contain a ready-made answer. The original passage must remain connected to its vector because that passage contains the exact four-day allowance and January deadline.</p><p><strong>The embedding helps locate the text; the text supplies the evidence.</strong></p><p>We have seen how embeddings turn text into numbers that capture meaning. But those numbers still need to be stored and searched efficiently. The next article explores <strong>vector stores</strong>, which organise embeddings and help find the closest matches.</p><p><strong>Previous: </strong><a href="https://medium.com/@kuriankevin.dev/chunking-how-to-split-a-document-without-losing-its-meaning-f5fe6e16e6fb">Chunking: How to Split a Document Without Losing Its Meaning</a></p><p><strong>Next: </strong><a href="https://medium.com/@kuriankevin.dev/vector-store-how-similarity-becomes-something-you-can-actually-query-37462b643553">Vector Store: How Similarity Becomes Something You Can Actually Query</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68a27ab31b7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chunking: How to Split a Document Without Losing Its Meaning]]></title>
            <link>https://medium.com/@kuriankevin/chunking-how-to-split-a-document-without-losing-its-meaning-f5fe6e16e6fb?source=rss-5fd13834ef5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5fe6e16e6fb</guid>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[artificalintelligence]]></category>
            <category><![CDATA[unstructured-data]]></category>
            <dc:creator><![CDATA[Kurian Kevin]]></dc:creator>
            <pubDate>Sat, 12 Sep 2026 03:51:02 GMT</pubDate>
            <atom:updated>2026-09-12T06:56:14.781Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>A beginner’s guide to how chunk size and boundaries shape retrieval and how keeping related information together leads to more reliable answers.</em></strong></p><blockquote>This article was written with the assistance of AI and edited by the author.</blockquote><figure><img alt="A long structured document divided into several smaller passage cards, with headings and related lines kept together." src="https://cdn-images-1.medium.com/max/1024/1*kfrUEOjmBiBUZ8TysBRLaw.png" /><figcaption>Chunking divides a long document into focused passages while keeping related information together. AI-Illustration</figcaption></figure><p>In the previous article, we turned a company handbook into structured content. Its words, headings, tables, and reading order are now clear to the software.</p><p>But the handbook is still one large document. It may contain leave policies, expenses, benefits, and office rules, while a question about unused leave needs only one small section.</p><p>RAG systems divide documents into smaller passages called <strong>chunks</strong>. A chunk might contain one paragraph, several related paragraphs, a list, or a short section. Creating those passages is called <strong>chunking</strong>.</p><p>The idea is simple. The difficult part is deciding where one chunk ends and the next begins.</p><h3>Why split the document at all?</h3><p>If the entire handbook is treated as one searchable item, a match for “<em>unused leave</em>” returns the whole handbook. The relevant rule arrives surrounded by unrelated material.</p><p>Chunking gives the system smaller, more focused passages to compare with the question. It can return the leave rule without also returning the sections about expenses, insurance, and office access.</p><p>There is also a limit to how much text a language model can receive at once. This limit is called its <strong>context window</strong>. Even when a whole document fits, filling the available space with unrelated sections leaves less room for the question, instructions, conversation, and answer.</p><p>The goal is not to make every chunk as small as possible. It is to make each chunk focused enough to find, and complete enough to understand.</p><h3>A useful chunk keeps the answer together</h3><p>Consider this section from our fictional handbook:</p><blockquote><strong>Leave carryover</strong><br>Employees may carry forward up to four unused leave days. Carried-over days must be used by 31 January of the following year.</blockquote><p>Now ask:</p><blockquote>“How much leave can I carry into next year, and when must I use it?”</blockquote><p>Both sentences are needed. The first gives the allowance, and the second gives the deadline.</p><p>If a chunk ends after “<em>four unused leave days</em>”, the allowance and deadline become separate passages. Nothing has disappeared from the document, but finding the first passage no longer brings the complete rule with it.</p><figure><img alt="A side-by-side comparison. The poor split places the four-day leave allowance and the 31 January deadline in separate cards. The better split keeps the heading and both sentences in one card." src="https://cdn-images-1.medium.com/max/1024/1*G5N-hLWmgzrMT0aXQGtWWw.png" /><figcaption>A useful boundary keeps facts that answer the same question in the same chunk. AI-Illustration</figcaption></figure><p>The system could retrieve both passages, but it might retrieve only one. Keeping the sentences together makes it more likely that the complete answer arrives as one clear piece of context.</p><p>This is the central question in chunking: <strong>which pieces of information need to travel together?</strong></p><h3>Size sets a limit; structure suggests where to cut</h3><p>One simple approach is to split text after a fixed number of characters or <strong>tokens</strong>. Tokens are the small units of text that can be processed by a model. A token can be part of a word, a whole word, or several words.</p><p>A size limit keeps chunks manageable, but the number alone does not tell us where an idea ends. A mechanical cut can fall between:</p><ul><li>a heading and the paragraph below it;</li><li>a rule and its exception;</li><li>a numbered step and its explanation; or</li><li>a table header and the values it describes.</li></ul><p>Document structure gives us better clues. Headings introduce subjects, paragraphs develop ideas, and lists group related points. <strong>Structure-aware chunking</strong> uses those clues to choose sensible boundaries while still respecting a size limit.</p><p>For our handbook, the carryover allowance and January deadline form one natural unit. A long chapter may still need to be split, but each heading should remain with the text it introduces.</p><p>Size still matters. Very small chunks can separate a fact from the explanation that gives it meaning. Very large chunks preserve more context but can mix unrelated topics, making it harder to return a focused result.</p><p>There is no single chunk size that works for every document. A policy rule, a troubleshooting guide, and a research paper may each need a different amount of surrounding text.</p><h3>Overlap protects context near a boundary</h3><p>Some sections are too long to keep in one chunk. When a split is necessary, <strong>overlap</strong> can repeat a small amount of text at the end of one chunk and the beginning of the next.</p><p>Suppose a section contains these three sentences:</p><blockquote>Employees may carry forward up to four unused leave days. Carried-over days must be used by 31 January of the following year. Unused carried-over leave expires after that date.</blockquote><p>If the second chunk begins with “<em>Unused carried-over leave expires after that date</em>”, the phrase “<em>that date</em>” has lost the sentence that explains which date it means.</p><p>Repeating the deadline sentence in both chunks gives the second passage the context it needs:</p><figure><img alt="Two neighbouring passage cards. Both contain the sentence stating that carried-over days must be used by 31 January. The repeated sentence is highlighted in amber." src="https://cdn-images-1.medium.com/max/1024/1*33n5Wic-d3pAws9PswEBTw.png" /><figcaption>Overlap repeats a small amount of context across a boundary so the next chunk does not begin with an unexplained reference. AI-Illustration</figcaption></figure><p>Overlap is useful, but it has a cost. Repeated text creates more content to process, store, and search. Too much overlap can also return several nearly identical results instead of a varied set of useful passages.</p><p>Overlap cannot repair every poor boundary. It works best as a safety net alongside sensible, structure-aware splitting.</p><h3>A chunk needs clues from its source</h3><p>“<em>Carryover is not permitted</em>” is readable on its own, but its meaning changes depending on the heading above it. Under <strong>Employees on probation</strong>, it describes an exception. Without that heading, it looks like the general rule.</p><p>A chunk may therefore need to carry additional context such as:</p><ul><li>the document title;</li><li>the headings above the passage;</li><li>table headers or picture captions;</li><li>the source page; and</li><li>a document or version identifier.</li></ul><p>Some of this information helps the passage make sense. Some helps the system filter results, update changed content, or show where an answer came from.</p><p>This is where careful document extraction begins to pay off. If extraction preserved the document’s headings and other relationships, the chunker can use them.</p><p>We have seen how chunking turns long documents into focused passages without losing context. But the system still needs a way to compare those passages with a user’s question. The next article explores <strong>embeddings</strong>, which represent text as numbers so it can be searched by meaning.</p><p><strong>Previous: </strong><a href="https://medium.com/@kuriankevin.dev/extraction-what-your-ai-actually-reads-inside-a-document-7143ce3f0ff3">Extraction: What Your AI Actually Sees When it Opens a Document</a></p><p><strong>Next: </strong><a href="https://medium.com/@kuriankevin.dev/embeddings-the-hidden-numbers-that-help-ai-find-relevant-data-68a27ab31b7d">Embeddings: The Hidden Numbers That Help AI Find Relevant Data</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5fe6e16e6fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extraction: What Your AI Actually Sees When it Opens a Document]]></title>
            <link>https://medium.com/@kuriankevin/extraction-what-your-ai-actually-reads-inside-a-document-7143ce3f0ff3?source=rss-5fd13834ef5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7143ce3f0ff3</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Kurian Kevin]]></dc:creator>
            <pubDate>Thu, 10 Sep 2026 19:05:43 GMT</pubDate>
            <atom:updated>2026-09-12T06:45:38.804Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>A beginner’s guide to how document extraction turns human-readable documents into structured, searchable content for AI systems.</em></strong></p><blockquote>This article was written with the assistance of AI and edited by the author.</blockquote><figure><img alt="A complex page containing columns, a picture, and a table passes through a parser and emerges as separate, ordered content blocks." src="https://cdn-images-1.medium.com/max/1024/1*02O2YxDYOp81xgTyYzJUTQ.png" /><figcaption>Document extraction turns a page into content software can use while preserving how its parts belong together. AI-Illustration</figcaption></figure><p>In the previous article, we gave an AI assistant access to a company handbook so it could look up a leave policy. But opening a file is not the same as understanding the information inside it.</p><p>A PDF is not automatically a clean block of text. It may contain paragraphs, columns, tables, scanned pages, headers, footnotes, and pictures. Some of its words may be stored as digital text. Others may exist only as pixels in an image.</p><p>Before a RAG system can search that content, software has to answer two questions:</p><ol><li>What words and other elements are on the page?</li><li>How do those elements fit together?</li></ol><p>Turning a document into content that other systems can use is called <strong>document extraction</strong> or <strong>document parsing</strong>.</p><p>If extraction misses words or mixes up their order, the result may no longer mean the same thing as the original document.</p><h3>First, can the software access the words?</h3><p>A document’s appearance does not tell us how its words are stored.</p><p>A PDF exported from Word will often contain <strong>digital text</strong>. Software can access the characters directly, much like you can select and copy a sentence with your cursor.</p><p>A scanned PDF is different. It may contain only a photograph of each page, with no selectable words behind it. To software, the letters are simply part of the image.</p><p>Reading those letters requires <strong>optical character recognition (OCR)</strong>. OCR examines the pixels and identifies the letters and numbers they represent.</p><figure><img alt="Side-by-side scene showing an AI assistant selecting text directly from a digital PDF and using OCR to recognise text from a scanned paper page." src="https://cdn-images-1.medium.com/max/1024/1*YMbIR8mUnpCfxuQJ6oqjhA.png" /><figcaption>Digital text can be accessed directly; a scanned page needs OCR to turn pictured letters into text that software can use. AI-Illustration</figcaption></figure><p>Real files do not always fit neatly into one category. A single PDF can combine exported pages, scanned forms, and pictures containing printed labels.</p><p>A reliable parser therefore needs to examine the document it receives instead of assuming that every PDF stores its words in the same way.</p><h3>Finding the words is only the first step</h3><p>OCR can answer, “<em>Which characters appear here?</em>” It cannot, by itself, explain how every item on the page is related.</p><p>People use layout to understand a document almost without thinking. We recognise that:</p><ul><li>a heading introduces the paragraphs below it;</li><li>a list groups related points;</li><li>columns have an intended reading order;</li><li>a value in a table belongs to its row and column labels; and</li><li>a caption explains a nearby picture or chart.</li></ul><p>Software has to rebuild those relationships.</p><p>Consider a fictional leave policy arranged in two columns. The left column contains the <strong>General leave rule</strong>:</p><blockquote>Employees may carry forward up to four unused leave days. Carried-over days must be used by 31 January of the following year.</blockquote><p>The right column is headed <strong>Employees on probation</strong>:</p><blockquote>Employees on probation may not carry leave forward.</blockquote><figure><img alt="A two-column leave policy page. The left column contains the general carry-forward rule and the 31 January deadline. The right column contains the exception for employees on probation." src="https://cdn-images-1.medium.com/max/1024/1*ld-jw7ytPIfru2rR9XPbyA.png" /><figcaption>The page places the general rule and the probation exception in separate columns, showing that they are two distinct sections. AI-Illustration</figcaption></figure><p>A person recognises the two columns as separate sections. They read every line in the left column first and then move to the top of the right column.</p><p>A basic extractor may not recognise that column structure. It can treat the whole page as a series of horizontal rows. It reads a line from the left, then the line at the same height on the right, before moving down to the next row.</p><p>The extracted text may then look something like this:</p><blockquote>Employees may carry <strong>Employees on</strong><br>forward up to four <strong>probation may not</strong><br>unused leave days. <strong>carry leave forward.</strong><br>Carried-over days <br>must be used by <br>31 January of the <br>following year.</blockquote><p>The words from the general rule and the probation exception are now interleaved. Every word may have been captured, but the order no longer matches the document, and the policy becomes difficult to understand.</p><p>This is why <strong>reading order is part of the content</strong>. Extraction must recognise the columns and preserve their intended sequence, not simply read the page one horizontal line at a time.</p><h3>The goal is usable structure</h3><p>Successful extraction does not need to make an exact visual copy of the page. It needs to preserve the relationships that make the page understandable.</p><p>A two-column policy can become two correctly ordered sections. A table can remain a table or be converted into clear sentences, as long as each value stays connected to the correct label. A heading should remain attached to the paragraphs it introduces.</p><p>The extracted content should also remember where each item came from, for example, the source file, page, or position on the page. This source information is called <strong>provenance.</strong></p><p>Provenance becomes useful later when an answer needs to show its evidence. It also helps a pipeline find and update the correct content when a document changes.</p><p>The result is not one large block of copied text. It is a structured description of the document that keeps its meaning and its connection to the source.</p><p>The extracted document may look different from the original, but it still says the same thing.</p><p>That is what extraction contributes to RAG. It turns a page designed for human eyes into content that software can process without discarding the structure that explains it.</p><p>We have seen how extraction turns documents into content software can process. But the content must be divided without separating related ideas, or retrieval may return incomplete context. The next article explores chunking and how to create focused, meaningful passages.</p><p><strong>Previous:</strong> <a href="https://medium.com/@kuriankevin.dev/rag-the-difference-between-a-model-that-knows-things-and-a-model-that-looks-them-up-097a95a2a6d7">RAG: The Difference Between a Model That Knows and One That Looks Things Up</a></p><p><strong>Next: </strong><a href="https://medium.com/@kuriankevin.dev/chunking-how-to-split-a-document-without-losing-its-meaning-f5fe6e16e6fb">Chunking: How to Split a Document Without Losing Its Meaning</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7143ce3f0ff3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAG: The Difference Between a Model That Knows and One That Looks Things Up]]></title>
            <link>https://medium.com/@kuriankevin/rag-the-difference-between-a-model-that-knows-things-and-a-model-that-looks-them-up-097a95a2a6d7?source=rss-5fd13834ef5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/097a95a2a6d7</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <dc:creator><![CDATA[Kurian Kevin]]></dc:creator>
            <pubDate>Thu, 10 Sep 2026 18:52:48 GMT</pubDate>
            <atom:updated>2026-09-13T03:46:31.883Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>A beginner’s guide to understanding the limits of what language models know, why they cannot access your documents on their own, and how RAG brings the right information into the conversation.</em></strong></p><blockquote>This article was written with the assistance of AI and edited by the author.</blockquote><figure><img alt="Split scene showing one AI assistant guessing from a cloud of learned patterns while another looks up a highlighted passage in an employee handbook." src="https://cdn-images-1.medium.com/max/1024/1*9fJ9pzxdWWFJsxExdrbWUQ.png" /><figcaption>Without the handbook, the assistant has to guess; with the handbook, it can find the relevant passage and answer from the company’s actual policy. AI-Illustration</figcaption></figure><p>Imagine asking an AI assistant a straightforward question:</p><blockquote>“How many unused leave days can I carry into next year, and when do they expire?”</blockquote><p>The answer appears almost immediately. It gives you a number, a deadline, and a clear explanation. It sounds as though the assistant has read the employee handbook.</p><p>But suppose the policy exists only in your company’s private wiki. The model was never trained on it, you have not included it in the conversation, and the assistant has no connection to the wiki.</p><p>Where did those details come from?</p><p>The model may have produced an answer that resembles leave policies it encountered during training. It could sound perfectly reasonable while having no basis in your company’s actual policy.</p><p>This is the gap that <strong>retrieval-augmented generation (RAG)</strong> is designed to address. Before asking the model to respond, the application retrieves relevant information and provides it alongside the question.</p><p>In short: <strong>retrieve first, then generate</strong>.</p><h3>What a language model “knows”</h3><p>During training, a language model learns patterns from large amounts of data. Those patterns help it explain familiar concepts, write code, summarise text, and answer many general questions.</p><p>They do not give the model automatic access to your private files or to information created after its training data was collected. An assistant can explain how employee benefits usually work without ever having seen your company’s handbook.</p><p>Understanding what a leave policy normally looks like is different from having access to <em>your</em> leave policy.</p><p>Without that access, the model might admit that it does not know, ask you to provide the document, or fill the gap with unsupported details, a behavior known as <strong>hallucination</strong>. Because all three responses can sound equally fluent, wording alone cannot tell you whether an answer is grounded in reliable information.</p><p>Even a correct guess would leave you without a reliable reason to trust it.</p><h3>Why a bigger model does not solve this problem</h3><p>A more capable model may interpret a complicated policy better but only if it can see the policy in the first place. Training on more general information can broaden the model’s knowledge, but it does not give the model access to your company’s private documents.</p><p>This is an important distinction: <strong>model capability and information access are separate problems</strong>.</p><p>If the missing ingredient is your company’s policy, the solution is not simply a bigger model. The system needs a way to find the policy and place the relevant part in front of the model.</p><h3>What changes when the system looks it up</h3><p>Suppose the relevant passage in our fictional handbook reads:</p><blockquote><strong>Leave policy HR-PTO-17:</strong> Employees may carry forward up to four unused leave days. Carried-over days must be used by 31 January of the following year.</blockquote><p>A basic RAG interaction has three stages:</p><p>1. <strong>Retrieve</strong>: Search the available documents for passages related to the question.<br>2. <strong>Augment</strong>: Add the most relevant passages to the instructions sent to the language model.<br>3. <strong>Generate</strong>: Ask the model to answer using the question and the retrieved evidence.</p><p>The intended answer is now straightforward:</p><blockquote>“You can carry forward up to four unused leave days, and you must use them by 31 January of the following year, according to policy HR-PTO-17.”</blockquote><p>The model has not memorised the policy through another round of training. It reads the passage supplied with the question and uses it to write the answer. <strong>This is the core of RAG: combining the model’s language abilities with information retrieved for a specific question.</strong></p><p>If you have ever pasted a document into a chat and asked questions about it, you have already used the basic idea. You found the material and put it in front of the model yourself.</p><p>RAG lets the application do that lookup for each question. This becomes useful when the answer could be hidden among hundreds or thousands of documents and the user does not know which one to provide.</p><h3>An answer you can check against its source</h3><p>Finding the relevant passage changes more than the answer itself. The assistant can now, also show where the information came from.</p><p>In our example, the response can point back to policy <strong>HR-PTO-17</strong> in the employee handbook. A real application might also include the document title, section, page number, or a link that opens the source.</p><p>That source serves two purposes. It gives the model the company’s actual policy instead of leaving it to guess, and it gives the reader something concrete to verify. The reader no longer has to trust an answer simply because it sounds confident.</p><p>This makes the response more reliable because it is <strong>traceable</strong>. The answer and the evidence behind it can travel together.</p><figure><img alt="Three-panel sequence: a person asks an AI assistant a question, the assistant searches an employee handbook with a magnifying glass, and the assistant presents an answer beside the highlighted source passage." src="https://cdn-images-1.medium.com/max/1024/1*3YTSM08MoK0lFWjNTiSXAA.png" /><figcaption>A RAG system finds the relevant passage, uses it to support the answer, and keeps the source visible for the reader. AI-Illustration</figcaption></figure><h3>Not all company knowledge is found in the same way</h3><p>The information an assistant needs generally appears in two broad forms, structured data and unstructured documents.</p><h4>Structured data: information stored in tables</h4><p>Consider this question:</p><blockquote>“How many leave days does this employee have remaining?”</blockquote><p>If the balance lives in an HR database, the relevant value may already occupy a specific field. A database query or API request can retrieve it directly.</p><p>This is <strong>structured data</strong>: records organised into defined fields such as employee IDs, dates, balances, and status values. SQL and APIs provide established ways to filter, join, count, and retrieve those records.</p><p>There is still work involved in choosing the correct query and interpreting the result, but there is an explicit structure to query.</p><h4>Unstructured documents: information stored in documents</h4><p>Now consider a different question:</p><blockquote>“What happens to unused leave when the year ends?”</blockquote><p>The answer may be a paragraph in a handbook, with an exception explained under another heading or on another page. Similar problems appear in onboarding guides, meeting notes, support conversations, contracts, and technical documentation.</p><p>This is usually called <strong>unstructured data</strong>. These documents may contain headings, lists, and tables, but their meaning is not consistently stored in fields that a database query can address.</p><p>A great deal of organisational knowledge lives in this form: explanations, decisions, exceptions, and the reasons behind a rule. Answering a question means finding the right passage and interpreting it in context.</p><p>RAG can retrieve information from both structured and unstructured sources. This series focuses on <strong>unstructured data</strong>, which must first be extracted from source documents, broken into meaningful pieces, and made searchable.</p><figure><img alt="Side-by-side scene showing an AI assistant using a magnifying glass to look up a highlighted value in an employee table and the same assistant looking up a highlighted passage in an open handbook." src="https://cdn-images-1.medium.com/max/1024/1*oSaJeZmrAbjqzP8rEKJB9g.png" /><figcaption>Both paths involve a lookup: structured data exposes values in defined fields, while an unstructured document expresses information in prose. AI-Illustration</figcaption></figure><p>We have seen how RAG brings relevant information into a model’s context, but source documents must first be converted into content software can reliably process. The next article explores document extraction: how software identifies and structures the content inside a file, and why preserving reading order and relationships matters to every stage that follows.</p><p><strong>Next:</strong> <a href="https://medium.com/@kuriankevin.dev/extraction-what-your-ai-actually-reads-inside-a-document-7143ce3f0ff3">Extraction: What Your AI Actually Sees When it Opens a Document</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=097a95a2a6d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>