<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ValeryKot</title>
    <description>The latest articles on DEV Community by ValeryKot (@valerykot).</description>
    <link>https://dev.to/valerykot</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1041183%2Fba74d7ae-ff6d-458e-bf4d-7584d319211c.jpeg</url>
      <title>DEV Community: ValeryKot</title>
      <link>https://dev.to/valerykot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/valerykot"/>
    <language>en</language>
    <item>
      <title>Does RAG Need Better Retrieval — or Better Relationships?</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Thu, 17 Sep 2026 19:17:28 +0000</pubDate>
      <link>https://dev.to/valerykot/does-rag-need-better-retrieval-or-better-relationships-4fkk</link>
      <guid>https://dev.to/valerykot/does-rag-need-better-retrieval-or-better-relationships-4fkk</guid>
      <description>&lt;p&gt;I started this experiment for a slightly different reason.&lt;/p&gt;

&lt;p&gt;I was playing with a system that could reconstruct context across documents.&lt;/p&gt;

&lt;p&gt;Not summarize documents. Not retrieve the most similar chunks.&lt;/p&gt;

&lt;p&gt;Reconstruct context.&lt;/p&gt;

&lt;p&gt;For example, suppose I have two documents:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In 2022, the team chose PostgreSQL.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And somewhere else:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;After the migration problems, the team moved to DynamoDB in 2024.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Neither document contains the answer to:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why did the database decision change?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer lives in the relationship between them.&lt;/p&gt;

&lt;p&gt;That got me thinking about something else.&lt;/p&gt;

&lt;p&gt;If a system can reliably recover these relationships, could it also use them to create structured training data?&lt;/p&gt;

&lt;p&gt;Before going there, I wanted to know whether the relationships actually mattered.&lt;/p&gt;

&lt;p&gt;So I built a small experiment.&lt;/p&gt;

&lt;p&gt;And the first result was much stronger than I expected.&lt;/p&gt;




&lt;h2&gt;
  
  
  I wanted to remove retrieval from the equation
&lt;/h2&gt;

&lt;p&gt;The obvious problem with testing relationships in RAG is retrieval.&lt;/p&gt;

&lt;p&gt;If the experiment gets better answers after adding a graph, what actually improved?&lt;/p&gt;

&lt;p&gt;Maybe the graph found documents that retrieval missed.&lt;/p&gt;

&lt;p&gt;Maybe it simply retrieved more useful evidence.&lt;/p&gt;

&lt;p&gt;Maybe the model got more context.&lt;/p&gt;

&lt;p&gt;Maybe the graph structure itself helped.&lt;/p&gt;

&lt;p&gt;Those are very different explanations.&lt;/p&gt;

&lt;p&gt;I wanted to isolate one of them.&lt;/p&gt;

&lt;p&gt;So I made the retrieved documents identical in both conditions.&lt;/p&gt;

&lt;p&gt;No re-ranking.&lt;/p&gt;

&lt;p&gt;No additional documents.&lt;/p&gt;

&lt;p&gt;No better retrieval.&lt;/p&gt;

&lt;p&gt;The model gets the same documents.&lt;/p&gt;

&lt;p&gt;The only difference is whether it also receives explicit relationships between those documents. &lt;/p&gt;

&lt;p&gt;That became the experiment:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Does explicitly stated relational context improve reasoning when retrieval is held constant?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The dataset
&lt;/h2&gt;

&lt;p&gt;I built a synthetic corpus of 254 business documents.&lt;/p&gt;

&lt;p&gt;The documents cover things like billing, DevOps and HR.&lt;/p&gt;

&lt;p&gt;Then I created 60 multi-hop cases with manually defined ground truth:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;42 supersession cases&lt;/li&gt;
&lt;li&gt;6 contradiction cases&lt;/li&gt;
&lt;li&gt;4 negative cases&lt;/li&gt;
&lt;li&gt;8 link cases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some cases require reasoning across several documents. Six of the supersession cases involve four to six documents with unrelated distractors. &lt;/p&gt;

&lt;p&gt;I deliberately made some of the relationships hard to recover from individual documents.&lt;/p&gt;

&lt;p&gt;For example, two documents can both be perfectly valid while representing different states of the same decision.&lt;/p&gt;

&lt;p&gt;The important information isn't inside either document.&lt;/p&gt;

&lt;p&gt;It's in:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;A → superseded by → B&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;or:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;A ↔ contradicts ↔ B&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;or:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;A → belongs to → cluster B&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There is also a meaningful negative case:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;A → no known relation → B&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That one turned out to matter more than I expected.&lt;/p&gt;




&lt;h2&gt;
  
  
  The baseline was deliberately weak
&lt;/h2&gt;

&lt;p&gt;I used a lexical BM25-style top-5 retrieval over the full corpus.&lt;/p&gt;

&lt;p&gt;It isn't a production BM25 implementation. It's a deliberately simple lexical baseline.&lt;/p&gt;

&lt;p&gt;Mean recall of the oracle documents in the top five was 0.67.&lt;/p&gt;

&lt;p&gt;27 of the 60 cases had full recall.&lt;/p&gt;

&lt;p&gt;17 had partial recall.&lt;/p&gt;

&lt;p&gt;10 had low recall.&lt;/p&gt;

&lt;p&gt;Six had zero recall, all of them negative cases. &lt;/p&gt;

&lt;p&gt;This is a real limitation.&lt;/p&gt;

&lt;p&gt;If retrieval misses evidence, a relational hint can potentially compensate for that weakness.&lt;/p&gt;

&lt;p&gt;So I don't want to pretend this experiment answers what happens with a very strong production retrieval system.&lt;/p&gt;

&lt;p&gt;But it gives us something useful:&lt;/p&gt;

&lt;p&gt;C and D see &lt;strong&gt;byte-identical retrieved documents&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That part is controlled. &lt;/p&gt;




&lt;h2&gt;
  
  
  Then I added the relationships
&lt;/h2&gt;

&lt;p&gt;The baseline looks roughly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;retrieved documents
        ↓
       LLM
        ↓
      answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The experimental condition adds a small structured block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;retrieved documents
        +
explicit relationships
        ↓
       LLM
        ↓
      answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kind: superseded
from: database-choice-2022.md
to: database-choice-2024.md
reason: migration failure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model was told that the knowledge-base engine had detected the relation and that it should use the hint if it was consistent with the documents. &lt;/p&gt;

&lt;p&gt;Nothing else changed.&lt;/p&gt;




&lt;h2&gt;
  
  
  The result
&lt;/h2&gt;

&lt;p&gt;I ran the main experiment with two models.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;No relation&lt;/th&gt;
&lt;th&gt;Typed relations&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DeepSeek&lt;/td&gt;
&lt;td&gt;77%&lt;/td&gt;
&lt;td&gt;94%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-4o-mini&lt;/td&gt;
&lt;td&gt;77%&lt;/td&gt;
&lt;td&gt;98%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The gain was:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;+17 percentage points&lt;/strong&gt; for DeepSeek.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;+21 points&lt;/strong&gt; for GPT-4o-mini. &lt;/p&gt;

&lt;p&gt;That was enough to make me stop and ask a more annoying question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What exactly did I measure?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because “adding a graph improves RAG” would be a very easy conclusion.&lt;/p&gt;

&lt;p&gt;And probably a premature one.&lt;/p&gt;




&lt;h1&gt;
  
  
  Maybe the model just likes extra tokens
&lt;/h1&gt;

&lt;p&gt;The relation hints were only around 17 words.&lt;/p&gt;

&lt;p&gt;Perhaps the model simply benefited from getting more information.&lt;/p&gt;

&lt;p&gt;So I added a control with approximately the same amount of unrelated text.&lt;/p&gt;

&lt;p&gt;Parking.&lt;/p&gt;

&lt;p&gt;Cafeteria.&lt;/p&gt;

&lt;p&gt;Meeting rooms.&lt;/p&gt;

&lt;p&gt;No relation labels.&lt;/p&gt;

&lt;p&gt;No document names.&lt;/p&gt;

&lt;p&gt;No similarity scores.&lt;/p&gt;

&lt;p&gt;That condition scored 53%.&lt;/p&gt;

&lt;p&gt;The baseline was 77%.&lt;/p&gt;

&lt;p&gt;The relational condition was 98%. &lt;/p&gt;

&lt;p&gt;So “more tokens” doesn't explain the result.&lt;/p&gt;

&lt;p&gt;At least not by itself.&lt;/p&gt;




&lt;h1&gt;
  
  
  Maybe structure is the trick
&lt;/h1&gt;

&lt;p&gt;The relational information was presented as fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kind:
from:
to:
reason:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Maybe that formatting alone makes the model perform better.&lt;/p&gt;

&lt;p&gt;So I took the same semantic information and put it into ordinary prose.&lt;/p&gt;

&lt;p&gt;Something like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: B reflects the current state of this decision. A is the previous version.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Same information.&lt;/p&gt;

&lt;p&gt;No structured relation fields.&lt;/p&gt;

&lt;p&gt;That scored 53%.&lt;/p&gt;

&lt;p&gt;The structured version scored 98%. &lt;/p&gt;

&lt;p&gt;This result bothered me.&lt;/p&gt;

