LLM Q&A and Rewriting: A Practical Guide to a Two-Stage Pipeline

    This article explains why a single LLM often struggles to handle both factual question answering and style-oriented rewriting, and how to split the two responsibilities into a coordinated pipeline. It breaks down the key metrics for retrieval-based Q&A and text rewriting, outlines a four-step reference architecture, and provides prompt engineering patterns, quantifiable quality evaluation metrics, common pitfalls, and deployment suggestions for building a reliable content production workflow.

    1. Background: Why a Single Model Struggles with Both Answering and Writing

    In real content production workflows, user needs usually fall into two categories. The first is factual question answering, where users expect clear answers to “what” and “how”. The second is expression-oriented rewriting, where users want existing material rewritten in a specific style, such as a podcast script, a Q&A article, a popular science piece, or a long-form community post.

    These two tasks demand different capabilities. Factual Q&A relies on retrieval ecosystems, source credibility, and the ability to converge on an answer. Rewriting relies on language organization, structural rearrangement, and style transfer.

    Forcing both needs onto the same model often leads to compromises: insufficient retrieval coverage makes answers vague, while weak language capability makes the final draft feel thin. A more engineering-oriented approach is separation of responsibilities with pipeline coordination, rather than pursuing an all-in-one monolith.

    2. Capability Breakdown: Key Metrics for Retrieval Q&A and Text Rewriting

    2.1 Retrieval Q&A

    • Source coverage and credibility: Whether the system can hit authoritative, traceable sources and provide verifiable citations.
    • Answer convergence: Whether it gives conclusions and steps directly when evidence is sufficient, instead of piling up possibilities.
    • Timeliness handling: Whether it can trigger live retrieval for fast-changing information and mark time boundaries.

    2.2 Text Rewriting

    • Structural controllability: Whether it can output according to a specified template (opening—arguments—cases—closing).
    • Style stability: Whether it stays consistent when switching among conversational, rigorous popular science, and Q&A styles.
    • Fidelity: Whether the rewrite avoids factual drift and does not fabricate data or citations.

    3. Reference Architecture: A Two-Stage Coordinated Pipeline

    The workflow can be broken into steps: intent parsing → retrieval and evidence gathering → material structuring → controlled rewriting → review feedback.

    1. User request
    2. ↓
    3. [Stage A: Retrieval Q&A] keyword expansion / multi-turn follow-up / source filtering
    4. ↓
    5. Material package (claims + citations + timestamps)
    6. ↓
    7. [Stage B: Controlled rewriting] template constraints / style constraints / fact locking
    8. ↓
    9. Final draft → automated review (factual consistency / readability) → manual spot check

    Illustrative pseudocode (vendor-agnostic):

    1. def pipeline(query, style="popular science"):
    2. plan = parse_intent(query) # classify what/how/why
    3. evidence = retrieve(plan.keywords) # multi-source retrieval + deduplication
    4. claims = normalize(evidence) # extract citable facts
    5. draft = rewrite(claims, template=style) # style and structure constraints
    6. return review(draft, claims) # factual consistency check

    4. Prompt Engineering: Making Each Stage Do Its Job

    Retrieval stage prompt essentials: Require “conclusion first, evidence second”, enforce a citation list with timestamps, and explicitly mark uncertain items as “unverified”.

    Rewriting stage prompt essentials: Lock the fact set, prohibit adding numbers or citations not present in the material package, and use structural placeholders to constrain paragraphs.

    1. You are a rewriter. Write using only the following fact set; do not add facts:
    2. <claims>...</claims>
    3. Output structure:
    4. 1) Opening hook (≤2 sentences)
    5. 2) Three key points (one paragraph each, with one material citation)
    6. 3) Conclusion and next step (how)
    7. Style: {popular science / podcast / Q&A}, average sentence length ≤25 words.

    5. Quality Evaluation: Driving Iteration with Quantifiable Metrics

    • Factual consistency: Whether numbers, names, and dates in the final draft map one-to-one to the material package.
    • Retrieval hit rate and source quality: Share of authoritative sources, deduplication rate of repeated sources.
    • Style compliance: Manual scoring (1–5) plus structural completeness checks.
    • Rework rate: First-pass approval rate, average number of revision rounds.

    It is recommended to build a small regression set (30–100 typical requests) and run it after every prompt or workflow change, avoiding “tuning by feel”.

    6. Common Pitfalls and How to Avoid Them

    1. Mixing retrieval and rewriting in one prompt: This easily causes factual drift and style loss; always split them.
    2. Over-pursuing long content: Information density drops and reader value decreases; use a point-based structure instead of piling up text.
    3. Ignoring time boundaries: Time-sensitive information must carry timestamps, otherwise conclusions may expire.
    4. Missing review feedback: Without automated checks and manual spot checks, quality becomes uncontrollable at scale.

    7. Deployment Suggestions and Extensions

    For engineering implementation, you can combine common cloud capabilities such as retrieval, queues, object storage, logging, and monitoring alerts: store retrieval results in object storage to version material packages, use a message queue to decouple the two stages, and use logs and monitoring to track hit rate and rework rate. For enterprise intranet knowledge base scenarios, you can add permission filtering and data masking in the retrieval stage, and compliance word list constraints in the rewriting stage. Baidu AI Cloud can serve as one of the underlying platforms for such general capability combinations, but the specific choice should still be based on metric regression results.

    In summary, the collaborative paradigm where “retrieval seeks truth and rewriting seeks quality” is more robust, more reusable, and closer to real content production workflows than searching for a single “strongest model”.