r/Rag • • Sep 02 '25

Showcase 🚀 Weekly /RAG Launch Showcase

35 Upvotes

Share anything you launched this week related to RAG—projects, repos, demos, blog posts, or products 👇

Big or small, all launches are welcome.


r/Rag • • 8h ago

Showcase What we learned building RAG over 13,000 pages of Indian company filings (41% → 93% hit rate@10)

8 Upvotes

We want to answer questions about Indian listed companies from their own filings, eventually for thousands of companies. Before building at that scale, we ran a five-company pilot: 13K pages of annual reports, results, concall transcripts and investor decks. Every choice was tested on a frozen question set, one variable at a time.

Search that finds the right page went from 41% to 93% (hit rate@10, 250 questions).

Why not just let an agent search? An agent's search is only as good as the retriever under it. Good retrieval means the model reads ten relevant passages instead of whole 300-page reports: cheaper, faster, and every answer can point to its page.

What we learned:

  • Parsing is the foundation. We picked the parser on number fidelity, checking every number it printed against the PDF's text layer. If a number doesn't survive parsing, no retriever can find it.
  • Metadata beat models. Reading company, year and doc type out of the question, used as a soft filter, gave more than switching embedding models.
  • One line of context per chunk (company · period · standalone or consolidated) was the biggest chunking win, and the returned text was unchanged.
  • Hybrid BM25 + dense hurt. On filings that repeat every year, the two lists only agreed on look-alikes: last year's report, the same slide in the next deck.
  • A reranker on the top 50 was the cheapest big gain: +10 questions, none lost.
  • Multi-fact questions: split into sub-queries and merge round-robin. Reranking the merged list against the original question undid the gain.
  • Open the output behind every score change. Our most convincing "improvements" were bugs.

Along the way we fixed two bugs in Docling's PDF parser, now merged upstream.

Full write-up with all the numbers and what failed:RAG from first principles


r/Rag • • 3h ago

Showcase What I learned running hybrid retrieval over 5M chunks of my own papers and code

3 Upvotes

I've been running BM25 + embeddings (RRF) over my own library: 373k files, 5.0M chunks of research PDFs, Word manuscripts, lab code and 57 cloned repos. I wrote 30 questions with a known right file and scored exactly what the retriever returns at a 2,000-token budget. Some results surprised me.

1. Keyword beat hybrid on my own files. Right file in the top 5: BM25 alone 60%, hybrid 50%. On BEIR SciFact it's the other way round (nDCG@10 0.658 vs 0.714). Code-heavy libraries are full of exact identifiers, and BM25 nails those. I ship both and default to hybrid, but I wouldn't assume embeddings help on a codebase without measuring.

2. The biggest quality bug wasn't retrieval. A third of my index (2.3M chunks) was stored twice. Re-ingest never deleted rows, and when I split a folder into its repos, every file lived in both projects. Results came back in pairs. Pruning deleted and moved paths did more for result quality than any ranking change I tried.

3. Don't let a chunk cross a page. A chunk that runs from the bottom of page 11 into page 12 gets cited as the wrong page. Splitting on page, slide and notebook-cell boundaries is what lets the top hit cite the right page/slide/line 99.2% of the time on 240 planted facts.

4. Embedding the first 600 characters is almost as good as embedding all of them. Chunks average ~1,200 chars. Embedding the whole chunk moved SciFact from 0.714 to 0.723 and doubled indexing time on a laptop.

5. The baseline to beat is grep, since that's what coding agents do. Ripgrep, ranked by keyword overlap: 23% right file in the top 5, 14.6 s, and a 50,000-file match list. It found 0 of the 5 paper questions, because it can't read PDF.

Still unsolved: conceptual questions over big repos ("where does X scale positions to a volatility target") find the right repo 16/17 times but the exact file only 7/17.

Stack, if useful: SQLite FTS5, nomic-embed-text v1.5 (local), IVF-PQ in NumPy (7 ms p50 at 6.5M vectors). The code and the eval script are here, MIT. I built it: https://github.com/pbathuri/cartograph

For people who've indexed mixed code + prose: did you split them into separate indexes, or tune fusion weights per source?


r/Rag • • 3h ago

Discussion What did you all put in your internal RAG at work?

2 Upvotes

We're building one for a mid-sized company. So far it's the wiki, the policy docs, the support tickets and part of the shared drive (after a LOT of cleanup!!).

