Engineering • July 15, 2026

We Rebuilt Our Retrieval Pipeline Three Times. Here is What Actually Worked.

After auditing thousands of failed RAG queries, we threw out the standard tutorials. A detailed breakdown of parent-child overlaps and semantic node splitting.

By ShashankFounder, trained.chat

We thought our search engine was solid. Then a SaaS customer uploaded a 400-row table PDF, and the agent completely choked. We rebuilt our retrieval core three times in three weeks to fix it.

37%
Recall failure rate

of standard token splitters when customer queries hit formatted table layouts.

94.2%
Grounding Recall Accuracy

achieved after rolling out parent-child node maps across all document types.

75%
Latency reduction

dropping document search index query response times from 980ms to 240ms.

Decouple search parameters from generation context.

Most developers build their first Retrieval-Augmented Generation (RAG) system in an afternoon. You read a tutorial, load some documentation pages, run a standard sentence splitter (500 tokens, 10% overlap), upload them to a vector database, and call it a day.

This works perfectly on clean, simple test queries. But once real customers start typing fragmented search terms, using slang, or referencing tables buried deep inside PDFs, the naive RAG setup crumbles.

During the initial rollout of our document training pipeline, we watched the agent fail to answer simple questions because the matching chunk was missing crucial context from the preceding header.

Iteration 1: Naive Token Splitting (The Tutorial Way)

Our first setup divided files into standard token blocks. The problem? Key sentences were routinely sliced in half. A paragraph explaining refund criteria would have its constraints in Chunk A and its approval steps in Chunk B. The vector search would fetch Chunk B, but without Chunk A's context, the LLM hallucinated the criteria.

Grounding Note:We thought we needed a larger model to solve context reasoning. We were wrong. We simply needed to keep related sentences in the same chunk block.

Iteration 2: Recursive Paragraph & Header Preservation

We moved to structural markdown parsing. We split documents by headers (#, ##, ###) and kept list items together. This was a massive improvement, but it introduced a new issue: document size skew. A huge section would create a single giant chunk, diluting the semantic vector representation and crowding the prompt window.

Iteration 3: The Winner - Parent-Child Node Mapping

The solution that finally brought our retrieval accuracy to 94.2% was decoupling the search representation from the generation context.

We chunked documents into small, highly specific "Child" nodes (100 tokens each) for vector indexing. However, each child node references a larger "Parent" node (1000 tokens) representing the surrounding context.

// Decoupled Retrieval Pattern
{
  "child_node_id": "child-9418",
  "vector_embedding": [...],
  "search_text": "Refunds are processed within 3 business days.",
  "parent_context_ref": "parent-doc-refund-policy-section"
}

When a query hits the child node, we retrieve and feed the entire parent context block to the LLM. The search remains precise, but the generation model has full, uninterrupted context to formulate its final reply. Query latency dropped from 980ms to 240ms.

Product Release Mapping:Shipped in trained.chat v1.3

What changed in trained.chat because of this lesson?

Replaced naive token-based splitting entirely
Added recursive markdown header parsing
Deployed decoupled parent-child node mapping
Reduced search index lookup latency by 75%

"Precise search vectors belong in databases. Rich context belongs in generation prompts."

The Column