&lt;p&gt;Because now I had learned something I hadn't originally set out to test:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;how the relationship is presented may matter almost as much as the relationship itself.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And I had a new confound.&lt;/p&gt;

&lt;p&gt;Maybe the model doesn't actually reason over the relationship.&lt;/p&gt;

&lt;p&gt;Maybe it just trusts the block because I told it that a “knowledge base engine” generated it.&lt;/p&gt;

&lt;p&gt;I'll come back to that.&lt;/p&gt;




&lt;h1&gt;
  
  
  What if the relations are wrong?
&lt;/h1&gt;

&lt;p&gt;This was the test I cared about most.&lt;/p&gt;

&lt;p&gt;If relationships really carry useful information, incorrect relationships should matter.&lt;/p&gt;

&lt;p&gt;I corrupted the identifying fields of the relation hints.&lt;/p&gt;

&lt;p&gt;At 20% corruption, accuracy dropped from 98% to 53%.&lt;/p&gt;

&lt;p&gt;At 40%, it was 52%.&lt;/p&gt;

&lt;p&gt;That is a dramatic failure. &lt;/p&gt;

&lt;p&gt;But there is an important detail here.&lt;/p&gt;

&lt;p&gt;I did &lt;strong&gt;not&lt;/strong&gt; test every corruption level.&lt;/p&gt;

&lt;p&gt;I don't know what happens at 5%.&lt;/p&gt;

&lt;p&gt;I don't know what happens at 10%.&lt;/p&gt;

&lt;p&gt;I don't know whether another corruption mechanism would behave differently.&lt;/p&gt;

&lt;p&gt;So I can't say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“80% correct relations are useless.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The experiment doesn't show that.&lt;/p&gt;

&lt;p&gt;It shows something narrower:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Under this particular corruption mechanism, introducing 20% incorrect relations almost completely destroyed the observed benefit.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That distinction matters.&lt;/p&gt;




&lt;h1&gt;
  
  
  Then I tried similarity instead of typed relationships
&lt;/h1&gt;

&lt;p&gt;This was probably the most interesting part of the experiment.&lt;/p&gt;

&lt;p&gt;If relationships help because they connect documents, perhaps we don't need explicit relation types.&lt;/p&gt;

&lt;p&gt;Maybe a similarity graph is enough.&lt;/p&gt;

&lt;p&gt;So I created another condition where the model received document-to-document similarity edges instead of typed relations.&lt;/p&gt;

&lt;p&gt;The result improved substantially:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;No hint&lt;/th&gt;
&lt;th&gt;Similarity&lt;/th&gt;
&lt;th&gt;Typed relation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DeepSeek&lt;/td&gt;
&lt;td&gt;76%&lt;/td&gt;
&lt;td&gt;88%&lt;/td&gt;
&lt;td&gt;96%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-4o-mini&lt;/td&gt;
&lt;td&gt;76%&lt;/td&gt;
&lt;td&gt;93%&lt;/td&gt;
&lt;td&gt;98%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Similarity clearly helped.&lt;/p&gt;

&lt;p&gt;But it didn't behave like typed relations. &lt;/p&gt;

&lt;p&gt;There was a particularly interesting case.&lt;/p&gt;

&lt;p&gt;For DeepSeek, similarity actually beat typed relations on the link cases:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;79% vs 71%.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The likely explanation is still only a hypothesis. The typed hint contained a &lt;code&gt;reason&lt;/code&gt; field that may have distracted the model. &lt;/p&gt;

&lt;p&gt;The negative cases were different.&lt;/p&gt;

&lt;p&gt;Similarity hurt them.&lt;/p&gt;

&lt;p&gt;The model saw related-looking documents and tended to assume that a relationship existed.&lt;/p&gt;

&lt;p&gt;The typed relation could explicitly say:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kind: none
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That distinction matters.&lt;/p&gt;

&lt;p&gt;Similarity says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;These things look related.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A typed relation can say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;These things are related in this specific way.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Or:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;These things are not related.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Those are different pieces of information.&lt;/p&gt;




&lt;h1&gt;
  
  
  Then I tried to break the whole thing
&lt;/h1&gt;

&lt;p&gt;I added three more controls:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shuffled relations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Give each case a relation from another case of the same kind.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Token-matched text&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Give the model unrelated text with approximately the same length as the relation hint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In-document prose&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Put the same semantic relation into ordinary document text.&lt;/p&gt;

&lt;p&gt;All three landed around 52–53%.&lt;/p&gt;

&lt;p&gt;The baseline was 77%.&lt;/p&gt;

&lt;p&gt;The structured, correct relation condition was 98%. &lt;/p&gt;

&lt;p&gt;The shuffled condition also passed an anti-leakage check: none of the 60 shuffled hints happened to be correct. &lt;/p&gt;

&lt;p&gt;At this point I was reasonably confident that the result wasn't just:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Give the LLM some extra words that look vaguely useful.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But I still wasn't confident about &lt;em&gt;why&lt;/em&gt; the structured relation worked.&lt;/p&gt;




&lt;h1&gt;
  
  
  The uncomfortable explanation
&lt;/h1&gt;

&lt;p&gt;There is one explanation my controls don't eliminate.&lt;/p&gt;

&lt;p&gt;Maybe the model isn't using the relational structure as relational structure.&lt;/p&gt;

&lt;p&gt;Maybe it sees:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Retineo relation: kind=superseded ...&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and interprets that as privileged metadata.&lt;/p&gt;

&lt;p&gt;In other words:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“The system says this is the answer, so I'll trust it.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That would produce a large improvement without requiring the model to reconstruct anything from the relationship itself.&lt;/p&gt;

&lt;p&gt;The in-document prose control actually makes this possibility more interesting.&lt;/p&gt;

&lt;p&gt;The two conditions contain the same semantic information.&lt;/p&gt;

&lt;p&gt;Yet the structured version was dramatically more effective. &lt;/p&gt;

&lt;p&gt;So I can't currently separate:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;relational reasoning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;from&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;authority/salience effects caused by the representation.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's the next control I want to run.&lt;/p&gt;




&lt;h1&gt;
  
  
  There is another problem: retrieval
&lt;/h1&gt;

&lt;p&gt;My retrieval baseline is weak.&lt;/p&gt;

&lt;p&gt;That's not an incidental detail.&lt;/p&gt;

&lt;p&gt;Mean top-5 recall was only 0.67, so there is plenty of room for a relational hint to compensate for retrieval failures. &lt;/p&gt;

&lt;p&gt;Imagine that the model needs documents A, B and C.&lt;/p&gt;

&lt;p&gt;The retriever returns A and B.&lt;/p&gt;

&lt;p&gt;Then I give it a relation saying:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A → related_to → C
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I haven't really solved the retrieval problem.&lt;/p&gt;

&lt;p&gt;I've given the model a shortcut around it.&lt;/p&gt;

&lt;p&gt;So the next experiment is becoming pretty obvious.&lt;/p&gt;

&lt;p&gt;I want to vary retrieval depth while keeping the relational condition intact.&lt;/p&gt;

&lt;p&gt;Something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;shallow retrieval
       ×
no relation / relation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;deeper retrieval
       ×
no relation / relation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The question is not whether deeper retrieval improves the baseline.&lt;/p&gt;

&lt;p&gt;Of course it can.&lt;/p&gt;

&lt;p&gt;The interesting question is what happens to the &lt;strong&gt;gap&lt;/strong&gt; between the two conditions.&lt;/p&gt;

&lt;p&gt;If:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+21 pp
  ↓
+10 pp
  ↓
 +2 pp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then the relational hint may mostly be compensating for weak retrieval.&lt;/p&gt;

&lt;p&gt;If the gap remains large as retrieval quality improves, the story gets more interesting.&lt;/p&gt;

&lt;p&gt;But this experiment needs some care. Simply dumping 100 documents into the context changes the amount of text the model has to process, so that would introduce another variable.&lt;/p&gt;

&lt;p&gt;I want to separate &lt;strong&gt;more available evidence&lt;/strong&gt; from &lt;strong&gt;more text in the prompt&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  What I think the experiment says so far
&lt;/h1&gt;

&lt;p&gt;Here is the version I'm comfortable with.&lt;/p&gt;

&lt;p&gt;On this synthetic corpus, with this retrieval setup and these two models:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Correct typed cross-document relations improved accuracy when the retrieved documents were identical.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The effect survived controls for extra tokens, shuffled relations, and expressing the same semantic information as ordinary document prose. &lt;/p&gt;

&lt;p&gt;Similarity structure also helped, but typed relations provided additional information in several cases, particularly where relation type or explicit absence mattered. &lt;/p&gt;

&lt;p&gt;That's the observation.&lt;/p&gt;

&lt;p&gt;The explanation is still open.&lt;/p&gt;

&lt;p&gt;I don't know yet how much of the effect comes from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;information about the relationship itself;&lt;/li&gt;
&lt;li&gt;making that information easier for the model to parse;&lt;/li&gt;
&lt;li&gt;the model treating structured metadata as authoritative;&lt;/li&gt;
&lt;li&gt;compensation for weak retrieval.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And I definitely don't know whether the effect survives real organizational data.&lt;/p&gt;