Meeting transcripts keep coming up....but they're scattered everywhere. Some sit in the meeting platforms, some in people's own note apps, some on phones. I'm not sure they're worth the mess of pulling together.


r/Rag • • 29m ago

Showcase I made a beginner-friendly video about Chunking and Embeddings in RAG

1 Upvotes

I've been learning about Retrieval-Augmented Generation (RAG), and I wanted to explain two fundamental concepts that are important when building RAG applications.

1. Chunking

Breaking documents into smaller, meaningful sections so relevant information can be retrieved.

2. Embeddings

Converting text into numerical vector representations that help retrieval systems identify semantically similar content.

I created a short educational video explaining how these concepts work together in a RAG pipeline.

I'm sharing my own work from Beyond the Token, a new channel focused on AI and software engineering.

đŸŽ„ Watch here: https://www.youtube.com/shorts/CzTHn-q9LVg

I'd appreciate honest technical feedback.

What's the most common mistake beginners make when implementing chunking and embeddings?


r/Rag • • 36m ago

Tools & Resources I built an open-source tool that checks whether your RAG index still matches your source files

1 Upvotes

Hi all. I kept running into a quiet RAG failure: every ingestion job reports SUCCESS, but the vector index slowly drifts away from the source documents. The app still answers, just from the wrong content.

The cases I kept seeing:

- a document was updated, but the old chunks were never deleted, so both versions answer

- a file was deleted, but its vectors are still searchable

- a job "succeeded" but only wrote half the chunks

- a file was never embedded at all

- retries left duplicate chunks

So I built RAGGuard. It reads your source files in S3 and your vector index (Qdrant or pgvector), plus your pipeline's own records if you keep them, and compares them document by document using the content hash/version stored in each vector's payload. Every finding comes with its evidence: which points, which hashes.

A few design choices:

- Read-only. It never writes to or deletes from your systems. Fixes go to your own ingestion worker as a repair plan, and RAGGuard re-checks afterwards.

- Old vectors are only removed after the new version is verified, and by default only after a person approves.

- It doesn't grade LLM answers (Ragas, DeepEval etc. do that). It checks the index underneath them.

Limits today: S3 is the only source, and Qdrant and pgvector are the only vector stores.

If you'd rather check your own index without any tool, I wrote up eight of these drift cases, each with a SQL query you can run yourself:

https://github.com/kishore600/rag-integrity-platform/tree/main/docs/guides

Hosted (free during beta): https://rag-integrity-platform.vercel.app

Code (MIT): https://github.com/kishore600/rag-integrity-platform

CLI: pip install ragguard-cli

I'd really like feedback, especially from anyone who's hit this in production. How do you catch index drift today?


r/Rag • • 2h ago

Discussion How are you guys testing your RAG beyond the usual accuracy metrics?

1 Upvotes

I've been experimenting with RAG evals lately, measuring both

retrieval (Precision@K, Recall@K, Hit Rate, MRR, nDCG)

and generation (faithfulness, factual correctness, answer completeness).

My test set includes different types of questions like multi-hop, multi-span, and unanswerable questions. I guess some of these could count as stress testing since they're deliberately designed to expose weaknesses in the pipeline.

But I'm wondering what else one should be testing beyond this. Are you guys doing any other kinds of stress testing? And how are you actually doing it?


r/Rag • • 10h ago

Discussion Query rewrite - I struggle

3 Upvotes

If you work on conversational RAG, sooner or later you will encounter query rewriting. I am really struggling with it. To explain the problem here is an example conversation and what I do to resolve pronouns and query history context:

The conversation is about hedgehogs (what else).

User: Tell me about hedgehogs

Assistant: Provides information about hedgehogs.

User: What do they eat?

Assistant: Earthworms, beetles, slugs, caterpillars, millipedes, earwigs, and spiders. Snails if nothing else is available.

What does query rewriting do?

The query first enters salient referent resolution. At the moment of writing, I use heuristic scoring of recent topic mentions, grammatical role, singular/plural, main noun and mention frequency.

If a candidate passes the confidence threshold they is replaced with hedgehogs:

Retrieval query: What do hedgehogs eat?

If the reference remains missing or ambiguous, the query is marked underspecified. In this case a LLM attempts a rewrite using only the newest assistant answer. The LLM answer must pass validation.

