跪拜 Guibai
← Back to the summary

A RAG System Reads 22 RAG Papers to Explain RAG, for Under a Dollar

I Fed 22 RAG Papers to a RAG System and Had the AI Explain RAG to Me

image.png

@[toc]


1. The 47th Day of 22 Papers Gathering Dust on My Hard Drive

Recently, I wanted to understand RAG (Retrieval-Augmented Generation), so I went on a downloading spree on arXiv. Twenty-two classic paper PDFs sat neatly in a folder—and then started gathering dust. image.png

Why didn't I read them? A triple whammy:

So what about asking a web-based large model directly? It hasn't read the details of this specific batch of papers in your hands, so its answers are generic and might even mix things up—after all, its training data isn't the complete text of these 22 papers on your hard drive.

What I needed was an assistant that reads all 22 PDFs, lets me ask questions in Chinese casually, and annotates answers with the source paper and page number.

Coincidentally, the technology to build this assistant is exactly what this batch of papers is about—RAG.

Pulling myself up by my bootstraps: I built a RAG system, had it read the RAG papers, and tell me what RAG is.


2. Solution: AnythingLLM + Lanyun MaaS, Zero-Code RAG

AnythingLLM: An Out-of-the-Box RAG Desktop Application

AnythingLLM is an open-source RAG desktop application. Its core selling points are threefold:

Official website link:

https://anythingllm.com/

AnythingLLM Download.png

However, AnythingLLM is just the "skeleton"; the real determinant of answer quality is the backend large model. It supports connecting to various APIs. To read 22 English papers and answer fluently in Chinese, you need a cloud model with a long enough context window, strong reasoning, and a cheap enough price—which brings us to the second protagonist of this article.

Lanyun MaaS

For the paper-reading Q&A scenario, the inference service has three requirements:

  1. Standard Interface—AnythingLLM supports OpenAI-compatible interfaces; just fill in an address to connect;
  2. Pay-per-use—Reading papers is a low-frequency scenario, costing a few cents a day, more cost-effective than a monthly subscription;
  3. Chinese ↔ English Cross-lingual Capability—The corpus is English papers, the questions are in Chinese, and the answers need to be in Chinese, testing the model's multilingual understanding.

Lanyun MaaS hits all three:

According to AI Ping's benchmark data, the time-to-first-token and throughput performance of mainstream models on Lanyun MaaS are quite impressive:

AIPing Leaderboard


RAG Principles Explained in One Diagram

Before starting the hands-on work, let's clarify RAG's workflow in 300 words—the diagram below encapsulates the core idea of those 22 papers:

image.png

Simply put: RAG = First vectorize and store documents, then when a question is asked, retrieve relevant passages and feed them to the large model to generate an answer.

Why do this? Because no matter how smart a large model is, its training data doesn't contain the complete text of the 22 PDFs on your hard drive. The core value of RAG is letting the large model "read" your private documents—retrieving relevant passages and placing them into the prompt. The model then answers based on these passages, resulting in naturally precise answers with cited sources.

Alright, principles explained, let's get started.


3. Preparation: Lanyun API + AnythingLLM Installation

Step 1: Get API Key from Lanyun Console

Go to the Lanyun console to register: Lanyun Official Website👇

https://console.lanyun.net/#/register?promoterCode=41c01378ce

After logging in, find API Management / Key Management in the left navigation bar, click "Create API Key", generate it, and copy it for safekeeping.

image.png

Step 2: Lock in deepseek-v4-flash in the Model Marketplace

Click 【Model Marketplace】 on the left, search for deepseek-v4-flash.

Why choose this one? The paper Q&A scenario consumes three things: English comprehension ability (RAG papers are mostly in English), Chinese generation ability (I want Chinese answers), long context (a single retrieval might recall thousands of tokens of passages). DeepSeek V4 Flash officially boasts a 1024k context window, with input priced at 1 RMB/million tokens and output at 2 RMB/million tokens—running this entire Demo from start to finish won't cost a single yuan. Lanyun Large Model Name.png Note the invocation name:

deepseek-v4-flash

At this point, the Lanyun-side trifecta is assembled:

Configuration Item Value
API Key sk-xxxxxxxx (your own key)
Endpoint Address https://maas-api.lanyun.net/v1 (OpenAI-compatible endpoint)
Model Name deepseek-v4-flash

