LLM Q&A Application Selection: Separating Retrieval and Rewriting
This article presents a practical approach to selecting models and components for LLM-based Q&A applications by separating the workflow into retrieval, curation, and generation. It explains why separation reduces source loss and hallucination risk, lists seven evaluation dimensions, describes a repeatable test set and metrics, and outlines common risks and rollout steps.
1. Problem Background
Many users turn to LLM-based Q&A systems to get a clear answer: “what is it” and “how do I do it.” This type of need is factual retrieval. Another type of need is rewriting existing material into a specific style, such as a podcast script, Q&A article, popular science piece, or long-form community post. This type of need is text generation and style control.
The two tasks place different demands on model capabilities. Retrieval tasks depend on the breadth of information access, source-quality judgment, and summarization precision. Generation tasks depend on language organization, style transfer, and adherence to structural instructions. If a single stage is asked to handle both, two common problems arise. First, retrieval results may lose source information during polishing. Second, when source material is insufficient, generated content may fill in facts on its own.
2. Task Decomposition
A recommended approach is to split the Q&A workflow into three stages:
- Retrieval stage: rewrite the user question into several search queries and recall candidate pages or documents.
- Curation stage: deduplicate candidate content, filter low-credibility sources, and extract fact fragments relevant to the question.
- Generation stage: based on the curated material, output the final text in the target style.
The input, output, and failure handling of each stage should be defined separately. For example, when the retrieval stage returns no results, the system should directly tell the user that no reliable sources were found, rather than handing the task to the generation stage to complete the content. This design confines errors to the layer where they occur and makes troubleshooting easier.
The following illustrative code uses generic function names and does not correspond to any specific implementation:
def answer_with_rewrite(question: str, style: str) -> str:queries = build_search_queries(question)documents = []for q in queries:documents.extend(search(q, top_k=5))facts = extract_facts(documents, question)if not facts:return "No sufficiently reliable sources were found. Try different keywords and retry."prompt = build_rewrite_prompt(facts, style, require_citations=True)return generate(prompt)
3. Why Separation Matters
Separation brings three main benefits.
Clear responsibilities. Retrieval-stage quality can be measured by recall and source credibility, while generation-stage quality can be measured by style consistency and structural completeness. The two sets of metrics do not interfere with each other, so teams can optimize them separately.
Easier replacement. Retrieval components depend on indexing and search capabilities, while generation components depend on language capabilities. The two evolve at different speeds. With a separated design, replacing one component does not require rearchitecting the entire system.
Lower hallucination risk. Passing factual material and writing instructions separately, and requiring the generation stage to cite only information from the input material, can reduce the probability of the model fabricating content. This constraint should be stated explicitly in the prompt and verified through spot checks.
4. Selection Dimensions
Selection should not rely on overall impressions alone. It should be evaluated item by item after task decomposition. The following seven dimensions are commonly used.
- Retrieval precision: the degree to which returned results are relevant to the same question. Evaluation should use a fixed question set and manually judge whether the top results are on topic.
- Source reliability: whether each piece of information can be attributed, and whether low-quality sites and unverified reposts can be filtered out. Factual questions are most sensitive to this dimension.
- Rewriting capability: adherence to style, paragraph structure, length, and audience level. The same material can be used to generate multiple styles and compare the output differences.
- Chinese language expression: whether word choice is natural, sentence patterns fit Chinese usage, and technical terms are accurate. This dimension requires review by people familiar with the target domain.
- Latency and cost: time per call and cost based on call volume. Q&A scenarios are usually sensitive to time to first token, and multiple retrievals amplify latency, so end-to-end data should be measured.
- Controllability: whether system instructions can constrain output format, citation style, and refusal behavior. Models with poor controllability require more post-processing in production.
- Data compliance: whether input data is retained, how retention periods and purposes are defined, and whether internal data-classification rules are met. Scenarios involving customer information should prioritize this dimension.
5. Evaluation Method
The core of evaluation is building a repeatable test set. A recommended approach is to sample about two hundred real user questions covering the following types:
- Factual questions, such as the definition of a standard or the value range of a parameter;
- Comparison questions, such as the differences between two approaches;
- Procedural questions, such as the steps to execute a task;
- Time-sensitive questions, such as recently released policies or version changes.
Each test sample should record a reference answer or scoring points. The scoring metrics include the following four items:
- Answer accuracy: manual judgment of correct, partially correct, or incorrect against the reference answer.
- Source traceability rate: whether key facts in the output can be mapped to retrieved sources.
- Style consistency rate: whether the output meets the structural and tonal requirements of the specified style.
- End-to-end latency: time from submitting the question to returning the complete result, using the median and 95th percentile.
Evaluation should use blind review, meaning reviewers do not know which version produced each output. The same test set should be run repeatedly at different times, because model versions and index content change, and a single run is not enough to represent long-term performance.
6. Common Risks and Mitigation
Single source. When retrieval results are concentrated on a few sites, conclusions may be biased. The mitigation is to require the system to retrieve at least two independent sources and mark points of disagreement in the output.
Excessive rewriting. Rewriting may introduce numbers or proper nouns that are not in the source material. The mitigation is to check numbers, dates, and names in the generated output against the material item by item and block any inconsistency.
Copyright and citation. Rewriting does not mean copying the original text. The mitigation is to limit the length of any single quoted passage, retain original links, and distinguish paraphrase from quotation in the output.
Privacy leakage. User questions may contain personal information or internal data. The mitigation is to desensitize data before retrieval and set explicit retention periods for logs, with automatic deletion after expiration.
7. Rollout Steps
- Review Q&A scenarios in the business and mark whether each scenario is retrieval, generation, or both.
- Build a test set and evaluation criteria for each scenario, and complete a baseline evaluation before launch.
- Run a small-scale gray release first, record failure cases, and classify them by failure cause.
- Adjust query-rewriting rules, source-filtering rules, or generation prompts based on the classification results, changing only one item at a time to make the effect easier to judge.
- Establish a regular regression mechanism. After model versions or index content are updated, rerun the test set and compare metrics with the previous version.
Following these steps, teams can replace subjective judgment with quantifiable metrics and gradually determine the Q&A approach that fits their own business.