If the validation fails or no answer exists the user gets an explanation of the failure and is asked to clarify her query.

Why is it difficult?

User: Are they mammals?

Or: Is it a mammal?

The user knows they mean hedgehogs. Conversional RAG must establish that connection from the available conversation and grammatical signals. Multiple candidate subjects, singular/plural differences, and ambiguous wording make this difficult.

Query splitting

User: What do hedgehogs eat? Create a table.

Retrieval question: What do hedgehogs eat?

Answer operation: Create a table.

After reference resolution succeeded, the splitter separates the query content from the answer instructions. "Create a table" is an irrelevant search term for the indexed queries. This is done through a LLM call. A decomposition that invents entities or drops unresolved references is once retried with additional instructions to preserve references and avoid invented entities. A simple standalone question can be retained instead of a rejected split. Other failures produce a clarification request to the user.

Translation

Each accepted retrieval question is normalized according to the selected retrieval-language mode. English-oriented flows translate when required; native multilingual flows retain the query language. Indexed retrieval can translate the retrieval query into the configured target languages before searching. (Document load created language specific indexes).

Retrieval gates block still queries marked underspecified. Therefore changing the language will not resolve uncertainty about what they or diese means.

Conclusion

Modern chat LLMs handle query rewrite remarkably well. Users might forget what is required to connect "they, it" to earlier turns.

Building a conversational RAG system makes the problem visible. The retrieval layer requires an explicit standalone query. So the conversational RAG must provide it, without inventing never mentioned entities.

Because modern chat LLMs handle this so reliably, there must be techniques beyond the simple heuristics I use currently.

How do you solve this problem?

  • Classical coreference resolution?
  • LLM-based rewriting?
  • Embedding similarity against conversation history?
  • Conversation memory structures?
  • Something else?

Thank you for your ideas!


r/Rag • • 6h ago

Discussion A RAG system can retrieve the right information and still return an outdated answer. I tested this across 5K and 12K changing facts.

1 Upvotes

One problem I've been particularly interested in is how AI systems handle information that changes over time.

Consider a simple example:

Monday: A supplier's warehouse address is Mumbai.
Tuesday: The warehouse moves to Pune.
Wednesday: You ask an AI agent for the shipping address.

Both addresses are genuine. Both may be available to the retrieval system. But only one is current.

I ran several experiments to understand how different memory approaches handle this.

1. A 12,000-fact benchmark — three seeds

Changing-fact completions and paraphrases:

  • NEXUS: 3 errors / 1,200 trials (0.25%)
  • Strong RAG: 78 errors / 1,200 trials (6.5%)

Obsolete values on updated records:

  • NEXUS: 0 / 342 (0%)
  • Strong RAG: 36 / 342 (10.53%)

2. A separate 5,000-fact free-generation experiment

We updated 30% of the stored facts and let the model generate its own answers.

An interesting result: RAG achieved 99.0% top-5 retrieval recall, but:

  • 18.6% of its answers to update queries contained the obsolete value.
  • 39.3% failed to return the current value.

NEXUS recorded:

  • 0.0% obsolete answers.
  • 0.1% failure to return the current value.

This illustrates why retrieval recall alone may not tell us whether an AI system can answer correctly after a fact changes.

Some important context:

  • The strong RAG baseline used hybrid keyword and dense retrieval with reranking.
  • The baseline had access to old and new records and was instructed to use the newest value.
  • The 12K changing-fact comparison was evaluated across three seeds.
  • The 5K free-generation experiment used one seed.
  • These are internal evaluations by ARSA AI, not independent third-party results.

NEXUS does not win every test.

On a broader schema-free evaluation involving unfamiliar fields, NEXUS answered 78.0% of answerable questions correctly, compared with 87.2% for RAG. It also had a higher wrong-stored-value rate in that test.

That tells us the results depend on the workload, configuration and type of information being tested.

I'm building NEXUS, and I'm sharing these experiments because I want technical criticism, particularly around evaluation design.

For people building production RAG and AI memory systems:

How are you handling corrections, conflicting versions and deletion?

Are you using metadata, versioning, temporal databases, reranking, or a separate memory layer?

I'd particularly appreciate suggestions for stronger baselines and ways to make these evaluations more representative of real production workloads.


r/Rag • • 12h ago

Discussion What is the most common failure you've encountered when deploying RAG in production?

2 Upvotes