Step 3: Download and Install AnythingLLM

Go to the official website to download the desktop version:

https://anythingllm.com/download

image.png

Installation packages are available for Windows / Mac / Linux. Download and double-click to install; the entire process is graphical, no tinkering required.


4. Core Configuration: Connecting Lanyun to AnythingLLM

Step 1: Configure LLM (Chat Large Model)

Open AnythingLLM, go to the left sidebar Settings (Preferences) → LLM Settings.

AnythingLLM Custom Model Selection.png

Fill in the following configuration:

Save it.


Step 2: Configure Embedder (Vector Model)

The core link in RAG is vector retrieval: your Chinese question must first be vectorized, then used to search for similar English passages in the vector database. This requires a cross-lingual Embedding model—one that can map Chinese questions and English documents into the same vector space; otherwise, retrieval simply won't hit the target.

AnythingLLM comes with an out-of-the-box local Embedder, no need to find an extra service or pay an extra cent.

Go to Settings → Embedding Settings, select AnythingLLM Embedder, and choose the model multilingual-e5-small:

AnythingLLM Embedder Settings.png

Why choose this one? Because it:

This way, the entire RAG chain becomes: Embedding runs locally, Chat runs on Lanyun—each doing what it does best: vectorization runs locally at zero cost, inference is handed to the cloud large model, and Lanyun's Tokens are all spent where they matter most.


5. Feeding and Building the Database: 22 Papers Enter the Warehouse

Step 1: Create a New Workspace

Click the top left + New Workspace, name it "RAG Paper Research Institute" (or whatever you like).

Step 2: Drag in the 22 PDFs

Click the Upload button on the right side of the workspace, select your downloaded 22 RAG paper PDFs (select all and drag them in). Document Import 1.png

⚠️ A small pitfall here: My first attempt to drag all 22 in at once resulted in a large number of Failed:

File Upload Failure Screenshot.png

Solution: Retry. I didn't change any settings, just dragged the failed files in again, and they all succeeded the second time. Suspected network jitter or temporary hiccup. If you encounter this, don't panic, just do it again.

Document Import 2.png

Step 3: Save and Embed (Vectorization)

After the files are successfully uploaded, click the Save and Embed button on the right side, and AnythingLLM will start vectorizing:

Document Import 3 Success.png