&lt;p&gt;The corpus is synthetic.&lt;/p&gt;

&lt;p&gt;The retrieval is simplified.&lt;/p&gt;

&lt;p&gt;There are only two models.&lt;/p&gt;

&lt;p&gt;Those are real boundaries on the result, not footnotes to hide at the end. &lt;/p&gt;




&lt;h1&gt;
  
  
  This started as a data-labeling idea
&lt;/h1&gt;

&lt;p&gt;There was a practical reason I ran the experiment in the first place.&lt;/p&gt;

&lt;p&gt;I was thinking about whether a context-reconstruction system could help create structured datasets.&lt;/p&gt;

&lt;p&gt;Take a collection of documents.&lt;/p&gt;

&lt;p&gt;Find candidate relationships.&lt;/p&gt;

&lt;p&gt;Classify them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;supersedes
contradicts
belongs_to
references
none
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use those relationships as structured training data.&lt;/p&gt;

&lt;p&gt;That sounds useful.&lt;/p&gt;

&lt;p&gt;But it also creates a nasty circular problem.&lt;/p&gt;

&lt;p&gt;If I use the system to generate relational labels, and then use those labels to demonstrate that relational context helps models, I may just be measuring my own assumptions.&lt;/p&gt;

&lt;p&gt;So I stopped.&lt;/p&gt;

&lt;p&gt;Before thinking about dataset generation, I wanted to know whether the representation itself had a measurable effect.&lt;/p&gt;

&lt;p&gt;That led to this experiment.&lt;/p&gt;

&lt;p&gt;And now I have a better question than the one I started with.&lt;/p&gt;




&lt;h1&gt;
  
  
  The next experiment
&lt;/h1&gt;

&lt;p&gt;I don't want to build a bigger graph yet.&lt;/p&gt;

&lt;p&gt;I want to try to make this result disappear.&lt;/p&gt;

&lt;p&gt;Better retrieval.&lt;/p&gt;

&lt;p&gt;More evidence.&lt;/p&gt;

&lt;p&gt;Interactive retrieval.&lt;/p&gt;

&lt;p&gt;Different models.&lt;/p&gt;

&lt;p&gt;Different relational representations.&lt;/p&gt;

&lt;p&gt;And especially an experiment that removes the “trusted metadata” explanation.&lt;/p&gt;

&lt;p&gt;If better retrieval makes the relational advantage disappear, that's useful.&lt;/p&gt;

&lt;p&gt;If it doesn't, that's useful too.&lt;/p&gt;

&lt;p&gt;Either result tells me where to look next.&lt;/p&gt;

&lt;p&gt;The interesting question is no longer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Does GraphRAG work?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's too broad to be useful.&lt;/p&gt;

&lt;p&gt;The question I'm interested in is much smaller:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;When an LLM already has the relevant documents, does explicitly representing the relationships between those documents give it information it cannot reliably reconstruct from the documents themselves?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I don't have the final answer yet.&lt;/p&gt;

&lt;p&gt;That's exactly why I'm running the next experiment.&lt;/p&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>rag</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Documentation Doesn't Accumulate Knowledge</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Sat, 01 Aug 2026 18:39:49 +0000</pubDate>
      <link>https://dev.to/valerykot/documentation-doesnt-accumulate-knowledge-158k</link>
      <guid>https://dev.to/valerykot/documentation-doesnt-accumulate-knowledge-158k</guid>
      <description>&lt;p&gt;&lt;em&gt;It accumulates evidence.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;I used to believe something that now feels obvious.&lt;/p&gt;

&lt;p&gt;If we documented enough, understanding would take care of itself.&lt;/p&gt;

&lt;p&gt;Write the ADR.&lt;/p&gt;

&lt;p&gt;Keep the runbook up to date.&lt;/p&gt;

&lt;p&gt;Record the incident.&lt;/p&gt;

&lt;p&gt;Update the architecture diagram.&lt;/p&gt;

&lt;p&gt;Future engineers would have everything they needed.&lt;/p&gt;

&lt;p&gt;I don't think that's true anymore.&lt;/p&gt;




&lt;h2&gt;
  
  
  The day I read everything
&lt;/h2&gt;

&lt;p&gt;I was trying to understand a service I hadn't worked on before.&lt;/p&gt;

&lt;p&gt;The documentation looked excellent.&lt;/p&gt;

&lt;p&gt;There was an ADR explaining the original design.&lt;/p&gt;

&lt;p&gt;A migration guide from the last major release.&lt;/p&gt;

&lt;p&gt;An incident review.&lt;/p&gt;

&lt;p&gt;An API reference.&lt;/p&gt;

&lt;p&gt;A runbook.&lt;/p&gt;

&lt;p&gt;An architecture diagram.&lt;/p&gt;

&lt;p&gt;Everything was current.&lt;/p&gt;

&lt;p&gt;Everything was internally consistent.&lt;/p&gt;

&lt;p&gt;I spent almost two hours reading.&lt;/p&gt;

&lt;p&gt;When I closed the last page, I realized something uncomfortable.&lt;/p&gt;

&lt;p&gt;I knew what had happened.&lt;/p&gt;

&lt;p&gt;I still didn't understand the system.&lt;/p&gt;




&lt;h2&gt;
  
  
  Every document was telling the truth
&lt;/h2&gt;

&lt;p&gt;The ADR explained why the original architecture was chosen.&lt;/p&gt;

&lt;p&gt;The migration guide explained why it changed.&lt;/p&gt;

&lt;p&gt;The incident review explained why it failed.&lt;/p&gt;

&lt;p&gt;The runbook explained how to recover it.&lt;/p&gt;

&lt;p&gt;None of those documents contradicted each other.&lt;/p&gt;

&lt;p&gt;They simply weren't trying to answer the same question.&lt;/p&gt;

&lt;p&gt;Each one captured a moment.&lt;/p&gt;

&lt;p&gt;I was looking for a story.&lt;/p&gt;




&lt;h2&gt;
  
  
  That's when I noticed the difference
&lt;/h2&gt;

&lt;p&gt;Documentation preserves observations.&lt;/p&gt;

&lt;p&gt;Understanding comes from connecting observations.&lt;/p&gt;

&lt;p&gt;The documents never said:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"This incident changed the team's priorities."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"That migration only happened because of the outage three months earlier."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"This design decision stopped making sense after customer X arrived."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Nobody wrote those sentences because nobody needed to.&lt;/p&gt;

&lt;p&gt;At the time, everyone already knew them.&lt;/p&gt;

&lt;p&gt;Months later, those invisible connections turned out to be the only thing I actually needed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Evidence isn't explanation
&lt;/h2&gt;

&lt;p&gt;A detective doesn't solve a case because there are enough fingerprints.&lt;/p&gt;

&lt;p&gt;The fingerprints matter.&lt;/p&gt;

&lt;p&gt;But only after someone connects them.&lt;/p&gt;

&lt;p&gt;Documentation works the same way.&lt;/p&gt;

&lt;p&gt;Each page is evidence that something happened.&lt;/p&gt;

&lt;p&gt;Knowledge appears only when someone reconstructs the relationships between those pieces of evidence.&lt;/p&gt;

&lt;p&gt;The documents weren't incomplete.&lt;/p&gt;

&lt;p&gt;My understanding was.&lt;/p&gt;




&lt;h2&gt;
  
  
  What changed for me
&lt;/h2&gt;

&lt;p&gt;I stopped asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Do we have documentation?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now I ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Could someone who wasn't here reconstruct the story?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Those are different questions.&lt;/p&gt;

&lt;p&gt;The first measures documentation.&lt;/p&gt;

&lt;p&gt;The second measures understanding.&lt;/p&gt;

&lt;p&gt;I've become much less convinced they're the same thing.&lt;/p&gt;




&lt;p&gt;Documentation preserves evidence.&lt;/p&gt;

&lt;p&gt;Knowledge is reconstructed.&lt;/p&gt;

&lt;p&gt;The more systems I study, the more I think confusing those two ideas is the reason so many organizations feel well documented—and still spend hours asking each other &lt;em&gt;"Why does this work like this?"&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next: why I stopped treating duplicate documents as clutter—and started treating them as evidence that an organization disagrees with itself.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>machinelearning</category>
      <category>discuss</category>
    </item>
    <item>
      <title>We Back Up Files. We Rarely Back Up Why They Exist.</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Tue, 28 Jul 2026 16:32:33 +0000</pubDate>
      <link>https://dev.to/valerykot/we-back-up-files-we-rarely-back-up-why-they-exist-20cg</link>
      <guid>https://dev.to/valerykot/we-back-up-files-we-rarely-back-up-why-they-exist-20cg</guid>
      <description>&lt;p&gt;&lt;em&gt;Everything survived. Except the explanation.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;A while ago I was trying to understand why one of our services used Redis.&lt;/p&gt;

&lt;p&gt;Finding the artifacts wasn't difficult.&lt;/p&gt;

&lt;p&gt;There was a Jira ticket.&lt;/p&gt;

&lt;p&gt;A pull request.&lt;/p&gt;

&lt;p&gt;An architecture document.&lt;/p&gt;

&lt;p&gt;A Slack discussion.&lt;/p&gt;

