LLM Selection and Requirements Document Generation: A Practical Guide

    This guide reframes large language model selection as an engineering problem: choosing the model and supporting pipeline that reliably produce acceptable results for a given task distribution and constraints. Using requirements document writing as the main scenario, it explains why subjective impressions are unreliable, how to build a reproducible evaluation set with a weighted rubric, how to use a five-part structured prompt, and how to add automated and human fact-consistency checks. It also covers context management, cost and performance metrics, and a four-week rollout roadmap.

    1. Frame the Problem Correctly: Not “Which Is Stronger,” but “Which Fits the Task”

    Discussions about which large language model is more capable are common in developer communities, but they often stay at the level of personal experience, and the conclusions rarely transfer. A more rigorous approach is to turn the question into an engineering problem: given a task distribution and a set of constraints (cost, latency, context length, data compliance requirements), which combination of model and supporting engineering solution can reliably produce results that pass acceptance?

    Writing requirements documents is a high-value and measurable scenario. It demands long-context understanding, structured output, terminology consistency, and cross-section reference consistency at the same time, which makes it sensitive enough to reveal differences in model capability. This article therefore uses that scenario as the main thread, but the method transfers to adjacent tasks such as API documentation, test case design, and summarizing review comments.

    2. Why Subjective Experience Cannot Support Selection Decisions

    Experience-based comparisons suffer from three kinds of systematic bias.

    The first is prompt bias. The same model can perform very differently under prompts of different quality. If the two sides of a comparison use inconsistent prompt styles, the conclusion is invalid.

    The second is task bias. A single conversation that “feels better” often reflects a preference for writing style rather than factual accuracy, structural completeness, or executability.

    The third is version and configuration bias. Models keep iterating, and sampling parameters, context window size, and whether retrieval augmentation is enabled can all change results significantly. Comparisons without such controls are not reproducible.

    Conclusion: selection must rest on a reproducible evaluation process, not on the impression left by a single interaction.

    3. Build a Reproducible Evaluation Set

    Draw tasks from the historical materials of a real project to form 20 to 50 evaluation samples covering the following distribution:

    • Functional requirement descriptions (including normal and exceptional flows)
    • Non-functional requirements (performance, availability, security, observability)
    • Data model and API contract descriptions
    • Cross-module dependencies and boundary condition explanations
    • Ambiguous requirement clarification (deliberately leave information gaps and observe whether the model asks questions proactively)

    For each sample, fix the input and fix a checklist of expected points (rubric). Suggested scoring dimensions:

    Dimension Description Suggested Weight
    Factual accuracy Whether constraints or parameters absent from the source are introduced 30%
    Structural completeness Whether sections, numbering, and traceability are complete 25%
    Executability Whether engineers can schedule and implement directly from it 20%
    Terminology consistency Whether the same concept is named consistently 15%
    Clarification ability Whether key questions are raised when information is insufficient 10%

    4. Structured Prompting: Turn “Writing Requirements” into a Constrained Generation Task

    High-quality output starts with high-quality constraints. A five-part prompt works well: role, input, constraints, output template, and self-check.

    1. Role: You are a senior system analyst.
    2. Input: The following is the original meeting notes (wrapped in <source>).
    3. Constraints:
    4. 1) Use only information that appears in <source>; mark gaps as [TBD];
    5. 2) Do not add performance targets, API fields, or third-party dependencies;
    6. 3) See the glossary in <glossary> and follow it strictly.
    7. Output template:
    8. # 1 Background and Goals
    9. # 2 Scope (including explicit out-of-scope items)
    10. # 3 Functional Requirements (FR-numbers, with preconditions/main flow/exceptional flows/acceptance criteria)
    11. # 4 Non-Functional Requirements (NFR-numbers)
    12. # 5 Data and API Contracts
    13. # 6 Risks and TBD List
    14. Self-check: After output, verify constraints 1-3 one by one, list violations, and fix them.

    The key value of this template is that it turns hallucination suppression and traceability into hard constraints up front, so comparisons between models are made on the same scale.

    5. Engineering Fact-Consistency Checks

    Even with a good prompt, external validation is still needed. Three layers of defense are recommended:

    1. Generation-layer constraints: template + glossary + gap-marking mechanism.
    2. Automated validation layer: use scripts to check numbering continuity, presence of required sections, and whether terminology stays in bounds.
    1. import re
    2. def check_spec(text: str, glossary: list[str]) -> dict:
    3. fr = re.findall(r"FR-\d+", text)
    4. nfr = re.findall(r"NFR-\d+", text)
    5. return {
    6. "fr_count": len(set(fr)),
    7. "nfr_count": len(set(nfr)),
    8. "has_pending": "[TBD]" in text,
    9. "unknown_terms": [t for t in re.findall(r"[A-Za-z]{4,}", text)
    10. if t not in glossary],
    11. }
    1. Human review layer: check only high-risk sections (security, billing, data migration) sentence by sentence to reduce review cost.

    6. Context Management and Knowledge Access

    Requirements documents often span large amounts of historical material that exceed a single context window. The common approach is layered access: first produce segmented summaries as an intermediate layer, then retrieve original fragments on demand to backfill references. In engineering practice, object storage typically holds the raw materials, a message queue decouples preprocessing tasks, and logging and monitoring with alerting track task success rate and latency. If you use the relevant general capabilities of Baidu AI Cloud, you can select components along four categories: storage, compute, retrieval, and monitoring, avoiding tight coupling with business logic.

    7. Controlling Cost and Performance

    Record three metrics during evaluation: generation time per run, cost per document, and rework rate (the share of characters modified by humans). The rework rate often reflects real gains better than first-pass quality. A tiered strategy is suggested: use a lightweight configuration for batch generation of low-risk documents, and a stronger configuration plus human review for high-risk documents.

    8. Rollout Roadmap

    1. Week 1: organize historical materials and build a 30-sample evaluation set and a glossary.
    2. Week 2: complete the five-part prompt template and the automated validation script.
    3. Week 3: run the horizontal evaluation and produce a radar chart by dimension plus a rework rate comparison.
    4. Week 4: connect knowledge retrieval and monitoring to form a pipeline.
    5. Ongoing: run regression evaluation monthly to prevent quality regression caused by version changes.

    9. Conclusion

    The debate over “which model is stronger” should give way to “which solution is more stable on my task distribution.” Once the evaluation set, prompt template, automated validation, and monitoring form a closed loop, selection turns from a subjective judgment into a continuously optimizable engineering metric, and only then does the team gain a reproducible improvement in documentation productivity.