22 papers will take a while to run (depending on your computer's performance). Wait until the progress bar finishes.


6. Live Test: The Paper Assistant on Duty

Now, the 22 papers are lying in the vector database. Next, I designed 6 progressive questions, covering the core capabilities of a RAG system: precise localization, concept understanding, cross-document comparison, full-database summarization, knowledge transfer, and reverse verification.

Each question is backed by a screenshot, let's see if this "RAG explaining RAG" assistant is up to the task.


Question 1: Single-Document Fact Query

Question: "In the original RAG paper, what is the difference between the RAG-Sequence and RAG-Token models?"

This question tests precise localization ability—can it accurately find the original RAG paper (Lewis 2020) among 22 papers and extract the core differences between the two models.

Question 1 Thought Process.png

You can see that AnythingLLM used the @agent mode to call the rag-memory and document-summarizer tools, first retrieving documents, then generating an answer.

Question 1 Result.png

Result: The answer was precise, with the source cited on the right—01-RAG-Lewis2020.pdf, and it provided the core difference between the two models: RAG-Sequence retrieves only once for the entire sequence, while RAG-Token retrieves once for each token.

Single-document fact query passed.


Question 2: Concept Tracing

Question: "What is the 'Lost in the Middle' phenomenon? What experiment did the paper use to prove it?"

This question tests comprehension + retelling ability—not only finding the paper but also understanding its core argument and expressing it clearly in Chinese.

Question 2 Result.png

Result: The answer was complete, not only explaining the "Lost in the Middle" phenomenon (information in the middle of long contexts is easily ignored by the model) but also retelling the experimental design where the paper used a multi-document QA task to prove this phenomenon. The source cited on the right was 12-Lost-in-the-Middle.pdf.

Concept tracing passed.


Question 3: Cross-Document Comparison

Question: "Both Self-RAG and CRAG aim to solve the problem of unreliable retrieval quality. How do their approaches differ?"

This question tests cross-PDF synthesis ability—RAG's strongest suit. It needs to simultaneously retrieve both the Self-RAG and CRAG papers, extract their respective core ideas, and then compare them.

Question 3 Result.png

Result: The answer provided a detailed comparison table, summarizing the core differences effectively:

The source citations on the right listed two papers: 07-Self-RAG.pdf and 08-CRAG-Corrective-RAG.pdf.

Cross-document comparison passed, this is the core value of RAG.


Question 4: Full-Database Summarization

Question: "Among this batch of papers, which ones proposed new retrievers or Embedding methods? What are they called respectively?"

This question tests breadth of recall ability—it needs to scan 22 papers and summarize all those mentioning retriever/Embedding methods.

Question 4 Result.png

Result: The answer listed 6 papers and their proposed methods:

  1. DPR (Dense Passage Retriever)
  2. Contriever (Unsupervised Dense Retriever)
  3. BGE-M3 (Multilingual Embedding)
  4. Dense Passage Retrieval
  5. RETRO
  6. HyDE (Hypothetical Document Embeddings)

Full-database summarization passed.


Question 5: Implementation Consultation

Question: "If I were to build a financial document Q&A system for an enterprise, what should I pay attention to based on these papers?"

This question tests knowledge transfer ability—not just regurgitating paper content, but combining paper knowledge to give practical implementation advice.

Question 5 Result.png

Result: The answer gave 6 pieces of advice, covering retriever selection, long context handling, retrieval quality assessment, multi-document fusion, performance optimization, and evaluation frameworks, each corresponding to ideas from specific papers (like Self-RAG's introspection mechanism, Lost in the Middle's long context pitfalls).

Knowledge transfer passed, demonstrating value beyond being a mere repeater.


Question 6: Reverse Verification (No Hallucination)

Question: "Which paper discusses diffusion model image generation?"

This question is a reverse verification—there are absolutely no papers discussing diffusion models in the corpus. Will it honestly say "not found in documents", or will it fabricate an answer?

Question 6 Result.png

Result: The answer clearly replied "No relevant content found in the documents", and explained the corpus scope (RAG-related papers).

Reverse verification passed, no hallucination.


7. Cost Review: 22 Papers + Dozens of Q&A Rounds, How Much Did It Cost?

Finally, let's do the math. I took a screenshot from the usage page in the Lanyun console:

Lanyun Consumption Screenshot.png

Cost Breakdown:

From the screenshot, building the database with 22 papers + dozens of Q&A rounds cost a total of less than 1 RMB.

Compared to a monthly subscription, the advantage of pay-per-use is clear at a glance—reading papers for Q&A is a low-frequency scenario; paying only for what you use is far more cost-effective than a monthly plan.


8. Summary: You've Already Learned RAG Using RAG

Let's review the entire chain:

22 Paper PDFs → Chunking & Vectorization → LanceDB Vector Database → Chinese Question → Retrieve Relevant Passages → Lanyun deepseek-v4-flash → Chinese Answer (with citations)

You now have both the tool (a working RAG system) and understand the principle (this is exactly how RAG works).

More importantly, the applicable scenarios for this set of tools extend far beyond a paper assistant:

Change the corpus, and it's a new scenario.

If this article was helpful to you, feel free to like and bookmark it. See you next time.


Appendix: List of 22 RAG Papers

If you need these materials, you can leave a comment or send a private message.

Paper One-Liner Description
RAG (Lewis 2020) The seminal work, origin of the term RAG
DPR Foundation of dense passage retrieval
REALM Pioneer of retrieval-augmented pre-training
FiD Multi-document fusion decoding
RETRO DeepMind's trillion-token retrieval
Atlas Few-shot retrieval augmentation
Self-RAG Model introspection on whether to retrieve
CRAG Corrective retrieval augmentation
RAG Survey (Gao 2023) The most cited panoramic survey
HyDE Hypothetical document embeddings for improved retrieval
REPLUG Black-box LLM with external retrieval
Lost in the Middle Information loss in the middle of long contexts
RAPTOR Tree-structured hierarchical retrieval
GraphRAG Microsoft's knowledge graph RAG
Dense X Proposition-level retrieval granularity
Rewrite-Retrieve-Read Query rewriting
FLARE Active retrieval during generation
RAGAS RAG evaluation framework
Contriever Unsupervised dense retriever
BGE-M3 Multilingual Embedding
Adaptive-RAG Adaptive retrieval based on question difficulty
kNN-LM Nearest neighbor language model (prehistoric origin)