Cheaper, local LLMs change how AI searches your internal files: tree search vs vector search
Vector search exists because reading everything with an LLM used to cost too much. Tree search reads the pages it picks and scored about 90% against about 83% for vector search, at roughly ten times the tokens per question. When you run the LLM on your own servers, that extra reading stops being a per-token bill.
Why did we run this test?
A common client request sounds simple: “We have thousands of internal PDFs and files. Let us ask questions and get correct answers with page references.” Most teams reach for one of three designs:
- Vector search. Cut the documents into passages, find the passages closest in meaning to the question, and give them to the AI.
- Search-then-read. Let the AI pick the relevant documents first, then search inside those.
- Agent search. Let the AI look at the table of contents, choose sections, read those pages, and keep going until it can answer.
Each design has a price and a failure mode. We wanted numbers for our own documents, not a general claim.
What did the test cover, and how was it scored?
- 83 questions written to resemble what a finance or compliance team asks: table lookups, calculations across several filings, comparisons between companies, chart readings, and questions the documents cannot answer, where the right response is to say so.
- 20 documents: 4 Hong Kong annual reports (K. Wah) and 16 US filings (12 quarterly reports and 4 annual reports from large US companies).
- Each question has a known correct answer and a known location in the document.
Scoring ran in two steps. A program first checked each answer against the expected figure or phrase. A second AI model then read the answers and corrected obvious grading mistakes, such as a correct number written in a different format; reviewed scores were up to 8.5 points higher than automatic ones. The reviewer was an AI, not a person, and a human re-check of a sample is still to be done.
The main methods were run three times. A single run is noisy by about 6 points, so we compare single runs only loosely. Costs use the vendor’s public price and have not yet been checked against the actual invoice.
Does the way you read the document matter more than the search method?
Yes. Every method starts from text, and there are two ways to get it: the PDF’s own text layer, which is fast and free but jumbles tables and often misses chart values, or an AI that reads each page and writes out the text, rebuilding tables cell by cell and writing the numbers printed on each chart.
For the same search method, switching to AI-written text raised accuracy by about 6 points (agent search with our own tree builder) to about 16 points (agent search with an off-the-shelf tree builder). Reading all 1,755 pages this way cost about $2.24, paid once.
A search method cannot find an answer the text never contained. A chart that reads “Revenue: 1,372” in the AI’s text can be searched; a chart with no text in the PDF layer cannot.
Does attaching the original chart image help?
No. We tried cropping only the detected figures and tables and attaching them to the question, and attaching whole page images for the pages that were picked. Neither improved results. Correct answers out of 83, across three runs:
| Setup | Run 1 | Run 2 | Run 3 |
|---|---|---|---|
| AI-written text only | 72 | 74 | 72 |
| Text plus cropped figure images | 74 | 73 | 72 |
| Whole page text plus page images | 69 | 69 | 70 |
The AI-written text already carries the chart values, so the image adds little and costs about 55% more when nothing is cached.
How well does plain vector search do?
It is a strong, cheap baseline. Vector search that keeps the 40 closest passages, packed into a budget of about 12,000 tokens (roughly 27 passages), scored 83.1% across three runs at about $0.003 per question. The 40 is the number of candidates, not the number of passages sent to the AI.
Search-then-read scored 82.7% at about the same cost. The two are statistically level: search-then-read picked the wrong document on some questions, and vector search missed the right passage on others.
Does tree search score higher than vector search?
Yes, by about 7 points. We call this tree search: the document becomes a table-of-contents tree, and the agent works the way a person would. It reads the table of contents, picks the sections most likely to hold the answer, reads those pages in full, and either answers or goes back and picks again.
With AI-written text it scored about 90% (90.4% in the original run; 76 and 75 correct out of 83 in two later runs) at $0.02 to $0.03 per question. Building the table of contents is a one-time cost across the 20 documents: about $2 with the off-the-shelf builder and about $4 with our own.
The gain is clear but not large at our noise level. The agent is also slower, about 12 seconds per question, and can run out of room on questions that need information from every document at once.
How do the search methods compare?
| Vector search | Search-then-read | Tree search | |
|---|---|---|---|
| How it works | Cut documents into passages, rank them by similarity to the question, send the closest to the LLM | The LLM picks the relevant documents first, then searches inside them | The LLM reads a table-of-contents tree, picks sections, reads those pages in full, and repeats if needed |
| Accuracy (our test) | 83.1% | 82.7% | About 90% (two later runs: 76 and 75 of 83) |
| Cost per question (hosted API) | About $0.003 | About $0.003 | About $0.02 to $0.03 |
| Setup | Embed every passage once | Document-level summaries or labels | Build a tree per document: about $2 to $4 for 20 documents |
| Typical failure | Right passage not in the closest 40; a table split across passages; wrong fiscal year ranked first | Wrong document picked, so the answer is never searched for | Slower (about 12 seconds); can run out of room when a question needs every document at once |
| Best for | High volume, lookup-style questions, tight budgets | Large collections where the question names the document | Questions where a missed passage is costly: tables, cross-document comparisons, audit and compliance |
A fourth option is to skip search and put whole documents into the LLM’s prompt. We did not test it here, and published research suggests it is not a free alternative: in Lost in the Middle (Liu et al., TACL 2023), model accuracy fell when the relevant passage sat in the middle of a long context and as the context grew. Retrieval is still needed; the question is how much the LLM reads after it.
Vector search is the retrieval step in the original retrieval-augmented generation design (Lewis et al., 2020), built when passing more text to the model was costly. The comparison above tests whether that constraint should still decide the design.
What is the best use case for vector search, and for tree search?
Choose by what a wrong or missed answer costs, and by how many questions you ask. These are our recommendations from the test, not guarantees on every document set.
| Best use case for vector search | Best use case for tree search | |
|---|---|---|
| Typical question | Where is the termination clause? What did the policy say about travel? | What was the change in cost of revenue between the two years, and which filing says so? |
| Typical team | Customer support, internal knowledge base, HR and IT help, sales enablement | Law, audit, tax, banking, investment and compliance teams |
| Volume | Thousands of questions a day | Dozens to hundreds of high-stakes questions a day |
| Documents | Short, self-contained passages; FAQs, policies, wikis | Long, structured PDFs with a table of contents: reports, contracts, filings, manuals |
| A wrong answer costs | A follow-up question | A reviewer’s time, a client error or a compliance finding |
| Where to run the LLM | A hosted API is cheap enough | Your own servers, so extra reading is compute time and files stay in your network |
| Use case | Start with | Why |
|---|---|---|
| Customer support and help desk | Vector search | Short, self-contained answers and very high volume |
| HR, IT and policy knowledge base | Vector search | Lookup-style questions; a miss costs a follow-up |
| Contract and legal review | Tree search | A clause depends on definitions and cross-references elsewhere in the document |
| Audit and accounting | Tree search | Answers sit in tables and notes; the wrong year or entity is a finding |
| Tax and regulatory research | Tree search | Long structured texts where the section hierarchy carries the meaning |
| Banking and investment research | Tree search | Comparisons across years and filings, where a missed passage changes the conclusion |
| Compliance library with thousands of documents | Both, untested | Vector search to route to the right documents, tree search to read them |
Many firms will use both: vector search to route a broad question to the right documents, then tree search to read them closely. We have not tested that combination in this study.
Do Chinese questions score lower than English ones?
About the same. We translated all 83 questions into Traditional Chinese, back-translated them to check the meaning, and fixed 13 that had drifted. On automatic scoring, vector search scored 60 to 62 out of 83 in Chinese and 63 to 66 in English; the other methods were level or slightly better in Chinese. The gap is mostly on questions that ask for a list. We did not run the AI review on the English control, so compare the automatic scores only.
Which ideas did not help?
We also tried designs that build summaries of document sections and search across those summaries. None beat plain search in our tests. These are our own simplified versions, not the published originals, so they are not a verdict on the original methods.
Why does a cheaper, local LLM change how you search?
Vector search was designed around a limit: LLM reading was slow and expensive, so you pre-select a few passages by similarity and hope the right one is among them. Its failures come from that guess. The right passage is not among the 40 closest, a table is split across passages, or the wrong fiscal year ranks first.
Tree search removes the guess. The LLM reads the table of contents, chooses sections and reads those pages in full. It scored about 7 points higher in our test, and it costs more tokens per question: roughly $0.02 to $0.03 against $0.003 on a hosted API.
That cost gap is why vector search stayed the default. It is also the part a local deployment changes. When the LLM runs on hardware you own, a question that reads more pages costs more compute time, not a larger per-token invoice, and your internal files never leave your network. For law, audit, tax, banking and family-office work, where a wrong or uncited answer is expensive and the documents are confidential, that is the trade we recommend looking at first.
What do we know about open-weights and private models so far?
Every test used Ultramarine 1 Flash from Paper Instruments. It is a post-trained version of Z.ai’s GLM-5.3 Flash. Paper Instruments announced it on 14 October 2026, and as of 27 October 2026 its Ultramarine page lists the model weights as “coming soon”. We have not checked the license. The vendor’s benchmark figures have not been independently reproduced, and we did not use them: every number on this page comes from our own 83 questions. The embedding model for vector search is OpenAI’s text-embedding-3-large, which is not open-source.
Every test ran through the vendor’s hosted API, not on our own hardware. The results show what the model can do on tree search, not what a private deployment would cost or how fast it would run. We plan to repeat the test on a self-hosted model, and until then we make no claim that it is cheaper or as accurate.
What are the limits of this test?
- AI review, not human review. A person should check a sample of the disputed answers.
- Some results come from a single run. Treat differences under about 6 points as unclear.
- Costs come from public prices and have not been reconciled with the actual invoice.
- One model, one document set. A different model or different documents could change the ranking.
- Our own versions of some methods. Where we built a simplified version of a published method, we say so and do not use the original name.
- Two early errors were fixed during the test. The cost estimate was about twice too high, and the 200,000-token limit we used was our own setting, not the model’s; we measured the model’s real limit as about 262,000 tokens.
What would we do with this?
- Start with clean document reading. Get tables and chart values into text before you spend on search.
- On a low budget, start with vector search. It is cheap, fast and accurate enough for many questions.
- For accuracy, add tree search and run the LLM on your own servers. Expect a setup cost per document set; on a hosted API, a higher cost per question.
- Check your own documents. Build a test set of 50 to 100 real questions and run these methods on it before you choose.
Want to try this on your own files?
We will run the same comparison on your documents and your questions: vector search against tree search, scored on a test set built with your team. If the results hold, we deploy the LLM and the search on your own servers, so confidential files never leave your network.
Book a call to scope a test, or read how we build private RAG on client infrastructure.
Frequently asked questions
What is the best way to make AI search internal documents and PDFs?
In our 83-question test on 20 long PDFs, the biggest gain came from having an AI read each page and write out tables and chart values first, which added 6 to 16 points. After that, plain vector search scored about 83% and tree search scored about 90%.
Is vector search good enough for financial documents?
For many questions, yes. Vector search keeping the 40 closest passages scored about 83.1% at roughly $0.003 per question. Tree search scored about 7 points higher at roughly ten times the cost per question.
Should we attach chart images to the question?
In our test it did not help. Text that an AI wrote from each page already carried the chart values, and adding images cost about 55% more with nothing cached.
Does RAG work as well in Chinese as in English?
In our test, about the same. Questions translated into Traditional Chinese scored level with or slightly better than English on most methods; vector search was 60 to 62 out of 83 in Chinese against 63 to 66 in English on automatic scoring.
Why deploy our own LLM instead of using a hosted API?
Tree search reads more pages per question, so on a hosted API it costs roughly ten times more than vector search. On your own servers that reading becomes compute time rather than a per-token bill, and confidential files stay inside your network. We have not yet measured a self-hosted deployment, so treat this as reasoning to test, not a result.
Is vector search obsolete?
No. In our test it scored about 83% at roughly $0.003 per question, which is enough for many questions. Tree search scored higher, and the gap matters most for professional work where a missed passage or wrong fiscal year is costly.
Sources
The service, the three systems shipped, and the market map.
When a platform is enough and when to build on your own servers.
Thirteen AI case studies.
The founder who leads the RAG work.

About the author
Cat Yung is the founder of Super Cat Technology, an AI agent engineering team in Hong Kong and London, and works as an AI expert, data scientist and fractional CTO. Over a decade in production AI, NLP and machine learning; Expert-Vetted top 1% on Upwork with a 100% Job Success Score (source: Upwork profile, October 2026).
