Olga Ostrovskiy

Notes · October 30, 2026

I tried RAG on ten novels

I never got around to RAG, though I’d read about it, watched a few videos, and wanted to get my hands on it.

My Storyland turns a novel into a walkable trip, a map with stops; I want each stop to show the sentence in the novel where that place is named. Read the page where you’re standing. This feature was my test bench for understanding RAG and when I might need it.

I took ten public-domain novels from Project Gutenberg—the ones behind trips already on the site—and fed them to three approaches: the whole book in the prompt, RAG, and an agent with a search tool. The question underneath: if an agent can open a file and search inside it, why build a retrieval system?

The short version

The best agent here used the same kind of search that RAG does.

What RAG does, in one paragraph

RAG means retrieval-augmented generation, a term from Lewis et al. [1] Before asking questions, I cut the novels into pieces called chunks. Each becomes an embedding, a list of numbers representing its meaning, stored in a vector database. For each question, the system retrieves pieces with similar meanings and puts them in the prompt for the model to answer from. Keyword search finds exact words; hybrid systems use both. Chunk boundaries matter: Anthropic shows how a revenue sentence can lose the company and quarter it describes when separated from its surroundings. [2]

How RAG answers a question. Before any question: ten novels, 1.1 million words, are cut into 5,053 pieces, each piece is turned into numbers (an embedding), and stored in a vector database. When a question comes in: 1, retrieve the 5 closest pieces; 2, augment, add them to the prompt; 3, generate, the model writes the answer.

The test

I used ten public-domain novels from Project Gutenberg, each with a live trip on My Storyland. They ranged from The Legend of Sleepy Hollow to Ulysses, with Jane Eyre in between.

The questions all ask the same thing: does this place appear by name? If yes, quote a sentence verbatim and give the chapter. If absent, say so.

Some questions covered trip stops the novels never name, including Hound Tor and the James Joyce Centre.

Every approach used the same model, Gemini 3.1 Flash-Lite: the small, cheap one, and the one my app runs on. I checked each quote against the book, word for word.

The approaches:

Every approach answered the “absent” questions correctly.

approachcorrect of 68input tokens per questionmedian timecost for all 68
whole novel in the prompt61147,5571.5 s (max 39.7 s)$2.52
RAG, embeddings only, top 5641,5831.0 s$0.03 + 22¢ once for the index
hybrid RAG, embeddings + keywords, top 5661,5551.1 s$0.03, same index
agent: search + read, up to 8 calls671,6461.7 s$0.04

What went wrong, and where

With the whole novel in the prompt, the model said Ulysses does not contain “Sandycove.” The word is there seven times.

On Wuthering Heights, it changed the pronouns in a quote: “He told me” became “I told him.” That would be easy to miss beside a stop on a map.

All seven misses were on the bigger books. Sending the whole novel also produced the slowest calls, at about 75 times the cost of hybrid RAG.

A 2023 study, Lost in the Middle, found that answers were better when relevant information sat at the beginning or end of a long input, and worse in the middle. [3] That gives me something to investigate in these misses.

Embeddings-only RAG retrieved passages without the requested name for Sandycove, Glasnevin and Nantes. The model then said “not mentioned.”

That is the worst failure here: nothing looks wrong.

Adding keyword scores fixed those retrieval failures. Hybrid search found the needed name whenever it appeared in the book. Its remaining mistakes came during quoting: the model chose the neighboring sentence.

The agent used 1.2 tool calls on average. Usually, it searched once and quoted. It stumbled on Madame Bovary’s inn, “Lion d’Or.” The book uses a curly apostrophe; the agent searched with a straight one. After repeated empty results and six calls, it quoted the wrong paragraph.

The agent also found that Frankenstein calls “Mer de Glace” only “the sea of ice.”

Three ways to get the AI the right text. Give it the files: the whole novel, the model reads it, answer. RAG: index built once, search for the top 5, the model reads the 5, answer. Agent: the question, search, read what it found, search again if it needs more, answer, with a limit of a few searches.

Changing the settings

I changed one setting at a time: smaller and bigger chunks, fewer and more pieces in the prompt, and a reranker that reorders the twenty best pieces before the model answers. Every variant retrieved the needed name. One or two misses remained per run, on a different question each time, always the same shape: the right piece in the prompt, the neighboring sentence quoted.

The settings changed the cost (the reranker by a factor of four), but the accuracy stayed where it was. What’s left is a prompting problem: ask for the sentence containing the name, then check that it does.

So, do we still need RAG?

For the quote at the stop: no, not at runtime. The book and the place are known in advance; I ask the question once, when the trip is built. I can find the quote once, check it against the text word for word, and store it next to the stop, where its one-line reason lives today. The search still has to work once per stop. This test points to exact-text search and reading around the hit.

RAG is for the other feature I keep thinking about: a reader asking the book anything at a stop. What happens here, who was here, which chapter to reread. I can’t predict or store those questions in advance. They look for a scene, not a name. That is a second round of this test, and I haven’t run it.

My rule: a few known files, read them; many documents and the same questions again and again, an index; a trail from one document to the next, an agent with a limit. The agent won by a hair, using the same exact-text search that the keyword half of hybrid RAG uses.

This was 68 questions, one model, one run, with questions suited to keyword search by design.

I came to understand what RAG is, and learned when I don’t need it.

Sources

  1. Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (2020).
  2. Anthropic, Introducing Contextual Retrieval (2024).
  3. Liu et al., Lost in the Middle: How Language Models Use Long Contexts (2023).
  4. Anthropic, Effective context engineering for AI agents (2025).