&lt;p&gt;A commit.&lt;/p&gt;

&lt;p&gt;Nothing had been deleted.&lt;/p&gt;

&lt;p&gt;Everything was searchable.&lt;/p&gt;

&lt;p&gt;And yet I still couldn't answer a simple question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Redis?&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Every file answered a different question
&lt;/h2&gt;

&lt;p&gt;The Jira ticket answered:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What changed?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The pull request answered:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How was it implemented?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The architecture document answered:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where does it fit?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Slack thread answered:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Who was involved?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The commit answered:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When did it happen?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But none of them answered the question I actually had.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The answer wasn't missing
&lt;/h2&gt;

&lt;p&gt;It just wasn't stored in one place.&lt;/p&gt;

&lt;p&gt;Part of it lived in a security review.&lt;/p&gt;

&lt;p&gt;Part in a design discussion.&lt;/p&gt;

&lt;p&gt;Part in a Slack thread.&lt;/p&gt;

&lt;p&gt;Part in the implementation.&lt;/p&gt;

&lt;p&gt;Individually, every document made sense.&lt;/p&gt;

&lt;p&gt;Collectively, they explained the decision.&lt;/p&gt;

&lt;p&gt;The answer wasn't inside any single document.&lt;/p&gt;

&lt;p&gt;It emerged from the relationships between documents.&lt;/p&gt;




&lt;h2&gt;
  
  
  That's when something started bothering me
&lt;/h2&gt;

&lt;p&gt;We spend enormous effort preserving documents.&lt;/p&gt;

&lt;p&gt;Git preserves commits.&lt;/p&gt;

&lt;p&gt;Confluence preserves pages.&lt;/p&gt;

&lt;p&gt;Jira preserves tickets.&lt;/p&gt;

&lt;p&gt;Slack preserves messages.&lt;/p&gt;

&lt;p&gt;Backups preserve all of them.&lt;/p&gt;

&lt;p&gt;But none of these systems preserve the fact that one artifact exists because of another.&lt;/p&gt;

&lt;p&gt;That relationship usually lives only in people's heads.&lt;/p&gt;

&lt;p&gt;Once those people leave, every document survives.&lt;/p&gt;

&lt;p&gt;The explanation doesn't.&lt;/p&gt;




&lt;h2&gt;
  
  
  I realized I had been asking the wrong question
&lt;/h2&gt;

&lt;p&gt;I used to ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Did we document this?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now I ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If someone finds this document a year from now, will they know what other documents they need to understand it?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Those are different questions.&lt;/p&gt;

&lt;p&gt;The first is about documentation.&lt;/p&gt;

&lt;p&gt;The second is about memory.&lt;/p&gt;




&lt;h2&gt;
  
  
  Documents aren't the whole memory
&lt;/h2&gt;

&lt;p&gt;A document can survive forever.&lt;/p&gt;

&lt;p&gt;That doesn't mean its meaning survives.&lt;/p&gt;

&lt;p&gt;Meaning is often distributed across decisions, conversations, reviews, commits, and documentation.&lt;/p&gt;

&lt;p&gt;I know how to preserve each of those individually.&lt;/p&gt;

&lt;p&gt;I'm no longer convinced that's enough.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Documents preserve what happened.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Relationships preserve why it happened.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next time: why I eventually stopped thinking of documents as the primary thing to index — and started thinking about decisions instead.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>discuss</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>I Was Optimizing Ranking While the Real Problem Was Selection</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Fri, 24 Jul 2026 08:00:08 +0000</pubDate>
      <link>https://dev.to/valerykot/i-was-optimizing-ranking-while-the-real-problem-was-selection-3p0k</link>
      <guid>https://dev.to/valerykot/i-was-optimizing-ranking-while-the-real-problem-was-selection-3p0k</guid>
      <description>&lt;p&gt;&lt;em&gt;I mistook movement for improvement.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;For three months, I changed our ranking algorithm every two weeks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;BM25.&lt;/li&gt;
&lt;li&gt;Hybrid BM25 + vector search.&lt;/li&gt;
&lt;li&gt;A cross-encoder reranker.&lt;/li&gt;
&lt;li&gt;A different embedding model.&lt;/li&gt;
&lt;li&gt;Yet another embedding model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every change moved a few documents up or down the list.&lt;/p&gt;

&lt;p&gt;None of them made the answers better.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Same Wrong Answer, Wearing a Different Tie
&lt;/h2&gt;

&lt;p&gt;The user asked:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Why does the gateway reject service X?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With BM25, the top result was a glossary page defining &lt;em&gt;gateway&lt;/em&gt;. Relevant by keyword. Useless by intent.&lt;/p&gt;

&lt;p&gt;With hybrid retrieval, the glossary page dropped to third. A Jira ticket mentioning service X moved to second. It described the symptom, not the cause.&lt;/p&gt;

&lt;p&gt;With a cross-encoder reranker, the Jira ticket became the top result. The glossary page fell to fourth. The architecture document that actually explained the exception remained at seventh.&lt;/p&gt;

&lt;p&gt;With a different embedding model, that architecture document finally moved to fifth.&lt;/p&gt;

&lt;p&gt;I remember thinking we'd finally made progress.&lt;/p&gt;

&lt;p&gt;We hadn't.&lt;/p&gt;

&lt;p&gt;Every new algorithm felt like progress because &lt;strong&gt;something moved&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The problem was that &lt;strong&gt;nothing important moved&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Document That Mattered Never Became a Candidate
&lt;/h2&gt;

&lt;p&gt;The architecture document existed.&lt;/p&gt;

&lt;p&gt;I knew it existed.&lt;/p&gt;

&lt;p&gt;I had even written part of it.&lt;/p&gt;

&lt;p&gt;It never appeared in the top results.&lt;/p&gt;

&lt;p&gt;Not because it was ranked poorly.&lt;/p&gt;

&lt;p&gt;Because it was never selected.&lt;/p&gt;

&lt;p&gt;The ranking algorithm could only sort the candidates it received.&lt;/p&gt;

&lt;p&gt;The document that actually explained the answer never entered that candidate set.&lt;/p&gt;

&lt;p&gt;No ranking algorithm can promote a document that was excluded before ranking even began.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Moment It Clicked
&lt;/h2&gt;

&lt;p&gt;I had five search results on my screen.&lt;/p&gt;

&lt;p&gt;BM25 returned them in one order.&lt;/p&gt;

&lt;p&gt;The cross-encoder returned them in another.&lt;/p&gt;

&lt;p&gt;A different embedding model shuffled them again.&lt;/p&gt;

&lt;p&gt;They were still the same documents.&lt;/p&gt;

&lt;p&gt;Not one of them answered the question.&lt;/p&gt;

&lt;p&gt;Only then did I ask myself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why am I ranking these documents at all?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Question That Changed Everything
&lt;/h2&gt;

&lt;p&gt;I stopped asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How do I rank these documents better?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I started asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why are these documents candidates in the first place?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That question led me backward.&lt;/p&gt;

&lt;p&gt;Not to another ranking algorithm.&lt;/p&gt;

&lt;p&gt;But to every previous question I had been trying to answer.&lt;/p&gt;

&lt;p&gt;Why didn't a larger context window help?&lt;/p&gt;

&lt;p&gt;Why did chunking make retrieval worse?&lt;/p&gt;

&lt;p&gt;Why did search keep finding documents but miss the explanation?&lt;/p&gt;

&lt;p&gt;I realized those weren't separate problems.&lt;/p&gt;

&lt;p&gt;They were different symptoms of the same one.&lt;/p&gt;

&lt;p&gt;I had been optimizing the last step of retrieval while the earlier ones were quietly determining the outcome.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Hierarchy of Retrieval
&lt;/h2&gt;

&lt;p&gt;I now think about retrieval as three different layers.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Selection&lt;/strong&gt; — What becomes a candidate at all?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assembly&lt;/strong&gt; — How is information preserved, structured, and connected?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ranking&lt;/strong&gt; — In what order should the candidates appear?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For months, I focused almost entirely on the third layer.&lt;/p&gt;

&lt;p&gt;The first layer was already deciding whether the answer had any chance of being found.&lt;/p&gt;

&lt;p&gt;Perfect ranking can only reorder what has already been selected.&lt;/p&gt;

&lt;p&gt;It cannot retrieve what never became a candidate.&lt;/p&gt;




&lt;p&gt;I kept polishing the order of documents that should never have been candidates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I had mistaken ranking for retrieval.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;In the next post, I'll look at a different question: why organizations rarely lose information—they lose the connections that once made that information meaningful.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>machinelearning</category>
      <category>software</category>
    </item>
    <item>
      <title>Why Organizations Forget Even When Nothing Is Deleted</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Tue, 21 Jul 2026 22:34:58 +0000</pubDate>
      <link>https://dev.to/valerykot/why-organizations-forget-even-when-nothing-is-deleted-3jk3</link>
      <guid>https://dev.to/valerykot/why-organizations-forget-even-when-nothing-is-deleted-3jk3</guid>
      <description>&lt;p&gt;&lt;em&gt;The file survived. The explanation didn't.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;A few months ago I needed to understand why one of our services was using Redis.&lt;/p&gt;