I've been thinking about the gap between a RAG demo and a production RAG system.

In a demo, things often look simple:

  1. Upload documents.
  2. Create embeddings.
  3. Retrieve relevant chunks.
  4. Send them to an LLM.
  5. Display an answer with citations.

But production systems introduce much harder problems. For example:

  • Retrieval returns relevant-looking but incomplete context.
  • The LLM combines facts from unrelated passages.
  • The answer includes conclusions that aren't supported by the sources.
  • Citations exist, but don't actually support individual claims.
  • The system answers questions even when the available evidence is insufficient.

I'm particularly interested in the difference between citation validation and actual semantic grounding—a citation can point to a real document while still failing to support the statement associated with it.

For those who have worked on production RAG systems, what has caused you the most trouble?

  • Retrieval quality
  • Chunking and document structure
  • Hallucination detection
  • Citation and evidence verification
  • Evaluation and monitoring

I'm interested in practical experiences and engineering approaches, especially failures that weren't obvious during initial testing.


r/Rag • • 1d ago

Discussion Graph + vector RAG: when the extra hop actually helps, and when it's just extra latency

10 Upvotes

There have been a lot of "we added a knowledge graph to our RAG" posts lately, and far fewer about whether it was worth it. The rule of thumb I've ended up with: the graph helps when the answer depends on a relationship that isn't written down in any single chunk. When the answer sits in one passage, the graph mostly adds latency, extraction cost and new ways to be wrong.

Query shapes where the hop pays off

  • Multi-hop facts. "Which suppliers of our top-5 customers had a quality incident last year?" No chunk contains that. Vector search finds the incident reports or the customer list, rarely both, and never the join.
  • Aggregation over entities. "Which teams own services that depend on the auth service?" You need all of them, not the top-k most similar.
  • Disambiguation. Two people or products with the same name. With resolved entities, the graph knows they're different nodes. Embeddings happily blend them.
  • Path and cycle questions. "How is X connected to Y?" or "is there circular ownership?" That's a traversal, not a similarity search.

Query shapes where it doesn't

  • "How do I configure X?" / "What does policy Y say about Z?" The answer is in one or two passages, and a decent hybrid retriever + reranker gets it.
  • Summaries of a single document.
  • Corpora with few named entities (narrative text, opinion pieces). Entity extraction produces a sparse, noisy graph, and you pay for it on every ingest.

How to tell before building one

Take 100 real questions and label each one: is the answer in a single chunk, or does it need facts from two or more documents linked by an entity? Run your current retriever and check recall@10 on the gold chunks, split by those two groups. If single-chunk questions are most of your traffic and recall there is fine, a graph won't move your numbers much. If the multi-hop group is big and its recall is low, that's your case for one.

If you build it, what matters most

  1. Entity resolution is the whole game. "IBM", "International Business Machines" and "IBM Corp." as three nodes break every traversal. Put more effort into resolution than into extraction.
  2. Keep the graph pointing back to chunks. Every edge should carry the ID of the chunk it was extracted from. Traverse to find the relevant entities, then give the LLM the source chunks, not just the triples. Triples lose the qualifiers ("in 2023", "pending approval") the answer often depends on.
  3. Route instead of always hopping. A cheap classifier, or the LLM with a short rubric, decides per query: plain retrieval, or entity lookup + 1–2 hops + retrieval over the connected chunks. Most queries should take the cheap path.
  4. Cap the hops. Two hops is usually the useful limit. Beyond that the neighbourhood explodes and you fill the context with loosely related entities. Rank neighbours by edge type and recency instead of taking all of them.
  5. Measure the graph itself. Check extraction precision on a sample (are the edges true?) and count resolution errors (wrongly merged or split entities). A bad graph makes answers confidently wrong, which is worse than a missed retrieval.

A cheaper middle ground covers a surprising share of multi-hop cases. Store the extracted entities as metadata on each chunk and retrieve in two stages: retrieve, collect the entities in the top results, then retrieve again, filtered to chunks that mention those entities. There's no graph database, and you find out whether the hop helps before you commit to one.

Curious what query types pushed others into graphs, and whether anyone has measured routing against always-hop.


r/Rag • • 10h ago

Showcase I tested 4 PDF to Markdown converters: most of them leave page headers and page numbers in your text.

0 Upvotes

Full disclosure first: one of the four is ours (Siteiz - runs in the browser).

