A reader asks about a book called In the Shadow of Greatness: “Where are the headquarters of the organization that published it?” The knowledge base contains a book description naming its publisher and a separate organization profile giving its headquarters. Storing the source by paragraph and cutting it into fixed-length blocks both preserve the text. When someone actually asks, will the assistant see the two sentences it needs?1
I encountered this in my earlier MuSiQue experiment. Searching all original paragraphs for each question found the answer string somewhere for all 2,417 questions. By July 28 my script could also chunk by 256 tokens, but it still checked every candidate block. To compare a system that first retrieves material and then writes an answer (retrieval-augmented generation, or RAG), two things were missing: what it actually retrieved on each run and what the assistant answered from it.
That day I saved RAG surveys by Gao and colleagues and Fan and colleagues in the chunking experiment directory. Table II in Gao et al. is a good trail into the experiments: its MuSiQue row lists four studies using these questions. I already had the questions. When reading the Ragas evaluation tutorial, I kept returning to “Collect Evaluation Data” and “Evaluate”. Here I complete that step for the opening question. I ran retrieval during writing using the original data and tokenizer, then handwrote demonstration answers from the retrieved text.234
For the same question, what did the two chunking methods retrieve?
This question comes from the MuSiQue multihop QA development set. The two hops are concrete: start with the book title to identify the publisher, then use that name to verify the headquarters city. The question comes with 20 candidate paragraphs. The table shows the two supporting passages marked by the dataset authors. IDs follow the data file and start at zero.1
| Source paragraph | Fact it establishes |
|---|---|
| 5, book description | In the Shadow of Greatness was published by the United States Naval Institute. |
| 4, organization profile | The United States Naval Institute is based in Annapolis, Maryland, USA. |
I prepared two search collections. One kept the 20 paragraphs as individual chunks. The other concatenated them in original order and used the Qwen tokenizer to split them into eight blocks. A tokenizer converts text to units the model recognizes, called tokens. Each block had at most 256 tokens, with no overlap. Both collections used only body text in retrieval.5
To make each ranking explainable, I used a simple rule: remove common function words from the English question, leaving headquarters, publisher, shadow, and greatness. A chunk scores one point per distinct term it contains. Ties favor earlier chunks. Both methods send the top two chunks to the answerer. The reference answer and paragraph support labels are used only for checking afterward.
| Chunking method | First place | Second place | How many hops can these two chunks support? |
|---|---|---|---|
| Original paragraphs | Paragraph 5 gives the book title and publisher. | Paragraph 0 describes the film Inju: The Beast in the Shadow. Its title also contains Shadow. | 1/2. The publisher is identifiable, but the headquarters is missing. |
| Blocks of 256 tokens | Block 1 includes adjacent paragraphs 4 and 5. One says “based in Annapolis, Maryland”, the other “published by the United States Naval Institute”.1 | Block 2 also contains headquarters and Shadow, but one headquarters mentioned there belongs to General Electric. | 2/2. Both pieces of evidence are in the first block. |
Why did paragraph retrieval fail? The question contains the title and headquarters but omits the publisher’s name. Paragraph 4 uses based in, matching none of the four terms. Fixed-length chunking happened to put paragraphs 4 and 5 together, so the book title carried the address into first place too.
Retrieving two chunks in both cases increased the text read from 127 tokens to 512, counting only the two bodies. I also truncated the fixed-length results in rank order to the same 127 tokens. The organization’s location in Annapolis survived, but the sentence naming it as the publisher was cut. Of these three contexts, only the two complete fixed-length blocks contained both hops of evidence. If a deployed assistant has an input limit, record the text it actually sees after truncation too.
How do I turn the two retrieval runs into two rows for Ragas?
I wrote one answer per run under the same instruction: “Answer only from the material in front of you. Say which step is missing if there is one.” Both rows share the original question and the dataset reference Annapolis. For readability the table lists only passage IDs. The actual Ragas field contains the list of complete retrieved texts.
| Chunking method | Material sent to the answerer, in rank order | Meaning of the demonstration answer |
|---|---|---|
| Original paragraphs | Paragraphs 5 and 0 | The publisher is the United States Naval Institute. The material does not say where it is headquartered. |
| Fixed length | Blocks 1 and 2 | The publisher is the United States Naval Institute, headquartered in Annapolis, Maryland. |
The Ragas 0.2.15 tutorial records a question-answer example in four fields. user_input is the question, retrieved_contexts the text actually sent to the answerer on this run, response what the answerer actually said, and reference the prepared reference answer. The first row may contain only paragraphs 5 and 0 as context. If you also include human-labeled paragraph 4, the judge will see an address the answerer never saw.4
One answer is cautious and the other names a city. Which should score higher?
To interpret the Ragas results, first specify what you are judging.
- Was all the evidence retrieved? Against the two manually annotated hops, the original-paragraph run gets 1/2 and fixed-length gets 2/2.
LLMContextRecalluses a language model to break the reference response into verifiable claims and checks how many the retrieved context supports. The dataset’s short answer contains only a city name. To have the judge check the publishing relationship as well, use the same expanded reference for both runs, stating who published the book and where the organization is based. Retain the original answer for comparison. The 1/2 and 2/2 above are manual counts against the dataset evidence.6 - Is each fact in the answer supported? This is what
Faithfulnessasks. The first answer names only the publisher. It fails to answer the city question, yet the name it gives is supported. Consider a different second answer: “The headquarters is in Fairfield.” That name appears in block 2, but it belongs to General Electric. Checking support requires tracking whose address it is.7 - What did the reader ultimately get? The question asks for a city. Only the second demonstration answer gives the reference, Annapolis. Check task success alongside faithfulness. Otherwise an assistant that always cautiously replies “insufficient information” might appear to perform well.
Reproduce the question, then connect a judge model
Download the development set musique_ans_v1.0_dev.jsonl and the tokenizer’s tokenizer.json into the same directory. Install the Python tokenizers package and run the following there to generate two evaluation records with full source text. Try printing rows[0]["retrieved_contexts"] first to see why the movie came second.15
import json
import re
from tokenizers import Tokenizer
with open("musique_ans_v1.0_dev.jsonl", encoding="utf-8") as source:
examples = (json.loads(line) for line in source)
case = next(item for item in examples if item["id"] == "2hop__628752_538661")
tokenizer = Tokenizer.from_file("tokenizer.json")
paragraphs = [p["paragraph_text"] for p in case["paragraphs"]]
tokens = tokenizer.encode("\n\n".join(paragraphs), add_special_tokens=False).ids
blocks = [tokenizer.decode(tokens[i:i + 256]) for i in range(0, len(tokens), 256)]
def words(text):
return set(re.findall(r"[a-z0-9]+", text.lower()))
query_words = words(case["question"]) - {"where", "are", "the", "for", "of", "in"}
def top_two(chunks):
return sorted(chunks, key=lambda text: -len(query_words & words(text)))[:2]
# 两份手写答复用于演示字段。评测自己的助手时,在这里记录它看到这两块后的实际输出。
runs = [
("paragraph", top_two(paragraphs),
"The publisher is the United States Naval Institute. The location is not given."),
("256_tokens", top_two(blocks),
"The publisher is the United States Naval Institute, based in Annapolis, Maryland."),
]
rows = [
{"user_input": case["question"], "retrieved_contexts": contexts,
"response": answer, "reference": case["answer"]}
for policy, contexts, answer in runs
]
The following adapts the Ragas 0.2.15 tutorial, which was available before July 2025. Install ragas==0.2.15 and a compatible langchain-openai, then configure OPENAI_API_KEY for the example judge. Run the code to inspect each row and compare it with the manual judgments. For this article I ran the retrieval and truncation experiments. I did not call an online judge model.4
from langchain_openai import ChatOpenAI
from ragas import EvaluationDataset, evaluate
from ragas.llms import LangchainLLMWrapper
from ragas.metrics import Faithfulness, LLMContextRecall
judge = LangchainLLMWrapper(ChatOpenAI(model="gpt-4o", temperature=0))
scores = evaluate(
dataset=EvaluationDataset.from_list(rows),
metrics=[LLMContextRecall(), Faithfulness()],
llm=judge,
).to_pandas()
scores["policy"] = [policy for policy, contexts, answer in runs]
print(scores[["policy", "context_recall", "faithfulness"]])
For a real comparison I would fix the questions, answering model, instructions, and token budget, then inspect the two records side by side for every question. For this book, paragraph 4 explains the first missing answer, and truncating 512 tokens to 127 explains why the second run loses its advantage. That suggests a next experiment more directly than two columns of average scores: search again for the address using the publisher name from the first hop.
MuSiQue comes with questions and reference answers. Where do questions come from for your own help documentation? At the time I followed “Collect Evaluation Data” into the Ragas synthetic test-set tutorial. Ragas organizes passages and their relationships into a knowledge graph, selects material from that graph, and asks a language model to generate questions and draft reference answers. You can choose questions answerable in one passage or ones that require linking several.8
Consider the book again. Suppose all you have are the book description and the organization profile, both mentioning the United States Naval Institute. With only the former, ask “Who published this book?” Follow the organization name to the second passage and add a hop: “In which city is the publisher headquartered?” When reviewing that question, I would mark one sentence for the publisher and one for the headquarters. Only when both are present would I retain the question, the reference answer Annapolis, and the two sources. Generate the question once and both chunking methods face the same test. You can then compare directly which one puts both pieces of evidence in front of the answerer.
References
Footnotes
-
Trivedi, H., Balasubramanian, N., Khot, T., & Sabharwal, A. (2022). MuSiQue: Multihop questions via single-hop question composition. Transactions of the Association for Computational Linguistics, 10, 539–554. Constructing multihop questions. dgslibisey. (n.d.). MuSiQue: musique_ans_v1.0_dev.jsonl [Data set]. Hugging Face. Development set file, question
2hop__628752_538661. The two quotations come from the first sentences of original paragraphs 4 and 5 respectively. ↩ ↩2 ↩3 ↩4 -
Gao, Y., Xiong, Y., Gao, X., Jia, K., Pan, J., Bi, Y., Dai, Y., Sun, J., Wang, M., & Wang, H. (2024, March 27). Retrieval-augmented generation for large language models: A survey (Version 5). arXiv. Table II, MuSiQue entry. ↩
-
Fan, W., Ding, Y., Ning, L., Wang, S., Li, H., Yin, D., Chua, T.-S., & Li, Q. (2024, June 17). A survey on RAG meeting LLMs: Towards retrieval-augmented large language models (Version 3). arXiv. Abstract and version history. ↩
-
Ragas. (2025). Evaluate a simple RAG system (Version 0.2.15). Ragas documentation. Collect Evaluation Data, Evaluate. Version released April 24, 2025. ↩ ↩2 ↩3
-
Qwen. (2024, January 13). Qwen-tokenizer: tokenizer.json [Tokenizer file]. Hugging Face. Tokenizer file and download, version
5909c82. ↩ ↩2 -
Ragas. (2025). Context recall (Version 0.2.15). Ragas documentation. Inputs and formula for LLM Based Context Recall. ↩
-
Ragas. (2025). Faithfulness (Version 0.2.15). Ragas documentation. Checking claims in an answer and calculating the proportion. ↩
-
Ragas. (2025). Generate synthetic testset for RAG (Version 0.2.15). Ragas documentation. Building a knowledge graph and generating single-hop and multihop questions. ↩