&lt;p&gt;The engineer who made that decision had already left the company.&lt;/p&gt;

&lt;p&gt;Finding the implementation wasn't difficult.&lt;/p&gt;

&lt;p&gt;I found the Jira ticket.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Implement Redis cache.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I found the pull request.&lt;/p&gt;

&lt;p&gt;The code was there.&lt;/p&gt;

&lt;p&gt;I found the architecture document.&lt;/p&gt;

&lt;p&gt;It mentioned caching.&lt;/p&gt;

&lt;p&gt;I even found the Slack discussion where someone asked:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Why not Memcached?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The reply was one sentence.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Redis should be fine.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That was all.&lt;/p&gt;

&lt;p&gt;The implementation survived.&lt;/p&gt;

&lt;p&gt;The explanation didn't.&lt;/p&gt;




&lt;h2&gt;
  
  
  Nothing was missing
&lt;/h2&gt;

&lt;p&gt;At first that felt strange.&lt;/p&gt;

&lt;p&gt;Every artifact still existed.&lt;/p&gt;

&lt;p&gt;Nothing had been deleted.&lt;/p&gt;

&lt;p&gt;Git history was intact.&lt;/p&gt;

&lt;p&gt;Slack history was searchable.&lt;/p&gt;

&lt;p&gt;The documentation hadn't disappeared.&lt;/p&gt;

&lt;p&gt;And yet the organization had clearly forgotten something.&lt;/p&gt;

&lt;p&gt;Not &lt;strong&gt;what&lt;/strong&gt; had been built.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt; it had been built that way.&lt;/p&gt;




&lt;h2&gt;
  
  
  We preserve artifacts better than reasoning
&lt;/h2&gt;

&lt;p&gt;Most engineering organizations are very good at keeping records.&lt;/p&gt;

&lt;p&gt;We keep tickets.&lt;/p&gt;

&lt;p&gt;We keep code.&lt;/p&gt;

&lt;p&gt;We keep documents.&lt;/p&gt;

&lt;p&gt;We keep backups.&lt;/p&gt;

&lt;p&gt;What we rarely preserve is the reasoning that connected them.&lt;/p&gt;

&lt;p&gt;The ticket tells you &lt;em&gt;what&lt;/em&gt; changed.&lt;/p&gt;

&lt;p&gt;The pull request shows &lt;em&gt;how&lt;/em&gt; it changed.&lt;/p&gt;

&lt;p&gt;The architecture document describes &lt;em&gt;what the system looks like.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;None of them necessarily explains why one option was chosen over another.&lt;/p&gt;

&lt;p&gt;That explanation often existed only during a conversation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Context has a half-life
&lt;/h2&gt;

&lt;p&gt;I've started thinking of context as something that slowly decays.&lt;/p&gt;

&lt;p&gt;When a decision is made, everyone involved shares the same mental model.&lt;/p&gt;

&lt;p&gt;The constraints are obvious.&lt;/p&gt;

&lt;p&gt;The trade-offs are fresh.&lt;/p&gt;

&lt;p&gt;Rejected alternatives are still remembered.&lt;/p&gt;

&lt;p&gt;Six months later the code remains exactly the same.&lt;/p&gt;

&lt;p&gt;The shared understanding doesn't.&lt;/p&gt;

&lt;p&gt;A year later someone asks:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Why didn't we use Memcached?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Nobody knows anymore.&lt;/p&gt;

&lt;p&gt;Not because the answer was lost.&lt;/p&gt;

&lt;p&gt;Because it was never stored anywhere in a form that could survive the people who understood it.&lt;/p&gt;




&lt;h2&gt;
  
  
  This is how organizational memory disappears
&lt;/h2&gt;

&lt;p&gt;It rarely happens all at once.&lt;/p&gt;

&lt;p&gt;Nobody deletes a document.&lt;/p&gt;

&lt;p&gt;Nobody wipes a database.&lt;/p&gt;

&lt;p&gt;Instead, every small decision loses a little of its surrounding context.&lt;/p&gt;

&lt;p&gt;A meeting ends.&lt;/p&gt;

&lt;p&gt;A Slack thread sinks into history.&lt;/p&gt;

&lt;p&gt;Someone changes teams.&lt;/p&gt;

&lt;p&gt;Someone leaves.&lt;/p&gt;

&lt;p&gt;Months later all the pieces still exist.&lt;/p&gt;

&lt;p&gt;The explanation doesn't.&lt;/p&gt;




&lt;h2&gt;
  
  
  I stopped asking a different question
&lt;/h2&gt;

&lt;p&gt;I used to ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Did we document this?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now I ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Could someone explain this decision after everyone involved has left?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Those aren't the same question.&lt;/p&gt;

&lt;p&gt;Documentation preserves artifacts.&lt;/p&gt;

&lt;p&gt;Organizational memory preserves reasoning.&lt;/p&gt;

&lt;p&gt;One can exist without the other.&lt;/p&gt;




&lt;h2&gt;
  
  
  Forgetting is usually invisible
&lt;/h2&gt;

&lt;p&gt;Organizations don't usually notice they're forgetting.&lt;/p&gt;

&lt;p&gt;Everything still looks healthy.&lt;/p&gt;

&lt;p&gt;Repositories are there.&lt;/p&gt;

&lt;p&gt;Documentation is there.&lt;/p&gt;

&lt;p&gt;Search still works.&lt;/p&gt;

&lt;p&gt;The problem only appears when someone asks a simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And nobody can answer with confidence.&lt;/p&gt;




&lt;p&gt;I've become less convinced that organizations lose knowledge because they delete information.&lt;/p&gt;

&lt;p&gt;More often, they lose the relationships, assumptions, and reasoning that gave that information meaning.&lt;/p&gt;

&lt;p&gt;The files survive.&lt;/p&gt;

&lt;p&gt;The memory quietly fades.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next time I'd like to explore something that surprised me while building retrieval systems: why the LLM often turned out to be the least interesting part of the pipeline.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>discuss</category>
      <category>rag</category>
    </item>
    <item>
      <title>The Difference Between Search and Discovery</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Thu, 16 Jul 2026 08:30:54 +0000</pubDate>
      <link>https://dev.to/valerykot/the-difference-between-search-and-discovery-30of</link>
      <guid>https://dev.to/valerykot/the-difference-between-search-and-discovery-30of</guid>
      <description>&lt;p&gt;&lt;em&gt;Sometimes the answer isn't missing. It's just scattered.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;A few weeks ago I caught myself doing something I suspect every engineer has done.&lt;/p&gt;

&lt;p&gt;I had five browser tabs open.&lt;/p&gt;

&lt;p&gt;An ADR.&lt;/p&gt;

&lt;p&gt;A Jira ticket.&lt;/p&gt;

&lt;p&gt;A Slack thread.&lt;/p&gt;

&lt;p&gt;A runbook.&lt;/p&gt;

&lt;p&gt;A configuration file.&lt;/p&gt;

&lt;p&gt;All of them were about the same problem.&lt;/p&gt;

&lt;p&gt;None of them answered my question.&lt;/p&gt;

&lt;p&gt;Only after reading all five did the picture become clear.&lt;/p&gt;

&lt;p&gt;That was the moment I realized I wasn't searching anymore.&lt;/p&gt;

&lt;p&gt;I was reconstructing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Search wasn't failing
&lt;/h2&gt;

&lt;p&gt;The question itself was simple.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why does service X bypass the API gateway checks?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Search behaved exactly as it should.&lt;/p&gt;

&lt;p&gt;It found the ADR describing the gateway.&lt;/p&gt;

&lt;p&gt;It found the runbook explaining how to restart it.&lt;/p&gt;

&lt;p&gt;It found a Jira issue mentioning service X.&lt;/p&gt;

&lt;p&gt;It found a Slack discussion where someone wrote:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"We'll keep the old behavior for now."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every result was relevant.&lt;/p&gt;

&lt;p&gt;None of them explained &lt;em&gt;why&lt;/em&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The explanation wasn't inside a document
&lt;/h2&gt;

&lt;p&gt;Eventually the story emerged.&lt;/p&gt;

&lt;p&gt;Months earlier, a security review introduced a new authentication header for internal services.&lt;/p&gt;

&lt;p&gt;Most services were updated.&lt;/p&gt;

&lt;p&gt;One legacy service wasn't.&lt;/p&gt;

&lt;p&gt;A temporary exception was added so production wouldn't break.&lt;/p&gt;

&lt;p&gt;Nobody ever documented that exception as a decision.&lt;/p&gt;

&lt;p&gt;It survived as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a commit message,&lt;/li&gt;
&lt;li&gt;a Slack discussion,&lt;/li&gt;
&lt;li&gt;one line of gateway configuration,&lt;/li&gt;
&lt;li&gt;and a Jira ticket that treated the symptom instead of the reason.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nothing was hidden.&lt;/p&gt;

&lt;p&gt;Nothing was lost.&lt;/p&gt;

&lt;p&gt;The explanation simply never existed in one place.&lt;/p&gt;




&lt;h2&gt;
  
  
  That's the difference
&lt;/h2&gt;

&lt;p&gt;I've started thinking about search and discovery as two different activities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Search retrieves artifacts.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Discovery reconstructs explanations.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Search answers questions like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Where is the API documentation?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Discovery answers questions like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Why does the system behave this way?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Those look similar.&lt;/p&gt;