I wanted to know how it really compares, so I tried to make the test fair.

I created 8 documents and turned them into PDFs with Chrome, LaTeX and Word. That way I knew exactly what the right output should look like, and could check every heading, list and table. I added one scanned page too.

What surprised me:

  • Three of the four tools left page headers, footers and page numbers in the text. If you chunk that for RAG, the same "Annual Report 2025, Page 3" line ends up in almost every chunk. Ours removed most of them, the others almost none.
  • PyMuPDF4LLM was the best at tables.
  • MarkItDown didn't create a single heading from any PDF, and on the LaTeX files it turned normal paragraphs into tables with one word per cell.
  • Two-column pages still get mixed up by most tools.
  • For scans you need OCR whichever tool you use. With OCR on, ours and PyMuPDF4LLM both got about 95% of the words.

All the scores, the test PDFs and the scoring script are here if you want to check my work or run it on your own converter: https://siteiz.com/learn/pdf-to-markdown-converter-benchmark

What are you using for PDFs? I'm planning to add Docling and Marker next.


r/Rag • • 20h ago

Discussion LangGraph JS vs Vercel AI SDK + Inngest for multi-agent workflows?

0 Upvotes

I'm planning to build a multi-agent workflow and started looking at LangGraph JS, but honestly it feels like too much. Lots of abstractions, and I keep feeling the overhead more than the benefit.

So I'm thinking of going with the Vercel AI SDK for the agent and LLM side, and Inngest for orchestration and durable steps.

For anyone who's used either one in a real project:

  • Did LangGraph JS's complexity actually pay off later?
  • How was AI SDK + Inngest for handling state, retries, and agent handoffs?
  • Any pain points you hit that might help me decide?

Would really appreciate hearing about your experience.


r/Rag • • 1d ago

Discussion Best way to make ChatGPT explain an uploaded book strictly, without going outside the book?

4 Upvotes

I want to study using ChatGPT because its explanations are very good. My exams are approaching, so I don't have much time.

My goal is to upload my textbooks and have ChatGPT:

Explain every topic in simple language.

Follow the uploaded book strictly.

Avoid adding information from outside the book.

Cover all important points without skipping anything.

The problem is that ChatGPT sometimes adds information that isn't in the book. NotebookLM stays closer to the source, but I don't find its explanations as good as ChatGPT's.

I asked ChatGPT how to solve this, and it suggested building a RAG system and buying the ChatGPT API.

Is building a RAG system and using the API the only solution, or is there a better and easier alternative?

I'd appreciate practical suggestions.


r/Rag • • 1d ago

Tools & Resources IR evals for your RAG retriever without any model calls

1 Upvotes

When a RAG answer is wrong, the cause is often retrieval: the right chunk never reached the model. An LLM judge that grades the final answer won't show you that, and you pay for a model call on every query.

Evret scores only the retriever. You give it queries and the doc IDs each query should return. It computes Hit Rate, Recall, MRR, nDCG, ERR, and RBP at k by comparing doc IDs, so it makes no model calls.

It works with Qdrant, Chroma, Weaviate, Milvus, Elasticsearch, LangChain, LlamaIndex, and Haystack.

🔗 GitHub: https://github.com/kaivid-labs/evret


r/Rag • • 1d ago

Discussion file:line is not a citation, it is a contract

0 Upvotes

I run a local index over a codebase, and for the first weeks I treated the file:line on every answer as a nice-to-have - a citation that makes the answer feel credible. That was wrong, and it cost me a regression that a score hid. On my corpus that is 930 files, 6701 symbols and 92409 edges over about 1440 revisions, and the address is the part that makes the answer checkable.

A citation you can ignore, a contract you cannot.

When the index answers "function X calls Y", the useful sentence is not "X calls Y". It is "X at src/x.ts:42 calls Y at src/y.ts:17, edge stated from a call expression". The address turns the answer into something a second actor can verify without re-reading the whole codebase: open the file, look at the line, confirm. If the line is gone, the answer is wrong no matter how confident the prose is.

That is the contract: every claim carries its own address, and a claim without an address is not a claim, it is a rumor.

Where it broke.

Once, a model change made the answers shorter and more readable - and dropped the addresses. The quality score went up, because the text read better. The thing I actually needed, the ability to open the file and confirm, disappeared silently. Two days of "the answers feel right but I cannot trust them" before I connected the missing addresses to the change.

