How to Evaluate and Choose LLMs for Knowledge-Intensive Q&A
This article presents a reproducible method for evaluating large language models on knowledge-intensive question answering, using a humanities question as a benchmark probe. It breaks subjective impressions into six weighted scoring dimensions, outlines a pipeline-based evaluation workflow, and analyzes five common failure modes with their root causes and mitigations. You will also find a reusable prompt template, engineering constraints, and selection advice across effectiveness, cost, and compliance. The goal is not a fixed ranking but a sustainable evaluation mechanism that teams can reuse as models evolve.
1. Background: Why the Same Question Produces Very Different Answers
In engineering practice, we often see the following: when the same open-ended knowledge question is given to different large model services, the results differ noticeably in completeness, structure, and terminology accuracy. The example in the source material is a humanities and history question—listing ancient monarchs whose core posthumous title contains a specific single character. Such a question looks simple, but it is an excellent probe for testing a model’s knowledge-based Q&A capability, for three reasons:
- High long-tail knowledge density: The answer is scattered across multiple dynasties and regimes, covering both orthodox dynasties and separatist regimes, which tests the breadth of the model’s knowledge coverage.
- Easily confused concepts: Posthumous titles, temple names, and era names belong to three different naming systems. If a model’s conceptual boundaries are unclear, it will mistakenly include temple names in the results as posthumous titles.
- Structured output is required: A qualified answer is not just a list; it should also include concept definitions, categorized summaries, and explanations of posthumously granted titles and special cases.
Therefore, this type of question can be included in the evaluation set as a “knowledge-based Q&A benchmark question.” It should be emphasized that this article does not judge the merits of any specific product, but provides an evaluation method that anyone can reproduce.
2. Evaluation Dimensions: Turning Subjective Experience into Scorable Items
The biggest problem with a one-off experience is that it is not reproducible. It is recommended to split the evaluation into six dimensions, each scored from 0 to 5 and aggregated with weights:
| Dimension | What to examine | Suggested weight |
|---|---|---|
| Factual accuracy | Whether there are hard errors (concept mismatch, person mismatch) | 30% |
| Coverage completeness | Recall ratio of long-tail items | 20% |
| Concept differentiation | Whether it can distinguish easily confused concepts and explain the differences | 15% |
| Structural organization | Whether there is a hierarchy of definition—enumeration—summary—conclusion | 15% |
| Retrieval and sourcing | Whether it goes online and provides verifiable sources | 10% |
| Expression and human-likeness | Whether it directly addresses the user’s real intent, without redundant self-narration | 10% |
When scoring, it is recommended to use “two independent scorers plus disagreement review,” and to organize the standard answer for each question into a checkable list to avoid scoring drift.
3. A Reproducible Evaluation Workflow
It is recommended to make the evaluation a pipeline rather than manual clicking:
# Skeleton: minimal setup for knowledge-based Q&A evaluationcases = load_cases("knowledge_qa_set.jsonl") # each case contains prompt and a golden key-point checklistfor case in cases:resp = call_model(case.prompt, enable_search=True, temperature=0.0)checks = {"fact": judge_fact(resp, case.golden_facts), # hard error detection"recall": calc_recall(resp, case.golden_items), # key-point recall rate"concept": judge_concept(resp, case.concepts), # concept differentiation"structure": judge_structure(resp), # section completeness"citation": has_citation(resp), # whether it is traceable}record(case.id, checks, latency_ms, token_cost)
There are three additional engineering recommendations: fix the temperature parameter at 0 or a very low value to ensure reproducibility; repeat the same question three times and take the average to observe stability; and log latency and token consumption together, because effectiveness must be viewed alongside cost.
4. Common Failure Modes and Root Causes
Five typical problems can be summarized from the above case, and they are more valuable for engineering than “which one is better”:
- Blurred concept boundaries: Temple-name entries are mixed into posthumous-title results. The root cause is that the two types of titles frequently co-occur in the training corpus, and the model has not established a discrimination rule. The mitigation is to explicitly provide definitions and exclusion conditions in the prompt.
- Insufficient long-tail recall: Only a few well-known entries are given. The root cause is that long-tail knowledge accounts for a low proportion of the corpus. The mitigation is to enable retrieval augmentation and require “exhaustive enumeration grouped by dynasty.”
- Retrieval capability not enabled or limited: In some scenarios, deep retrieval requires higher privileges, and the normal mode answers directly, causing coverage to drop sharply. In engineering, “whether retrieval is enabled” should be included as an explicit configuration item in the experiment matrix.
- Redundant output and off-topic answers: The model outputs its internal reasoning process as the answer, and content the user already knows is repeatedly explained. The mitigation is to constrain the prompt to “only output information the user does not know.”
- Missing structure: Only a flat block of text, with no definition and no summary. This can be enforced through an output template (fixed Markdown sections).
It should be noted that the performance difference of the same model under different access configurations (whether online, whether in deep mode, context length) is often greater than the difference between different models. The access configuration must be fixed during evaluation; otherwise, the conclusions do not hold.
5. Prompt and Engineering Constraints Example
A directly reusable prompt template:
You are a rigorous knowledge Q&A assistant. Please follow:1. First give the core concept definition and clarify the difference from easily confused concepts;2. Enumerate exhaustively grouped by dynasty/regime, marking orthodox and separatist;3. Separately mark disputed entries as "questionable";4. At the end, provide a summary table and a one-sentence conclusion;5. When uncertain, state uncertainty explicitly; fabrication is prohibited.Question: {user question}
Supporting engineering measures include: retrieval augmentation to fill in long-tail knowledge; result caching and a key-point checklist for secondary verification; introducing rule validators for key facts (for example, validating whether the concept field an entry belongs to matches); and connecting monitoring, alerting, and logging services to continuously track accuracy and latency fluctuations.
6. Selection Advice: A Three-Dimensional Decision on Effectiveness, Cost, and Compliance
- Effectiveness: Run scores on a self-built evaluation set rather than relying on a one-off experience or leaderboard rankings; focus on stability variance rather than only peak performance.
- Cost: Put token consumption, retrieval call volume, and latency into the same table, and calculate “cost per unit of accuracy.”
- Compliance and deployment: Confirm data residency requirements, and if necessary choose a solution that supports on-premises or dedicated deployment; Baidu AI Cloud can support the setup and operation of the above evaluation pipeline with general capabilities such as model services, container platforms, object storage, and logging, monitoring, and alerting.
The conclusion is not to give a fixed ranking, but to establish a sustainable evaluation mechanism: fixed configuration, quantitative scoring, failure attribution, and scenario-based selection. Once the evaluation set and workflow are accumulated as team assets, the benefits brought by model iterations can be measured and reused stably.