&lt;p&gt;In practice they're completely different.&lt;/p&gt;




&lt;h2&gt;
  
  
  Documents aren't the unit of knowledge
&lt;/h2&gt;

&lt;p&gt;One assumption quietly sits underneath most retrieval systems.&lt;/p&gt;

&lt;p&gt;The answer is expected to exist inside one document.&lt;/p&gt;

&lt;p&gt;Similarity is computed.&lt;/p&gt;

&lt;p&gt;Documents are ranked.&lt;/p&gt;

&lt;p&gt;Top-&lt;em&gt;k&lt;/em&gt; is returned.&lt;/p&gt;

&lt;p&gt;This works remarkably well for factual lookup.&lt;/p&gt;

&lt;p&gt;It works much less well for organizational memory.&lt;/p&gt;

&lt;p&gt;Because organizations rarely write important decisions in one place.&lt;/p&gt;

&lt;p&gt;A design review produces one document.&lt;/p&gt;

&lt;p&gt;The implementation produces another.&lt;/p&gt;

&lt;p&gt;Operations write a runbook.&lt;/p&gt;

&lt;p&gt;Someone explains an exception in Slack.&lt;/p&gt;

&lt;p&gt;Months later, all four are technically correct.&lt;/p&gt;

&lt;p&gt;None tells the whole story.&lt;/p&gt;




&lt;h2&gt;
  
  
  Relationships carry meaning
&lt;/h2&gt;

&lt;p&gt;What connects those documents is often more important than the documents themselves.&lt;/p&gt;

&lt;p&gt;The Slack thread explains the motivation.&lt;/p&gt;

&lt;p&gt;The ADR explains the architecture.&lt;/p&gt;

&lt;p&gt;The commit explains the implementation.&lt;/p&gt;

&lt;p&gt;The runbook explains the consequence.&lt;/p&gt;

&lt;p&gt;Individually they're incomplete.&lt;/p&gt;

&lt;p&gt;Together they form an explanation.&lt;/p&gt;

&lt;p&gt;That's why I've become increasingly skeptical of measuring retrieval quality only by whether it returned the "right document."&lt;/p&gt;

&lt;p&gt;Sometimes there isn't one.&lt;/p&gt;

&lt;p&gt;Sometimes the answer is the relationship between several documents.&lt;/p&gt;




&lt;h2&gt;
  
  
  What changed for me
&lt;/h2&gt;

&lt;p&gt;I stopped asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Which document contains the answer?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I started asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Which documents explain the answer together?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That small shift changed how I think about retrieval.&lt;/p&gt;

&lt;p&gt;Not because search became less useful.&lt;/p&gt;

&lt;p&gt;But because I realized search is often only the first step.&lt;/p&gt;

&lt;p&gt;Discovery begins after the search results appear.&lt;/p&gt;




&lt;p&gt;Organizations rarely lose documents.&lt;/p&gt;

&lt;p&gt;More often, they lose the connections between them.&lt;/p&gt;

&lt;p&gt;And once those connections disappear, every document can still be found—while the explanation quietly becomes impossible to retrieve.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next time I'd like to explore another pattern I've seen repeatedly: why organizations can forget something even when nothing has been deleted.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>rag</category>
      <category>engineering</category>
    </item>
    <item>
      <title>Documents Aren't Bags of Chunks</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Sun, 12 Jul 2026 20:30:41 +0000</pubDate>
      <link>https://dev.to/valerykot/documents-arent-bags-of-chunks-3cha</link>
      <guid>https://dev.to/valerykot/documents-arent-bags-of-chunks-3cha</guid>
      <description>&lt;h2&gt;
  
  
  &lt;em&gt;One thing kept bothering me about retrieval systems: they often destroy the document before trying to understand it.&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;Imagine taking a technical specification and cutting it with scissors every five hundred words.&lt;/p&gt;

&lt;p&gt;No attention to headings.&lt;/p&gt;

&lt;p&gt;No respect for sections.&lt;/p&gt;

&lt;p&gt;No care for where a thought begins and ends.&lt;/p&gt;

&lt;p&gt;Just cut.&lt;/p&gt;

&lt;p&gt;Stack.&lt;/p&gt;

&lt;p&gt;Index.&lt;/p&gt;

&lt;p&gt;That sounds absurd.&lt;/p&gt;

&lt;p&gt;Yet this is remarkably close to what many retrieval pipelines do before a document ever reaches a vector database.&lt;/p&gt;




&lt;h2&gt;
  
  
  We're asking the wrong question
&lt;/h2&gt;

&lt;p&gt;One of the most common discussions around RAG sounds like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;What's the optimal chunk size?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;256 tokens?&lt;/p&gt;

&lt;p&gt;512?&lt;/p&gt;

&lt;p&gt;Should chunks overlap?&lt;/p&gt;

&lt;p&gt;After watching enough retrieval failures, I started thinking this isn't the right question.&lt;/p&gt;

&lt;p&gt;The real question isn't &lt;strong&gt;where&lt;/strong&gt; to split a document.&lt;/p&gt;

&lt;p&gt;It's &lt;strong&gt;whether every document should be split the same way at all.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Imagine this document
&lt;/h2&gt;

&lt;p&gt;Suppose you have a technical specification called &lt;strong&gt;"Rate Limiting Strategy."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It contains four sections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why rate limiting exists&lt;/li&gt;
&lt;li&gt;How the algorithm works&lt;/li&gt;
&lt;li&gt;A code example&lt;/li&gt;
&lt;li&gt;Exceptions and edge cases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now index it using fixed-size chunks.&lt;/p&gt;

&lt;p&gt;The heading lands in one chunk.&lt;/p&gt;

&lt;p&gt;The code example ends up in another.&lt;/p&gt;

&lt;p&gt;The explanation of edge cases becomes a third.&lt;/p&gt;

&lt;p&gt;Each chunk receives its own embedding.&lt;/p&gt;

&lt;p&gt;Each becomes an independent point in vector space.&lt;/p&gt;

&lt;p&gt;The text survives.&lt;/p&gt;

&lt;p&gt;The document, as a coherent unit of meaning, does not.&lt;/p&gt;




&lt;h2&gt;
  
  
  Retrieval works perfectly
&lt;/h2&gt;

&lt;p&gt;Now someone asks:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"What happens when a user hits the rate limit?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The retriever returns the chunk containing the code.&lt;/p&gt;

&lt;p&gt;From its perspective, everything worked.&lt;/p&gt;

&lt;p&gt;The identifiers match.&lt;/p&gt;

&lt;p&gt;The embeddings are close.&lt;/p&gt;

&lt;p&gt;The similarity score is high.&lt;/p&gt;

&lt;p&gt;But something important has disappeared.&lt;/p&gt;

&lt;p&gt;The heading explaining &lt;em&gt;what&lt;/em&gt; this code belongs to is somewhere else.&lt;/p&gt;

&lt;p&gt;The paragraph explaining &lt;em&gt;why&lt;/em&gt; the algorithm behaves this way is somewhere else.&lt;/p&gt;

&lt;p&gt;The exceptions are somewhere else.&lt;/p&gt;

&lt;p&gt;The model receives valid code—but stripped of the reasoning that made the code meaningful.&lt;/p&gt;

&lt;p&gt;It can explain &lt;strong&gt;what&lt;/strong&gt; the function does.&lt;/p&gt;

&lt;p&gt;It cannot explain &lt;strong&gt;why&lt;/strong&gt; the system behaves that way.&lt;/p&gt;




&lt;h2&gt;
  
  
  Structure is semantics
&lt;/h2&gt;

&lt;p&gt;It's easy to think of document structure as presentation.&lt;/p&gt;

&lt;p&gt;I don't.&lt;/p&gt;

&lt;p&gt;A heading tells the reader:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Everything below belongs to the same idea.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A section boundary says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;This thought ends here.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A list says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;These items should be understood together.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Those aren't visual decorations.&lt;/p&gt;

&lt;p&gt;They're part of the information itself.&lt;/p&gt;

&lt;p&gt;When those signals disappear during indexing, retrieval loses something that humans almost never notice consciously—but rely on constantly while reading.&lt;/p&gt;




&lt;h2&gt;
  
  
  Meaning doesn't have a fixed size
&lt;/h2&gt;

&lt;p&gt;Eventually I stopped asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How should I split this document?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Instead I started asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What is the smallest unit that still makes sense on its own?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sometimes that's a paragraph.&lt;/p&gt;

&lt;p&gt;Sometimes it's an entire section.&lt;/p&gt;

&lt;p&gt;Sometimes it's a code block together with the explanation above it.&lt;/p&gt;

&lt;p&gt;Sometimes it's a diagram and its caption.&lt;/p&gt;

&lt;p&gt;An architecture decision record often makes sense only when the decision, its rationale, and its consequences stay together.&lt;/p&gt;

&lt;p&gt;An API reference is easier to understand when an endpoint remains connected to its parameters and examples.&lt;/p&gt;

&lt;p&gt;Meeting notes become much more useful when decisions stay attached to owners and action items.&lt;/p&gt;