The fix was not "remind the model to cite". It was an assertion in the pipeline: every fact in the answer must map to an address that exists in the current revision, or the answer is rejected. The score stopped being able to rise while the contract fell.

Three assertions that do the work.

  1. The address must resolve. A file:line that points at a file or line that no longer exists in the current revision is a stale answer, served as a stale status, not as a fact. If the file changed after indexing, the index refuses to answer from it until it is reindexed.
  2. The address must be the current revision. An answer carries the revision it was indexed against. Two answers can be identical in text and different in truth, because the file moved; the revision is what tells them apart.
  3. A case is a case, not an average. On 14 fixed navigation tasks, one flaky case moved the average by 7 points. The rule is "no previously passing case may fail", and it caught two regressions the average hid, both in tasks I was not looking at.

The uncomfortable part: none of these are about the model. They are about refusing to ship an answer that cannot be opened and checked. A file:line is the cheapest verification I have, and treating it as decoration was the most expensive mistake of the month.


r/Rag • • 1d ago

Tools & Resources Compaction and prompt caching are one decision, not two. I built an open-source package that fits both to your own traffic

1 Upvotes

Most tools handle context compaction and prompt caching separately, or link them with fixed rules. But each one changes what the other is worth:

  • Compacting rewrites the prompt prefix, so it throws away the cache you were paying to keep.
  • Keeping a cache warm costs in proportion to the prefix, so it depends on what you kept.

They should be decided together, with two goals: the lowest cost per run, and a request that still holds what the model needs.

What it costs as a chat grows

A modeled 30-turn chat on Claude Sonnet 5.5. It is retrieval-heavy: 25k tokens of retrieved text per turn. Sending the whole history with prompt caching, each turn costs more as the chat grows: from 8 cents to about a dollar. OpenClaw's defaults level off around 28 cents once it starts clearing old tool results. compache stays near 12 cents a turn. For the whole chat: $16.48, $7.69 and $3.47. Lighter chats cost less on every line, and reach OpenClaw's thresholds later or not at all.

The best policy is different for every app

It depends on how long your users are away, what later turns need from earlier ones, and your model's prices and cache rules. Same chats and same model, fitted for three kinds of users:

Users come back afterWhat the fit chose
30 seconds5-minute cache, no pings
4 minutes5-minute cache, up to 3 pings
30 minutes1-hour cache

Modeled on conversations the fit had not seen, that cost 30% to 70% less than the best cache-only setting.

compache fits two things on your own traces.

Fit 1: what to keep when compacting

A turn adds three kinds of content: the question, the retrieved text and the answer. From your traces, compache measures two things for each kind: how many tokens it adds, and how far back later turns reach for it. Content that is large and rarely needed again goes first. Content that is small or often needed stays.

In the sample chats, retrieved text is 95% of the history, but only about one turn in eight needs any of it again. Questions and answers are the other 5%, so keeping them is nearly free. The fit keeps questions for 4 turns, answers for 9 and retrieved text for 1. With that, 82% of the turns that need history still have it in the request. The rest fetch it back, and that call is in the cost.

Fit 2: when to keep the cache warm, when to compact

From the timestamps in your traces, compache measures how long users stay away at each point in a conversation. With that it makes two decisions:

  • After every answer: let the cache lapse, or send a tiny ping to keep it warm. A ping is sent when that costs less than losing the cache.
  • On every new message: send the history as it is, or cut. A cut waits for a return that finds the cache expired. The prefix has to be written again then anyway, so the cut costs nothing extra.

In one 26-turn sample chat, the user was back within the 5-minute cache lifetime 13 times, a ping bridged a longer pause 4 times, and the history was cut on 8 returns to an expired cache. The last request was 25k tokens instead of 89k.

The calculator

Neither fit is tuned by hand. Every input can be measured from your traces or read from a price sheet: tokens per turn, thread length, time away, what later turns need, prices, cache lifetime. compache prices every candidate policy on your own conversations by the provider's cache rules, and the cheapest one wins. So it is a calculation, not a guess.

The cost calculator does the same in your browser. Give it your workload and it shows the cheapest policy. Click any turn of a conversation to see the expected cost of cutting or not, and of each number of pings. You can drop a chat log on it: it is read in your browser and sent nowhere.

Try it

