Why Structure Fidelity Beats Creativity When LLMs Write Requirements

    When large language models expand requirements documents, the hard problem is not generation quality but constraint satisfaction: keep the given skeleton intact, add only traceable detail, and catch structural drift and hallucination with schemas, metrics, and deterministic checks. This article explains typical failure modes, why models overreach, how to score fidelity, and how prompt contracts plus application-layer validation turn an LLM into a predictable expander rather than a free rewriter.

    1. The real task: controlled expansion, not authorship

    In real product and engineering work, a requirements document rarely appears from a one-line prompt. People provide a functional skeleton; the model fills in detail; people merge what is usable back into the original. That workflow needs a controlled expander, not a free rewriter.

    Abstract the human input as an ordered set S = {A, B, C, D}. The expected output keeps the same top-level keys and only adds children under each key:

    1. Input: A, B, C, D
    2. Expected: A -> {A1, A2, A3}
    3. B -> {B1}
    4. C -> {C1, C2}
    5. D -> {D1, D2}

    The technical difficulty is constraint satisfaction, not raw generation: cardinality, order, and names of the top-level set must stay identical, and new content must be traceable to an existing node.

    2. Two typical failures: structural drift and content hallucination

    Observed failures fall into two classes that are far more damaging than “writing that is merely mediocre.”

    Structural drift. The model deletes user-given nodes or invents top-level items the user never proposed, often with rationales such as “this item can be derived from the other two.” Authors then have to diff line by line, restore deletions, and strip extras—often more expensive than writing by hand.

    Content hallucination. In multimodal transcription (for example, turning a screenshot of a table from a collaboration tool into structured text for coding assistants), the model may emit content that is not in the image. Even when the image is enlarged and the prompt states that the module does not include a feature, the model may still insist it exists. The danger is that the output looks compliant: correct format, complete fields—only checking the source material reveals the error.

    Both classes sit at the structure and fact layers, not style, so polish or casual retries will not fix them.

    3. Why models take liberties

    Three common sources:

    • Alignment favors “useful and complete.” Preference-aligned models tend to produce more informative answers. Adding a “derived” item is often rewarded as thoroughness, so completeness beats fidelity.
    • Attention dilution in long context. When the prompt is long and already contains document text, an early closed set is treated as “reference” rather than a hard constraint, and the model fills in modules it “thinks should exist” from domain common sense.
    • Decoding randomness. Sampling temperature and error accumulation over long outputs make later tokens more likely to violate constraints stated at the start.

    The implication is direct: constraints cannot rest on reminders alone; they need structure and validation.

    4. Measurable evaluation: turn “does it obey?” into metrics

    Do not choose models on overall impression. Build a small regression set of at least 20–50 real skeletons and track three metrics:

    Metric Definition Target
    Top-level fidelity Share of samples whose output top-level key set matches the input exactly 100%
    Hallucination rate Share of factual items in the output that cannot be traced to the source material Near 0
    Useful-addition rate Share of child items that pass human/rule review and are accepted Higher is better

    High useful-addition with poor fidelity or hallucination means the model is trading correctness for volume—unacceptable for requirements.

    5. Prompt contracts: machine-checkable format instead of natural-language pleading

    Rewriting “do not change my structure” as a parseable output contract usually beats repeated nagging:

    1. {
    2. "type": "object",
    3. "required": ["top_level", "items"],
    4. "properties": {
    5. "top_level": {
    6. "type": "array",
    7. "items": {"type": "string"},
    8. "minItems": 4, "maxItems": 4
    9. },
    10. "items": {
    11. "type": "object",
    12. "additionalProperties": false,
    13. "patternProperties": {
    14. "^[A-Z]$": {
    15. "type": "array",
    16. "items": {
    17. "type": "object",
    18. "required": ["id", "desc", "source"],
    19. "properties": {
    20. "id": {"type": "string"},
    21. "desc": {"type": "string"},
    22. "source": {"enum": ["input", "inference"]}
    23. }
    24. }
    25. }
    26. }
    27. }
    28. }
    29. }

    Three design points: top-level array length is fixed; extra properties are forbidden; every child must declare source, and anything marked inference goes to human review before merge. Fabrication becomes a data-processing issue instead of a semantic argument.

    6. Validation outside the model: do not bet on self-discipline

    Whatever general-purpose LLM you use, add a deterministic check in the application layer. Sketch:

    1. def merge(original, generated):
    2. assert set(generated["top_level"]) == set(original), "top-level structure was changed"
    3. merged = {}
    4. for key in original:
    5. merged[key] = list(original[key])
    6. for it in generated["items"].get(key, []):
    7. if it["source"] == "input":
    8. raise ValueError("label conflict: input item was regenerated")
    9. merged[key].append(it["id"]) # append only, never overwrite
    10. return merged

    “Append only” lives in code, not in the prompt—the most stable part of the pipeline. Versioned document diffs then surface any unexpected deletion immediately.

    7. Extra guards for multimodal transcription

    When turning screenshots into structured text: first run layout/table structure recognition to get candidate cells, then let the model normalize text, not invent content; require coordinates or source snippets as evidence per cell and drop items without evidence; put critical fields on a whitelist and treat everything else as hallucination. Extract, then normalize, then keep an evidence trail—more reliable than one-shot end-to-end generation.

    8. Selection and collaboration

    • Layer by task, not by leaderboard total. Constrained completion and transcription should be judged on fidelity and hallucination; open brainstorming can tolerate more divergence.
    • Treat the model as an intern. Output is a draft, not a final. Use merge gates and review.
    • Keep your own regression set. Continuous evaluation on the team’s real skeletons beats third-party bake-offs.
    • Move cost earlier. Investment in prompt contracts and validation usually beats repeated generation retries.

    9. Closing

    What requirements work needs is not “more generation,” but never moving what must stay still. Closed sets, output schemas, evidence requirements, and deterministic checks turn an unpredictable rewriter into a predictable expander—both a prompting problem and an engineering-governance problem.