&lt;p&gt;The right boundary isn't a character count.&lt;/p&gt;

&lt;p&gt;It's a logical boundary.&lt;/p&gt;




&lt;h2&gt;
  
  
  Retrieval found something. Understanding failed.
&lt;/h2&gt;

&lt;p&gt;One pattern kept repeating itself.&lt;/p&gt;

&lt;p&gt;The retrieval engine successfully found text related to the question.&lt;/p&gt;

&lt;p&gt;The model confidently explained that text.&lt;/p&gt;

&lt;p&gt;And yet the actual answer was still missing.&lt;/p&gt;

&lt;p&gt;Not because retrieval failed.&lt;/p&gt;

&lt;p&gt;Because the document had already been dismantled before retrieval even began.&lt;/p&gt;




&lt;h2&gt;
  
  
  A document is an argument
&lt;/h2&gt;

&lt;p&gt;I've gradually stopped thinking of documents as long strings of text.&lt;/p&gt;

&lt;p&gt;They're closer to arguments.&lt;/p&gt;

&lt;p&gt;Someone deliberately grouped ideas together.&lt;/p&gt;

&lt;p&gt;Separated topics.&lt;/p&gt;

&lt;p&gt;Added headings.&lt;/p&gt;

&lt;p&gt;Built a flow of reasoning.&lt;/p&gt;

&lt;p&gt;That structure carries meaning every bit as much as the words themselves.&lt;/p&gt;

&lt;p&gt;If I break that structure into arbitrary pieces before indexing it, I shouldn't expect a retrieval engine—or an LLM—to reconstruct it perfectly later.&lt;/p&gt;




&lt;p&gt;A document isn't a sequence of tokens.&lt;/p&gt;

&lt;p&gt;It's an argument made visible.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next time I want to explore a different question: why finding a document isn't the same thing as discovering knowledge.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>programming</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Bigger Context Windows Didn't Make Our RAG Smarter</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Wed, 08 Jul 2026 10:23:41 +0000</pubDate>
      <link>https://dev.to/valerykot/bigger-context-windows-didnt-make-our-rag-smarter-4d0l</link>
      <guid>https://dev.to/valerykot/bigger-context-windows-didnt-make-our-rag-smarter-4d0l</guid>
      <description>&lt;p&gt;&lt;em&gt;We stopped measuring retrieval quality by how many tokens we could fit into the prompt.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When long-context models became available, many of us made the same assumption.&lt;/p&gt;

&lt;p&gt;If an LLM can read 128K tokens, retrieval suddenly feels less important. Why spend time carefully selecting documents if the model can simply read everything?&lt;/p&gt;

&lt;p&gt;It sounds reasonable.&lt;/p&gt;

&lt;p&gt;In practice, it wasn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  More context, worse answers
&lt;/h2&gt;

&lt;p&gt;Imagine asking your internal assistant:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why did we abandon microservices?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Retrieval returns thirty documents.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an architecture decision record&lt;/li&gt;
&lt;li&gt;a few Jira tickets&lt;/li&gt;
&lt;li&gt;Slack discussions&lt;/li&gt;
&lt;li&gt;meeting notes&lt;/li&gt;
&lt;li&gt;a glossary page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything is related.&lt;/p&gt;

&lt;p&gt;Almost nothing answers the question.&lt;/p&gt;

&lt;p&gt;The actual decision lives in a single ADR written months earlier. It explains the trade-offs: team size, latency, deployment complexity, operational cost.&lt;/p&gt;

&lt;p&gt;But that document isn't especially similar to the query. It doesn't repeat the same vocabulary. It doesn't even mention "microservices" very often.&lt;/p&gt;

&lt;p&gt;So it gets buried.&lt;/p&gt;

&lt;p&gt;The model now receives thirty relevant documents and does what language models are very good at: it produces a coherent explanation.&lt;/p&gt;

&lt;p&gt;The problem is that coherence is not the same thing as faithfulness.&lt;/p&gt;

&lt;p&gt;Instead of recovering the original decision, it often synthesizes one from recurring themes across the retrieved documents.&lt;/p&gt;

&lt;p&gt;The answer sounds plausible.&lt;/p&gt;

&lt;p&gt;It just isn't the answer that was originally made.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bigger windows don't fix retrieval
&lt;/h2&gt;

&lt;p&gt;Research has already shown that models struggle with information buried inside very long contexts. The &lt;em&gt;Lost in the Middle&lt;/em&gt; paper is probably the best-known example.&lt;/p&gt;

&lt;p&gt;Our experience suggested something slightly different.&lt;/p&gt;

&lt;p&gt;Sometimes the answer isn't lost because the context is long.&lt;/p&gt;

&lt;p&gt;It's lost because the retrieval stage couldn't distinguish &lt;em&gt;the document that contains the decision&lt;/em&gt; from &lt;em&gt;documents that merely discuss the same topic&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Adding more context doesn't necessarily solve that problem.&lt;/p&gt;

&lt;p&gt;Sometimes it simply gives the model more material to average together.&lt;/p&gt;

&lt;h2&gt;
  
  
  We were optimizing the wrong thing
&lt;/h2&gt;

&lt;p&gt;For a while we treated retrieval as a packing exercise.&lt;/p&gt;

&lt;p&gt;How many useful chunks can we fit into the prompt?&lt;/p&gt;

&lt;p&gt;Over time the question changed.&lt;/p&gt;

&lt;p&gt;Why is this document here?&lt;/p&gt;

&lt;p&gt;Should it be here at all?&lt;/p&gt;

&lt;p&gt;Does it explain the decision, or does it merely mention the same technology?&lt;/p&gt;

&lt;p&gt;Those questions turned out to matter much more than the size of the context window.&lt;/p&gt;

&lt;h2&gt;
  
  
  Retrieval is a selection problem
&lt;/h2&gt;

&lt;p&gt;The biggest shift wasn't moving from 8K to 128K tokens.&lt;/p&gt;

&lt;p&gt;It was realizing that retrieval isn't about fitting more information into a prompt.&lt;/p&gt;

&lt;p&gt;It's about selecting the few pieces of information that actually explain the answer.&lt;/p&gt;

&lt;p&gt;Large context windows are incredibly useful.&lt;/p&gt;

&lt;p&gt;They just don't compensate for weak retrieval.&lt;/p&gt;

&lt;p&gt;If anything, they make weak retrieval look convincing.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next time I'll look at another assumption I no longer believe: that documents should be treated as bags of chunks.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>rag</category>
    </item>
    <item>
      <title>Why RAG Finds Documents but Still Misses the Answer</title>
      <dc:creator>ValeryKot</dc:creator>
      <pubDate>Mon, 06 Jul 2026 10:22:20 +0000</pubDate>
      <link>https://dev.to/valerykot/why-rag-finds-documents-but-still-misses-the-answer-4jjl</link>
      <guid>https://dev.to/valerykot/why-rag-finds-documents-but-still-misses-the-answer-4jjl</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F29jch57m9kjd0w6mwmq0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F29jch57m9kjd0w6mwmq0.jpg" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;After building and evaluating dozens of retrieval systems, I stopped thinking retrieval was the real problem.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Over the last couple of years I've spent a lot of time building and evaluating RAG systems.&lt;/p&gt;

&lt;p&gt;Some were quick prototypes.&lt;/p&gt;

&lt;p&gt;Some powered internal knowledge bases.&lt;/p&gt;

&lt;p&gt;Some eventually became parts of products.&lt;/p&gt;

&lt;p&gt;And I kept seeing the same pattern.&lt;/p&gt;

&lt;p&gt;A user would ask a perfectly reasonable question.&lt;/p&gt;

&lt;p&gt;The search would work.&lt;/p&gt;

&lt;p&gt;The LLM would answer confidently.&lt;/p&gt;

&lt;p&gt;And the answer would still be wrong.&lt;/p&gt;

&lt;p&gt;Not because the model hallucinated.&lt;/p&gt;

&lt;p&gt;Not because embeddings were bad.&lt;/p&gt;

&lt;p&gt;Not because vector search failed.&lt;/p&gt;

&lt;p&gt;The system had simply retrieved the wrong kind of information.&lt;/p&gt;

&lt;h2&gt;
  
  
  A question every RAG system should answer
&lt;/h2&gt;

&lt;p&gt;Imagine a company with a thousand engineering documents.&lt;/p&gt;

&lt;p&gt;Architecture decisions.&lt;/p&gt;

&lt;p&gt;Meeting notes.&lt;/p&gt;

&lt;p&gt;RFCs.&lt;/p&gt;

&lt;p&gt;Runbooks.&lt;/p&gt;

&lt;p&gt;ADRs.&lt;/p&gt;

&lt;p&gt;Internal documentation.&lt;/p&gt;

&lt;p&gt;Now someone asks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why did we choose Kafka over RabbitMQ?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A typical RAG pipeline looks like this:&lt;/p&gt;

&lt;p&gt;Documents&lt;br&gt;
    ↓&lt;br&gt;
Chunking&lt;br&gt;
    ↓&lt;br&gt;
Embeddings&lt;br&gt;
    ↓&lt;br&gt;
Vector Database&lt;br&gt;
    ↓&lt;br&gt;