pip install compache
compache demo      # four sample chats, no API key

In your own app it is one line around the client you already have:

client = compache.wrap(Anthropic(), "policy.json")

You first run it in record mode, which keeps sizes and timings and never text. Then compache fit writes the policy that this line applies. For a coding agent: compache wrap claude.

Live, as billed on Claude Haiku 5.5: $2.68 → $1.45 per 1,000 messages for a document chatbot, with answers right as often. Where it does not help: short chats, and models whose cache outlasts your users' breaks (2% to 5% on GPT-6 Luna).

Repo (Apache-2.0, no dependencies): https://github.com/BarendPotijk/compache


r/Rag • • 1d ago

Discussion Title: Best approach for retrieving relevant columns from large SQL tables in a Text-to-SQL agent?

2 Upvotes

I'm currently working on designing a Text-to-SQL agent for executives. The goal is to allow executives to ask natural language questions about our database and get accurate answers through SQL queries generated by an LLM.

One of the challenges I'm facing is column selection when dealing with large tables.

Some of our tables have 100+ columns. Out of these, perhaps 60–70 are commonly used, but the remaining columns could also be important depending on the question. Since I don't know all the possible questions executives might ask, I don't want to permanently exclude any columns.

My current workflow looks something like this:

  1. The LLM selects relevant tables based on their descriptions.
  2. Once the tables are selected, I need to provide their relevant columns to the LLM.
  3. Passing all 100+ columns from each table would increase the context size and introduce a lot of noise, making it harder for the LLM to identify the correct columns.

My proposed approach: Semantic column retrieval

For every table, I maintain a YAML file containing metadata for each column.

For example:

- table_id: SILVERBLADEBI.PRD_FACT_PAYMENT
  column_name: OVER_DUE_AMT
  data_type: NUMBER(15,2)
  is_nullable: true
  description: "Amount of the credit facility that is past its due date at the reporting month."
  synonyms:
    - overdue amount
    - past due
    - arrears amount
    - delinquent amount
  sample_values: null
  foreign_key: null

My idea is to:

  1. Generate embeddings for column descriptions, synonyms, and other relevant metadata.
  2. When a user asks a question, perform semantic similarity search against the columns of the selected tables.
  3. Retrieve the top relevant columns and pass only those to the LLM.
  4. The LLM generates SQL using the retrieved schema.

However, I have a few concerns:

  • Is maintaining business descriptions, synonyms, and usage information for every column worth the effort, especially when tables have 100–200+ columns?
  • Semantic similarity alone might miss columns that are indirectly relevant to a question.
  • How do I handle columns that are important for joins, filters, aggregations, or calculations but aren't semantically similar to the user's question?
  • What happens when the user asks a question involving a column that wasn't retrieved?

My questions:

  1. Is semantic column retrieval a good approach for large-schema Text-to-SQL systems?
  2. Are there better approaches, such as hybrid retrieval (keyword + semantic search), schema linking, or multi-stage retrieval?
  3. How would you design column retrieval to minimize irrelevant columns without missing important ones?
  4. Are there any production-grade Text-to-SQL architectures or papers worth studying for this problem?

I'd appreciate insights from anyone who has built Text-to-SQL systems with large enterprise databases.

Thanks!


r/Rag • • 1d ago

Discussion Wie können LLMs organisatorisches Wissen und GeschÀftsprozesse besser verstehen?

1 Upvotes

Ich studiere derzeit Wirtschaftsinformatik mit den Schwerpunkten maschinelles Lernen und Business Analytics.
FĂŒr meine Bachelorarbeit untersuche ich, wie sich organisatorisches Wissen strukturieren und abrufen lĂ€sst, um die Integration von LLMs in GeschĂ€ftsprozesse zu unterstĂŒtzen.
Wenn Mitarbeitende in ein Unternehmen eintreten, entwickeln sie nach und nach ein VerstĂ€ndnis fĂŒr dessen Prozesse, technische Systeme, AbhĂ€ngigkeiten und frĂŒhere Entscheidungen.
Wie können wir LLMs vergleichbares Kontextwissen vermitteln?
Mit meinem Open-Source-Projekt Octryx experimentiere ich mit Vektorsuche, Wissensgraphen, hybrider Suche, Reranking und GedÀchtnissystemen.
Besonders interessieren mich folgende Fragen:
Welche Abrufmethoden eignen sich am besten fĂŒr unterschiedliche Arten von Wissen?
Wie lassen sich Beziehungen und AbhÀngigkeiten effektiv darstellen?
Wie kann die Erfahrung einzelner Mitarbeitender in wiederverwendbares Organisationswissen ĂŒberfĂŒhrt werden?
Wie können wir kontextuelles VerstĂ€ndnis ĂŒber den Abruf von Dokumenten hinaus bewerten?
Ich wĂŒrde mich freuen, von euren praktischen Erfahrungen, erfolgreichen AnsĂ€tzen und gescheiterten Experimenten zu hören.
Letztlich möchte ich herausfinden, wie KI die kollektive Intelligenz verbessern kann, statt nur die ProduktivitÀt Einzelner zu steigern.
https://octryx.ai/research/


