<?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 Federico Schipani on Medium]]></title>
        <description><![CDATA[Stories by Federico Schipani on Medium]]></description>
        <link>https://medium.com/@federicoschipani?source=rss-15d04d9e7a74------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*bERXWW6z2GpYj2GE</url>
            <title>Stories by Federico Schipani on Medium</title>
            <link>https://medium.com/@federicoschipani?source=rss-15d04d9e7a74------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 08:03:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@federicoschipani/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[Goodbye Vector DB: Building Smarter RAG with PageIndex]]></title>
            <link>https://medium.com/data-reply-it-datatech/goodbye-vector-db-building-smarter-rag-with-pageindex-99c160c82a97?source=rss-15d04d9e7a74------2</link>
            <guid isPermaLink="false">https://medium.com/p/99c160c82a97</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[pageindex]]></category>
            <dc:creator><![CDATA[Federico Schipani]]></dc:creator>
            <pubDate>Wed, 24 Jun 2026 08:01:01 GMT</pubDate>
            <atom:updated>2026-06-24T08:01:01.872Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yTR3yKJeBf0weUGCuSpLbg.png" /></figure><p><em>How to build a Retrieval-Augmented Generation pipeline based on reasoning — without a single vector similarity operation</em></p><p>If you’ve ever built a RAG system on professional documents — annual reports, legal contracts, academic papers, technical manuals — you’ve almost certainly run into the most frustrating limitation of the classic approach: retrieval returns the <em>semantically closest</em> chunks to the query, but not necessarily the <em>conceptually most relevant</em> ones. An embedding has no idea that the answer to “what is the main operational risk?” sits three sections after the one that talks about “risk management.” It can’t know, because <strong>similarity is not the same as relevance</strong>.</p><p>The problem compounds on long, structured documents: the document’s own index already exists — sections, subsections, chapters — but traditional RAG ignores it entirely, slicing the text into arbitrary 512- or 1024-token chunks and discarding the logical structure that makes the document comprehensible in the first place.</p><p>In this article we explore <strong>PageIndex</strong>, an open-source framework by VectifyAI that flips the paradigm entirely. No vector database, no artificial chunking, no top-k cosine similarity. Instead: a hierarchical tree structure of the document and an LLM that navigates it <em>by reasoning</em>, exactly as a human expert would when consulting a table of contents. We’ll cover how to generate the tree from the CLI, how to leverage the cloud version with advanced OCR, and we’ll build a complete, working RAG pipeline on the <em>“Attention Is All You Need”</em> paper.</p><h2>RAG in Brief: What Works, What Doesn’t</h2><p>Before talking about alternatives, a quick step back on classic RAG.</p><p>A RAG (Retrieval-Augmented Generation) system exists to bring external knowledge into an LLM’s context window at inference time, avoiding the need to stuff entire documents into every prompt. The standard flow is: the document is split into text chunks, each chunk is transformed into an embedding vector by a dedicated model (OpenAI ada, Cohere embed, etc.) and stored in a vector store (Pinecone, Weaviate, FAISS, pgvector…). When a query arrives, it gets embedded too, the nearest chunks by cosine distance are retrieved, and those chunks are passed as context to the LLM to generate the final answer.</p><p>It’s an approach that works well in many contexts: FAQs, generic knowledge bases, lightly structured technical documentation. The problems emerge when the domain requires reasoning, when answers don’t fit neatly in one chunk, or when the document’s structure is part of its meaning. A few concrete failure modes:</p><p><strong>Chunking destroys structural context.</strong> A 512-token chunk can end up mid-definition, or include the tail of one section and the opening of another. The embedding model has no idea which section that text belongs to.</p><p><strong>Similarity doesn’t capture deep semantic relevance.</strong> A query about “liquidity risk impact” might retrieve every chunk containing the words “risk” and “liquidity,” while missing the “Board of Directors Conclusions” section where that impact is discussed explicitly — but in different terminology.</p><p><strong>Traceability is limited.</strong> Knowing that “chunk number 47” was in the top-k doesn’t say much about the reliability of the retrieval. There’s no reasoning process to inspect.</p><h2>PageIndex: Retrieval as Reasoning</h2><p>PageIndex draws its core intuition from AlphaGo: instead of exhaustively searching the solution space, use a learned strategy to navigate it intelligently. Applied to documents, this translates into a two-phase system.</p><h3>Phase 1: Building the Tree Index</h3><p>PageIndex analyzes the document (via PDF parsing or Markdown) and constructs a hierarchical structure modeled on a table of contents. Each node in the tree corresponds to a natural section of the document and contains:</p><ul><li>title: the section title</li><li>node_id: a unique identifier</li><li>start_index / end_index: the page range in the original document</li><li>summary: an LLM-generated summary of the section&#39;s content</li><li>nodes: child nodes for sections with subsections</li></ul><p>The result is a JSON file that represents the logical structure of the document — not an arbitrary fragmentation of it.</p><h3>Phase 2: Reasoning-Based Tree Search</h3><p>At retrieval time, instead of computing vector similarities, the tree (minus the raw text, to keep the prompt compact) is passed to the LLM together with the query. The model reasons over which node most likely contains the answer and returns a list of node_ids. The corresponding pages are extracted from the original PDF, and that text becomes the context for generating the final answer.</p><p>This approach delivers three structural advantages over traditional RAG:</p><p><strong>No Vector DB.</strong> No embeddings to compute, no vector database infrastructure to manage. The tree structure is a portable, human-readable JSON file.</p><p><strong>No artificial chunking.</strong> Documents are organized into their natural sections. No mid-sentence cuts, no redundant overlap, no loss of document hierarchy.</p><p><strong>Explainable and verifiable retrieval.</strong> The model exposes its reasoning process (thinking) before selecting nodes. You can read <em>why</em> it chose a given section and verify that the logic is sound. Every answer is traceable to a specific section and page number.</p><p>Results on benchmarks confirm the value of the approach: PageIndex achieved <strong>98.7% accuracy on FinanceBench</strong>, a benchmark on professional financial documents, significantly outperforming vector-based RAG solutions on this type of task.</p><h2>Part 1 — Generating the Tree Structure</h2><h3>Installation</h3><pre>git clone https://github.com/VectifyAI/PageIndex.git<br>cd PageIndex<br>pip install -r requirements.txt</pre><p>To configure the LLM, set the environment variable for whichever provider you want to use:</p><pre># Anthropic<br>export ANTHROPIC_API_KEY=your_key_here<br># AWS Bedrock (uses standard AWS credentials)<br>export AWS_ACCESS_KEY_ID=...<br>export AWS_SECRET_ACCESS_KEY=...<br>export AWS_DEFAULT_REGION=eu-west-1<br># OpenAI<br>export OPENAI_API_KEY=your_key_here<br># And so on for other providers...</pre><h3>The run_pageindex.py Script</h3><p>run_pageindex.py is the main entry point for generating the tree structure from the command line. It supports both PDF and Markdown files, and is fully configurable via CLI arguments.</p><p>Basic command for a PDF:</p><pre>python3 run_pageindex.py --pdf_path data/1706.03762v7.pdf</pre><p>For a Markdown file:</p><pre>python3 run_pageindex.py --md_path docs/my_document.md</pre><p>At the end of execution, the structure is saved to results/&lt;filename&gt;_structure.json. The output is a complete JSON with the document name and the full section tree.</p><h3>Main Parameters</h3><pre>python3 run_pageindex.py \<br>  --pdf_path data/document.pdf \<br>  --model &quot;anthropic/claude-3-5-haiku-20241022&quot; \<br>  --toc-check-pages 5 \<br>  --max-pages-per-node 8 \<br>  --max-tokens-per-node 4000 \<br>  --if-add-node-summary yes \<br>  --if-add-doc-description yes \<br>  --if-add-node-id yes \<br>  --if-add-node-text no</pre><p>What each parameter does:</p><p>--model: selects the LLM used to build the index. Since PageIndex uses LiteLLM under the hood (more on this below), the format follows the provider/model-name convention.</p><p>--toc-check-pages: how many initial pages to scan for a pre-existing table of contents. If found, PageIndex uses it as a starting point. Default: 5.</p><p>--max-pages-per-node: maximum number of pages a node can contain. Lower values produce more granular trees — more nodes, each with less content. Useful for documents with very long sections.</p><p>--max-tokens-per-node: token-based alternative to the page limit.</p><p>--if-add-node-summary: if yes, every node includes an LLM-generated summary of its content. This is critical for tree search quality: it&#39;s the summaries that the LLM reads when deciding which nodes are relevant. It increases indexing cost but significantly improves retrieval accuracy.</p><p>--if-add-doc-description: if yes, adds a top-level description of the entire document.</p><p>--if-add-node-text: if yes, the raw section text is embedded directly in the JSON. Useful if you want to avoid going back to the PDF at retrieval time, but substantially increases the file size.</p><p>For Markdown files, there are additional options: --if-thinning to compress overly deep trees, and --summary-token-threshold to control when generating a summary is worth it (very short sections don&#39;t need one).</p><h3>A Critical Detail: PageIndex Runs on LiteLLM</h3><p>One of the least obvious but most important aspects of PageIndex is that it uses <strong>LiteLLM</strong> as the abstraction layer for all LLM calls — both during tree construction and during tree search. This means you can use virtually any LiteLLM-supported model by simply changing the --model parameter and setting the relevant credentials.</p><p>The most relevant providers in enterprise contexts:</p><ul><li><strong>AWS Bedrock</strong> (Claude, Titan, Llama on AWS infrastructure)</li><li><strong>Anthropic</strong> (Claude Haiku, Sonnet, Opus)</li><li><strong>Azure OpenAI</strong> (OpenAI models on Azure)</li><li><strong>OpenAI</strong> (GPT-4o, GPT-4 Turbo, o1)</li><li><strong>OpenRouter</strong> (access to dozens of models from a single endpoint)</li><li><strong>Vertex AI</strong> (Google Gemini on GCP)</li><li><strong>Cohere, Mistral, Groq</strong>, and many others</li></ul><p>This model flexibility is critical in enterprise settings where the choice may be driven by data residency requirements (e.g. Bedrock in a European region), compliance constraints (no data leaving the corporate perimeter), cost optimization, or simply the cloud infrastructure already in use. The notebook we’ll walk through in the tutorial section, for example, uses a Claude model on Bedrock in the EU region:</p><pre>MODEL = os.getenv(&quot;PAGEINDEX_MODEL&quot;, <br>                  &quot;bedrock/eu.anthropic.claude-haiku-4-5-20251001-v1:0&quot;)</pre><p>Switching providers requires zero code changes — just the environment variable.</p><h3>The Cloud Version: Advanced OCR and Production-Grade Pipeline</h3><p>Beyond the self-hosted open-source implementation, PageIndex offers a <strong>cloud service</strong> at <a href="https://pageindex.ai/">pageindex.ai</a>, accessible via REST API or Python SDK.</p><p>The main difference compared to the local version isn’t just operational (no setup, no dependencies to manage, no infrastructure) — it’s qualitative. The cloud version integrates an <strong>advanced OCR pipeline</strong> specifically designed to preserve the document’s hierarchical structure during conversion. This solves a common problem: most PDF-to-text tools completely flatten the visual hierarchy, making it impossible to correctly reconstruct the tree.</p><p>This is particularly relevant for:</p><ul><li><strong>Scanned PDFs</strong> or complex layouts (multi-column, nested tables, mixed text and images)</li><li><strong>Financial and legal reports</strong> where visual structure — headings, subheadings, indentation — is part of the meaning</li><li><strong>Slide decks exported as PDF</strong> where each page is essentially an image</li></ul><p>With the cloud version, the workflow reduces to a few lines:</p><pre>from pageindex import PageIndexClient<br><br>client = PageIndexClient(api_key=&quot;your_api_key&quot;)<br># Upload and start processing<br>result = client.submit_document(&quot;./example.pdf&quot;)<br>doc_id = result[&quot;doc_id&quot;]<br># Poll for completion (typically seconds to a few minutes)<br>while True:<br>    status = client.get_document(doc_id)[&quot;status&quot;]<br>    if status == &quot;completed&quot;:<br>        break<br># Retrieve the generated tree<br>tree = client.get_tree(doc_id)[&quot;result&quot;]</pre><p>The cloud API also exposes a <strong>Chat API</strong> that runs the entire RAG pipeline (tree search + answer generation) in a single call, and supports <strong>MCP</strong> (Model Context Protocol) for integrating PageIndex directly with Claude Desktop, Cursor, and other compatible agents. For those who want to explore without writing code, <strong>PageIndex Chat</strong> at <a href="https://chat.pageindex.ai/">chat.pageindex.ai</a> is a ChatGPT-style platform where you can upload documents and ask questions immediately.</p><h2>Part 2 — RAG Pipeline: End-to-End Tutorial</h2><p>In this second part we build a complete RAG pipeline on <em>“Attention Is All You Need”</em> (Vaswani et al., 2017). We use the JSON structure already generated by PageIndex and implement the three fundamental steps: loading the index, reasoned tree search, and grounded answer generation.</p><h3>Step 0: Environment Setup</h3><pre>import json<br>import sys<br>import os<br>from dotenv import load_dotenv<br>load_dotenv()<br>import pageindex.utils as utils</pre><p>We define the LLM call function via LiteLLM. In this notebook we use a Claude model on Bedrock, but changing MODEL is all it takes to switch to any supported provider:</p><pre>import litellm<br>MODEL = os.getenv(&quot;PAGEINDEX_MODEL&quot;, <br>                  &quot;bedrock/eu.anthropic.claude-haiku-4-5-20251001-v1:0&quot;)<br>async def call_llm(prompt, model=MODEL, temperature=0):<br>    response = await litellm.acompletion(<br>        model=model,<br>        messages=[{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: prompt}],<br>        temperature=temperature,<br>    )<br>    return response.choices[0].message.content.strip()</pre><p>temperature=0 is important for tree search: we want deterministic, consistent outputs — not creativity.</p><h3>Step 1: Loading the Tree Structure</h3><p>Before loading the tree in code, it’s worth understanding the structure of the JSON that run_pageindex.py produces. Each node looks like this:</p><pre>{<br>  &quot;title&quot;: &quot;Multi-Head Attention&quot;,<br>  &quot;node_id&quot;: &quot;0007&quot;,<br>  &quot;start_index&quot;: 4,<br>  &quot;end_index&quot;: 5,<br>  &quot;summary&quot;: &quot;This section describes Multi-Head Attention, which runs h=8 <br>               parallel attention functions on linearly projected versions <br>               of queries, keys, and values (dk=dv=64). This allows the model <br>               to attend to information from different representation subspaces <br>               simultaneously. The concatenated outputs are projected back to <br>               the model dimension. The section also details three distinct <br>               uses: encoder-decoder attention, encoder self-attention, <br>               and masked decoder self-attention.&quot;,<br>  &quot;nodes&quot;: []<br>}</pre><p>start_index and end_index are the page numbers in the original document. These are the values that allow exact text extraction from the PDF at retrieval time, without reprocessing anything. summary is the LLM-generated summary from the indexing phase: this is what the tree search reads to reason about node relevance. nodes holds child nodes for sections with subsections — the hierarchical structure that makes PageIndex a tree, not a flat list.</p><p>The entire document structure, including all hierarchies, is contained in a single JSON file that can be loaded into memory in milliseconds, passed between services, versioned with git, and inspected in any editor. No database to query.</p><p>Now let’s load it:</p><pre>with open(&quot;results/1706.03762v7_structure.json&quot;, &quot;r&quot;) as f:<br>    doc_structure = json.load(f)<br>tree = doc_structure[&quot;structure&quot;]<br>print(&quot;Document:&quot;, doc_structure[&quot;doc_name&quot;])<br>print(&quot;\nTree Structure:&quot;)<br>utils.print_tree(tree)</pre><p>The output shows the paper’s hierarchical structure:</p><pre>Attention Is All You Need<br>├── Preface                          [pp. 1-1]<br>├── Introduction                     [pp. 2-2]<br>├── Background                       [pp. 2-3]<br>├── Model Architecture               [pp. 3-3]<br>│   ├── Encoder and Decoder Stacks   [pp. 3-3]<br>│   ├── Attention                    [pp. 3-3]<br>│   │   ├── Scaled Dot-Product       [pp. 4-4]<br>│   │   ├── Multi-Head Attention     [pp. 4-5]<br>│   │   └── Applications of Att.    [pp. 5-5]<br>│   ├── Position-wise FFN            [pp. 5-5]<br>│   ├── Embeddings and Softmax       [pp. 5-6]<br>│   └── Positional Encoding          [pp. 6-6]<br>├── Why Self-Attention               [pp. 6-7]<br>├── Training                         [pp. 7-8]<br>│   ├── Training Data and Batching   [pp. 7-7]<br>│   ├── Hardware and Schedule        [pp. 7-8]<br>│   ├── Optimizer                    [pp. 8-8]<br>│   └── Regularization               [pp. 8-8]<br>├── Results                          [pp. 8-9]<br>└── Conclusions                      [pp. 10-10]</pre><p>This structure faithfully mirrors the logical organization of the paper. Each node knows exactly which pages it corresponds to in the original document — which is what makes the subsequent retrieval precise and verifiable.</p><h3>Step 2: Reasoning-Based Retrieval with Tree Search</h3><p>Here is the core of the approach. Instead of computing the query’s embedding and searching for the nearest vectors, we pass the tree (without the raw text, to keep the prompt compact — titles and summaries are enough for reasoning) to the LLM and ask it to reason about which nodes most likely contain the answer.</p><pre>query = &quot;How does the multi-head attention mechanism work in the Transformer?&quot;<br><br># Remove text fields to keep the prompt compact<br>tree_without_text = utils.remove_fields(tree.copy(), fields=[&quot;text&quot;])<br><br>search_prompt = f&quot;&quot;&quot;<br>You are given a question and a tree structure of a document.<br>Each node contains a node id, node title, and a corresponding summary.<br>Your task is to find all nodes that are likely to contain the answer <br>to the question.<br>Question: {query}<br>Document tree structure:<br>{json.dumps(tree_without_text, indent=2)}<br>Please reply in the following JSON format:<br>{{<br>    &quot;thinking&quot;: &quot;&lt;Your thinking process on which nodes are relevant&gt;&quot;,<br>    &quot;node_list&quot;: [&quot;node_id_1&quot;, &quot;node_id_2&quot;, ..., &quot;node_id_n&quot;]<br>}}<br>Directly return the final JSON structure. Do not output anything else.<br>&quot;&quot;&quot;<br><br>tree_search_result = await call_llm(search_prompt)<br>print(tree_search_result)</pre><p>The model responds with a JSON object that includes its explicit reasoning process (thinking) and the list of relevant nodes:</p><pre>{<br>  &quot;thinking&quot;: &quot;The question asks specifically about the multi-head attention <br>               mechanism in the Transformer. Looking at the tree structure, <br>               I can identify several highly relevant nodes: <br>               - &#39;Multi-Head Attention&#39; (node 0007, pp. 4-5) is directly <br>                 on topic and covers the mechanism in detail.<br>               - &#39;Scaled Dot-Product Attention&#39; (node 0006, pp. 4-4) provides <br>                 the mathematical foundation that multi-head attention builds on.<br>               - &#39;Applications of Attention in our Model&#39; (node 0008, pp. 5-5) <br>                 explains the three distinct uses in the Transformer.<br>               These three nodes together give a complete picture.&quot;,<br>  &quot;node_list&quot;: [&quot;0006&quot;, &quot;0007&quot;, &quot;0008&quot;]<br>}</pre><p>This is one of the most interesting aspects of PageIndex compared to traditional RAG: <strong>retrieval is not a black box</strong>. The model exposes its reasoning, and you can read exactly why it chose those nodes. In a production context, this makes debugging and error analysis dramatically easier.</p><p>Let’s map the retrieved nodes to their document sections:</p><pre>node_map = utils.create_node_mapping(tree)<br># Strip markdown code fences if present<br>clean_result = tree_search_result.strip()<br>if clean_result.startswith(&quot;```&quot;):<br>    clean_result = clean_result.split(&quot;\n&quot;, 1)[1]<br>    clean_result = clean_result.rsplit(&quot;```&quot;, 1)[0]<br>result_json = json.loads(clean_result)<br>print(&quot;Reasoning Process:&quot;)<br>utils.print_wrapped(result_json[&quot;thinking&quot;])<br>print(&quot;\nRetrieved Nodes:&quot;)<br>for node_id in result_json[&quot;node_list&quot;]:<br>    node = node_map[node_id]<br>    print(f&quot;  Node ID: {node[&#39;node_id&#39;]}\t&quot;<br>          f&quot;Pages: {node[&#39;start_index&#39;]}-{node[&#39;end_index&#39;]}\t&quot;<br>          f&quot;Title: {node[&#39;title&#39;]}&quot;)</pre><p>Output:</p><pre>Retrieved Nodes:<br>  Node ID: 0006    Pages: 4-4    Title: Scaled Dot-Product Attention<br>  Node ID: 0007    Pages: 4-5    Title: Multi-Head Attention<br>  Node ID: 0008    Pages: 5-5    Title: Applications of Attention in our Model</pre><p>Three nodes, three specific sections of the paper, with exact page references. Zero ambiguity about what was retrieved and from where.</p><h3>Step 3: Text Extraction and Answer Generation</h3><p>With the nodes identified, we extract the text of the corresponding pages directly from the original PDF. PageIndex uses the page indices stored in the JSON to access exactly the relevant content — no need to reprocess the whole document:</p><pre>node_list = result_json[&quot;node_list&quot;]<br>relevant_content = &quot;&quot;<br>for node_id in node_list:<br>    node = node_map[node_id]<br>    start_page = node[&quot;start_index&quot;]<br>    end_page = node[&quot;end_index&quot;]<br>    <br>    text = utils.get_text_of_pages(<br>        &quot;data/1706.03762v7.pdf&quot;, <br>        start_page, <br>        end_page, <br>        tag=False<br>    )<br>    <br>    relevant_content += (<br>        f&quot;\n\n--- [{node[&#39;title&#39;]}] (pages {start_page}-{end_page}) ---\n&quot;<br>        f&quot;{text}&quot;<br>    )<br>print(&quot;Retrieved Context (first 1000 chars):&quot;)<br>utils.print_wrapped(relevant_content[:1000] + &quot;...&quot;)</pre><p>The extracted text is the actual content of pages 4 and 5 of the paper — the exact pages where Vaswani et al. describe the multi-head attention architecture. Not fragmented chunks from an arbitrary splitting process: complete sections, with all the context needed to answer the question.</p><p>Finally, we build the answer prompt and generate the final response:</p><pre>answer_prompt = f&quot;&quot;&quot;<br>Answer the question based on the context:<br>Question: {query}<br>Context: {relevant_content}<br>Provide a clear, concise answer based only on the context provided.<br>&quot;&quot;&quot;<br>print(&quot;Generated Answer:\n&quot;)<br>answer = await call_llm(answer_prompt)<br>utils.print_wrapped(answer)<br></pre><p>The generated answer is precise, grounded in the original text, and fully verifiable: anyone who wants to check the source can go directly to pages 4–5 of the paper, sections “Scaled Dot-Product Attention”, “Multi-Head Attention”, and “Applications of Attention”.</p><h2>Final Thoughts</h2><p>PageIndex represents a genuine paradigm shift in RAG for structured documents. Moving away from vector similarity toward reasoning over the document’s own index isn’t just a technical optimization — it’s a conceptual shift that brings retrieval closer to how a human expert actually navigates a complex document: checking the table of contents, identifying the right section, and reading it.</p><h3>When to Use It</h3><p>The framework excels in the scenarios where classic RAG struggles most: financial document analysis (balance sheets, prospectuses, annual reports), legal research (contracts, rulings, regulations), scientific paper review with deep structures, and technical documentation with many cross-section dependencies. In these contexts, the ability to reason about document structure — not just word similarity — makes a substantial difference in retrieval quality.</p><p>PageIndex works on simpler cases too, but the cost-benefit ratio compared to a vector RAG is less compelling: for FAQs and generic knowledge bases, a standard embedding approach remains competitive and has lower latency.</p><h3>Trade-offs to Consider</h3><p>Tree search requires more sequential LLM calls compared to a single vector search, so <strong>latency is higher</strong>. This is almost always acceptable in document Q&amp;A scenarios, where the user expects a quality answer rather than an instant one. In real-time scenarios with high concurrent query volume, it’s worth evaluating whether the quality improvement justifies the added cost.</p><p><strong>Cost per query</strong> is also higher: each search requires the LLM to read the entire tree (titles + summaries of all nodes) to reason about relevance. For documents with hundreds of sections, the tree can get long. The solution is to use a cost-efficient model (like Claude Haiku or GPT-4o mini) for tree search, and a more capable model only for final answer generation.</p><p>As with any LLM-based system, retrieval quality depends on the quality of the model chosen to navigate the tree. On highly specialized technical documents, it’s worth investing in a stronger model for tree search, while index generation — which happens only once — can use cheaper models without significant quality loss.</p><h3>A Rapidly Growing Ecosystem</h3><p>The codebase is well maintained and actively developed. The PageIndex ecosystem is expanding quickly: an MCP server for LLM agent integration, a Python SDK, a cloud API with advanced OCR, and a ready-to-use chat platform. PageIndex can be integrated with frameworks like LangChain or LlamaIndex as a custom retriever, or used standalone as in this notebook’s example.</p><p>Thanks to the LiteLLM integration, model choice is completely flexible — whether it’s Bedrock for EU data residency requirements, OpenRouter for model variety, or Anthropic directly for reasoning quality. This makes PageIndex adoptable in virtually any enterprise infrastructure context.</p><p>If your use case revolves around complex professional documents and retrieval precision is critical, PageIndex deserves a spot in your toolbox.</p><h2>Resources</h2><ul><li><strong>GitHub</strong>: <a href="https://github.com/VectifyAI/PageIndex">github.com/VectifyAI/PageIndex</a></li><li><strong>Cloud API Docs</strong>: <a href="https://docs.pageindex.ai/">docs.pageindex.ai</a></li><li><strong>Chat Platform</strong>: <a href="https://chat.pageindex.ai/">chat.pageindex.ai</a></li><li><strong>LiteLLM — supported providers</strong>: <a href="https://docs.litellm.ai/docs/providers">docs.litellm.ai/docs/providers</a></li><li><strong>FinanceBench</strong>: the benchmark where PageIndex achieved 98.7% accuracy</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99c160c82a97" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-reply-it-datatech/goodbye-vector-db-building-smarter-rag-with-pageindex-99c160c82a97">Goodbye Vector DB: Building Smarter RAG with PageIndex</a> was originally published in <a href="https://medium.com/data-reply-it-datatech">Data Reply IT | DataTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>