Top-K Retrieval&lt;br&gt;
    ↓&lt;br&gt;
LLM&lt;/p&gt;

&lt;p&gt;Everything seems reasonable.&lt;/p&gt;

&lt;p&gt;The question becomes an embedding.&lt;/p&gt;

&lt;p&gt;The nearest chunks are retrieved.&lt;/p&gt;

&lt;p&gt;The chunks are added to the prompt.&lt;/p&gt;

&lt;p&gt;The LLM generates an answer.&lt;/p&gt;

&lt;p&gt;Simple.&lt;/p&gt;

&lt;p&gt;Except this is often where things start going wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Semantic similarity isn't the same as relevance
&lt;/h2&gt;

&lt;p&gt;Suppose your knowledge base contains fifteen documents about Kafka.&lt;/p&gt;

&lt;p&gt;Architecture guides.&lt;/p&gt;

&lt;p&gt;Broker configuration.&lt;/p&gt;

&lt;p&gt;Monitoring.&lt;/p&gt;

&lt;p&gt;Deployment.&lt;/p&gt;

&lt;p&gt;Developer documentation.&lt;/p&gt;

&lt;p&gt;Vector search will happily retrieve them.&lt;/p&gt;

&lt;p&gt;And technically, it's correct.&lt;/p&gt;

&lt;p&gt;They are semantically close to the question.&lt;/p&gt;

&lt;p&gt;But none of them explain why Kafka was chosen.&lt;/p&gt;

&lt;p&gt;The actual answer might live inside a two-page Architecture Decision Record written eighteen months earlier.&lt;/p&gt;

&lt;p&gt;That document mostly discusses RabbitMQ, latency, throughput, operational complexity, and load testing.&lt;/p&gt;

&lt;p&gt;The word Kafka barely appears.&lt;/p&gt;

&lt;p&gt;From the perspective of embeddings, it isn't particularly similar.&lt;/p&gt;

&lt;p&gt;From the perspective of an engineer, it's exactly the document you needed.&lt;/p&gt;

&lt;p&gt;That's the disconnect.&lt;/p&gt;

&lt;p&gt;Search found similar documents.&lt;/p&gt;

&lt;p&gt;It didn't find the decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Then we start optimizing
&lt;/h2&gt;

&lt;p&gt;Once teams notice retrieval isn't great, the usual optimization cycle begins.&lt;/p&gt;

&lt;p&gt;First we reduce Top-K.&lt;/p&gt;

&lt;p&gt;Instead of retrieving 100 chunks, we retrieve 10.&lt;/p&gt;

&lt;p&gt;Then we shrink chunk sizes.&lt;/p&gt;

&lt;p&gt;500 tokens become 250.&lt;/p&gt;

&lt;p&gt;250 become 150.&lt;/p&gt;

&lt;p&gt;Then we add rerankers.&lt;/p&gt;

&lt;p&gt;Cross-encoders.&lt;/p&gt;

&lt;p&gt;Hybrid retrieval.&lt;/p&gt;

&lt;p&gt;Bigger context windows.&lt;/p&gt;

&lt;p&gt;I tried all of these.&lt;/p&gt;

&lt;p&gt;Most of them help.&lt;/p&gt;

&lt;p&gt;None of them completely solve the problem.&lt;/p&gt;

&lt;p&gt;Because they're still optimizing retrieval inside the same mental model.&lt;/p&gt;

&lt;h2&gt;
  
  
  The document slowly disappears
&lt;/h2&gt;

&lt;p&gt;One thing surprised me more than anything else.&lt;/p&gt;

&lt;p&gt;The smaller our chunks became, the less context survived.&lt;/p&gt;

&lt;p&gt;Eventually the system remembered paragraphs.&lt;/p&gt;

&lt;p&gt;But forgot the document.&lt;/p&gt;

&lt;p&gt;Headings disappeared.&lt;/p&gt;

&lt;p&gt;Structure disappeared.&lt;/p&gt;

&lt;p&gt;Arguments disappeared.&lt;/p&gt;

&lt;p&gt;What remained was a collection of isolated text fragments.&lt;/p&gt;

&lt;p&gt;I started calling this chunk amnesia.&lt;/p&gt;

&lt;p&gt;It's not a scientific term.&lt;/p&gt;

&lt;p&gt;Just a name for something I kept observing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Humans don't search that way
&lt;/h2&gt;

&lt;p&gt;This is where my thinking changed.&lt;/p&gt;

&lt;p&gt;When I need information, I don't start by looking for a paragraph.&lt;/p&gt;

&lt;p&gt;I usually ask myself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which document was this?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What decision did we make?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only after that do I look for implementation details.&lt;/p&gt;

&lt;p&gt;It's almost hierarchical.&lt;/p&gt;

&lt;p&gt;Document&lt;br&gt;
    ↓&lt;br&gt;
Decision&lt;br&gt;
    ↓&lt;br&gt;
Evidence&lt;br&gt;
    ↓&lt;br&gt;
Implementation&lt;/p&gt;

&lt;p&gt;Most RAG systems reverse that process.&lt;/p&gt;

&lt;p&gt;They search for paragraphs first and hope context reconstructs itself.&lt;/p&gt;

&lt;p&gt;Sometimes it does.&lt;/p&gt;

&lt;p&gt;Often it doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bigger context windows don't fix this
&lt;/h2&gt;

&lt;p&gt;A common reaction is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Let's just send more context."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I don't think that's the answer either.&lt;/p&gt;

&lt;p&gt;A 64K context window can hold far more text.&lt;/p&gt;

&lt;p&gt;It doesn't magically restore structure.&lt;/p&gt;

&lt;p&gt;The model still receives disconnected fragments.&lt;/p&gt;

&lt;p&gt;More fragments don't automatically become a coherent narrative.&lt;/p&gt;

&lt;p&gt;Large prompts reduce one bottleneck.&lt;/p&gt;

&lt;p&gt;They don't eliminate the retrieval problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed my thinking
&lt;/h2&gt;

&lt;p&gt;Eventually I stopped thinking of retrieval as a single search problem.&lt;/p&gt;

&lt;p&gt;Instead, I started thinking about navigation across multiple levels of abstraction.&lt;/p&gt;

&lt;p&gt;Before asking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which paragraph matters?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I first wanted to answer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which document matters?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which decisions inside that document matter?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only then should retrieval dive into individual chunks.&lt;/p&gt;

&lt;p&gt;That's also how people naturally explore documentation.&lt;/p&gt;

&lt;p&gt;We rarely jump directly into paragraph number seventeen.&lt;/p&gt;

&lt;p&gt;We skim.&lt;/p&gt;

&lt;p&gt;We orient ourselves.&lt;/p&gt;

&lt;p&gt;Then we zoom in.&lt;/p&gt;

&lt;h2&gt;
  
  
  This isn't just an LLM problem
&lt;/h2&gt;

&lt;p&gt;After a while I realized this discussion isn't really about language models.&lt;/p&gt;

&lt;p&gt;It's about organizational memory.&lt;/p&gt;

&lt;p&gt;Companies rarely lose information because documents disappear.&lt;/p&gt;

&lt;p&gt;They lose the relationships between documents.&lt;/p&gt;

&lt;p&gt;The ADR exists.&lt;/p&gt;

&lt;p&gt;The meeting notes exist.&lt;/p&gt;

&lt;p&gt;The design proposal exists.&lt;/p&gt;

&lt;p&gt;The Slack discussion exists.&lt;/p&gt;

&lt;p&gt;But the connections slowly fade.&lt;/p&gt;

&lt;p&gt;Search retrieves text.&lt;/p&gt;

&lt;p&gt;People are trying to recover context.&lt;/p&gt;

&lt;p&gt;Those aren't always the same problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  I'm still exploring this
&lt;/h2&gt;

&lt;p&gt;I don't have a universal solution.&lt;/p&gt;

&lt;p&gt;In fact, this realization is one of the reasons I started building Retineo.&lt;/p&gt;

&lt;p&gt;Not because I thought I had the answer.&lt;/p&gt;

&lt;p&gt;Because I couldn't find a system that treated organizational knowledge as something richer than independent chunks inside a vector database.&lt;/p&gt;

&lt;p&gt;Maybe the answer isn't hierarchical retrieval.&lt;/p&gt;

&lt;p&gt;Maybe it's something else entirely.&lt;/p&gt;

&lt;p&gt;I'm still experimenting.&lt;/p&gt;

&lt;h2&gt;
  
  
  I'd love to hear your experience
&lt;/h2&gt;

&lt;p&gt;If you've built RAG systems at scale, what's the failure mode you've seen most often?&lt;/p&gt;

&lt;p&gt;For me, it isn't hallucination.&lt;/p&gt;

&lt;p&gt;It's this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The documents aren't missing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The relationships between them are.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Discussion
&lt;/h2&gt;

&lt;p&gt;Have you encountered similar problems?&lt;/p&gt;

&lt;p&gt;Did hierarchical retrieval, knowledge graphs, rerankers, or another approach help?&lt;/p&gt;

&lt;p&gt;I'm genuinely interested in how others are tackling this.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>machinelearning</category>
      <category>knowledgemanagement</category>
    </item>
  </channel>
</rss>
