A Practical Guide to LLM Question Answering and Rewriting

    This guide explains how to split LLM question answering and text rewriting into two separately evaluated pipelines. It covers key metrics for retrieval quality and style control, a minimal RAG architecture, hybrid retrieval and source tiering practices, parameterized rewriting with fidelity checks, a reproducible offline evaluation set, and common anti-patterns to avoid.

    1. The Problem: Users Want Clear Answers and Publishable Drafts

    In real content production and knowledge retrieval scenarios, most users need one of two things. The first is What + How: what something is and how to do it, with a fast conclusion and actionable steps. The second is turning existing material into a draft that is ready to publish. Why, meaning the underlying principles and causality, matters too, but it is usually a secondary need. This shapes system priorities: get retrieval accuracy and clear explanations right first, then add depth and personalized style.

    Many teams fall into the trap of looking for one model that does everything when choosing a model. A more engineering-driven approach is to decouple capabilities: retrieval and question answering provide the factual foundation, while rewriting and stylization handle the layer of expression. The two place different demands on a model, and evaluating them together tends to contaminate metrics and makes problems hard to isolate.

    2. Capability Layers: Evaluate Retrieval QA and Style Rewriting Separately

    2.1 Key Metrics for Retrieval QA

    • Answer accuracy: whether the conclusion matches authoritative sources and whether it over-infers.
    • Source reliability: whether it retrieves high-quality, traceable sources and provides verifiable citations.
    • Freshness and coverage: whether it can obtain recent material for fast-changing topics.
    • Refusal and clarification: whether it states uncertainty when evidence is insufficient instead of fabricating.

    2.2 Key Metrics for Style Rewriting

    • Semantic fidelity: facts, numbers, and qualifiers do not drift after rewriting.
    • Style control: conversational, popular-science, and Q&A drafts differ clearly in sentence length, term density, and tone.
    • Structure rearrangement: reordering paragraphs and information hierarchy without losing information.
    • Long-form consistency: terminology, person, and tense stay stable across a long text.

    Scoring both metric sets in a single table is a common reason evaluation fails. Use two independent pipelines, each with its own passing threshold.

    3. Reference Architecture: A Minimal RAG Pipeline

    A stable QA pipeline usually contains these stages:

    1. User question
    2. -> Query understanding and rewriting (fill in ellipses, split multiple intents)
    3. -> Retrieval (hybrid keyword + vector recall)
    4. -> Reranking and deduplication (weighted by source credibility and freshness)
    5. -> Evidence assembly (attach cited snippets and metadata)
    6. -> Answer generation (constrained output: conclusion first + citations)
    7. -> Verification (factual consistency, citation coverage)
    8. -> Output, or trigger clarification/refusal

    The key engineering points are evidence assembly and verification. The former determines what the model can see; the latter determines whether errors get blocked. Skip verification and the pipeline degrades quickly on long-tail questions.

    4. Retrieval Practices: From “Findable” to “Accurate”

    1. Hybrid recall. Pure keyword retrieval is good at proper nouns and numbers; pure vector retrieval is good at semantic similarity, and the two complement each other. Illustrative implementation:
    1. def hybrid_search(q, kw_top=20, vec_top=20, fuse_k=60):
    2. kw = keyword_search(q, top=kw_top)
    3. vec = vector_search(q, top=vec_top)
    4. scores = {}
    5. for lst in (kw, vec):
    6. for rank, doc in enumerate(lst):
    7. scores[doc.id] = scores.get(doc.id, 0) + 1.0 / (fuse_k + rank + 1)
    8. return sorted(scores, key=scores.get, reverse=True)
    1. Source tiering. Group sources into credibility tiers (for example, authoritative institutions, professional media, general community), weight them during reranking, and label the tier in the answer to support human review.

    2. Query rewriting. Split multi-intent questions into sub-queries, retrieve for each, then merge the evidence; complete follow-up questions with ellipses using context.

    3. Strategy for insufficient evidence. Set a citation coverage threshold; below it, output “insufficient information” and list the conditions that need to be supplied instead of forcing an answer.

    5. Rewriting Practices: Adapting One Set of Material to Multiple Styles

    Rewriting is not synonym substitution; it is information rearrangement under constraints on the target form. Parameterize the rewriting task:

    1. {
    2. "source_refs": ["doc_1", "doc_4"],
    3. "target_style": "podcast | popular_science | qa | community_post",
    4. "audience": "general | practitioner",
    5. "length": {"min": 800, "max": 1200},
    6. "constraints": ["keep all numbers and qualifiers", "do not add facts absent from the source material"]
    7. }

    Style differences can be reduced to executable rules:

    • Podcast script: mostly short sentences, conversational transitions and rhetorical questions, with a hook between paragraphs.
    • Popular-science article: analogy before definition, explain a term on first use, avoid piling up acronyms.
    • Q&A draft: one question and one answer, the first sentence of the answer is the conclusion, kept to three to five sentences.
    • Community post: conclusion first, clear bullet points, a moderate personal perspective, but facts must be traceable.

    After rewriting, run a fidelity check, especially for numbers, units, time, and conditional clauses. A low-cost approach is to extract entities and values from the source and compare them one by one against the draft to confirm they appear and are not altered:

    1. def fidelity_check(src, draft):
    2. facts = extract_facts(src) # numbers, dates, conditions, proper nouns
    3. missing = [f for f in facts if not present(draft, f)]
    4. altered = [f for f in facts if present(draft, f) and contradict(draft, f)]
    5. return {"missing": missing, "altered": altered}

    6. Evaluation: A Reproducible Offline Test Set

    Build a three-layer evaluation set: factual QA (single correct answer), open-ended QA (needs citation support), and rewriting tasks (given source material and a target style). On the QA side, measure answer accuracy, citation coverage, and refusal accuracy. On the rewriting side, measure fidelity pass rate, style discrimination accuracy (via a classifier or blind human review), and length compliance rate.

    Online monitoring is still needed after launch: the share of answers without citations, the follow-up question rate, and the correction feedback rate. These signals surface problems in the retrieval ecosystem and generation constraints earlier than offline scores do.

    7. Common Anti-Patterns

    • Using a single model for both retrieval and stylization, so the metrics mask each other.
    • Optimizing only the generation prompt without curating the corpus and tiering sources, which keeps the accuracy ceiling low.
    • Skipping the fidelity check in the rewriting stage, so numbers and qualifiers quietly drift in long text.
    • Forcing an answer when evidence is insufficient, turning uncertainty into errors that look certain.

    8. Conclusion

    Splitting retrieval QA and text rewriting into two pipelines that can be evaluated and optimized independently is the key to better overall usability. On the retrieval side, the core engineering is hybrid recall, source tiering, and evidence constraints; on the rewriting side, it is parameterizing style and adding a fidelity check. If you already use general cloud capabilities (such as object storage for the corpus, a message queue to decouple tasks, a container platform to host inference services, and logging plus monitoring and alerting for observability), you can turn this pipeline into a content production workflow that supports canary release and rollback, achieving a controllable balance among accuracy, style, and stability.