r/Rag • • 2d ago

Discussion At what point does cleaning documents for RAG become the actual project?

12 Upvotes

You create a RAG pipeline, link a knowledge base and expect the retrieval system to work as expected. Then reality hits. PDFs with tables, duplicate files, inconsistent names, scanned pages, old documents and bad formatting make extraction difficult. You spend time cleaning and preparing data than building the RAG pipeline itself.

At that point, is the retrieval system the difficult part or is document quality the problem that we constantly underestimate? Where do you draw the line between preprocessing and building a separate data-cleaning system?


r/Rag • • 2d ago

Showcase RAG vs Agentic RAG

6 Upvotes

Started a monthly posting about RAG and AI in general, subscribe for nice discussions

https://substack.com/@aisystemsnotes


r/Rag • • 1d ago

Discussion Can association members use RAG to review their own documents against official guidelines?

1 Upvotes

I've been looking into a slightly different use case for rag. Instead of asking questions about a knowledge base, members would upload their own documents and check them against their associations guidelines. It's something we're exploring with customgpt.ai, my main question is how reliable this gets when there are exceptions or different versions of the same standards, how would you approach this?


r/Rag • • 2d ago

Showcase I built a free interactive path for learning RAG, from chunking to evals. Feedback welcome.

28 Upvotes

I wanted a way to learn RAG that wasnt a long doc or a 40 minute video, so I built LearnGenAI.

Its 48 short lessons. You build a handbook search bot for a fictional company, Tamarind Labs, across 5 units:

  1. Basic pipeline: chunk, embed, vector search, grounded answer
  2. Hybrid retrieval: BM25, RRF, and a metadata filter
  3. Rerank, a relevance gate, and citations
  4. Query rewrite and multi-query
  5. Evals: context precision, recall, and retrieval failure vs abstain

The exercises run on real retrieval code, so if you change top-K, the scores actually change. Most lessons are 2 to 4 cards, one idea each, with instant feedback. There is also spaced review of interview-style questions at 1, 3, 7, 14 and 30 days.

Its free, no account needed: https://www.learngenai.space/

Im the person who built it. If you try it, Id like to know which unit felt thin or confusing, and what youd want taught after RAG.


r/Rag • • 1d ago

Showcase Do you keep the raw conversation, or only the summary your agent wrote?

1 Upvotes

I built a memory tool called Zenod Memory, so I'm biased here.

I keep the raw voice note and never edit it. An agent writes pages from it. Each line links back to the note.

When a page is wrong, I rebuild it from the raw note. A summary alone gives me nothing to rebuild from.

Do you keep the raw conversation, or only the summary your agent wrote?


r/Rag • • 2d ago

Showcase How do you manage chat history in production LLM applications?

1 Upvotes

I've been exploring different ways to manage conversation history in LLM apps.

Appending the entire chat history to every API call works initially, but as conversations grow, token costs increase, context gets cluttered, and important information can get lost.

I experimented with a turn-based 10 + 10 hybrid approach:

  • Maintain a persistent summary of older conversations.
  • Keep the latest 10 turns untouched.
  • Every 5 new turns, condense the oldest 5 into the summary.
  • Prune unnecessary historical tool outputs while preserving the actual responses.
  • Keep the active turn untouched to avoid breaking tool-call sequences.

I've written about the approach and the trade-offs and included a Python implementation using LangChain.

Article: https://medium.com/@anishvv212002/how-to-manage-chat-history-in-llm-apps-the-architecture-i-use-in-production-and-why-naive-efe9a55a570f

Curious to know how others are handling this.