Document Question Answering: Evaluation Design and Engineering Practices

    Reliable question answering over business documents requires more than a correct final answer. This article explains how to evaluate parsing, retrieval, reasoning, and evidence citation; build reproducible test sets; interpret human–AI comparisons; and integrate quality checks into release workflows. It also covers practical metrics and common evaluation pitfalls.

    1. Why Question Answering over Business Documents Is Difficult

    Document question answering allows users to ask natural-language questions and receive answers grounded in reports, spreadsheets, presentations, contracts, or scanned documents. Although it resembles ordinary reading comprehension, it is substantially harder for three reasons.

    First, document structures are complex. A single file may contain paragraphs, tables spanning multiple pages, merged cells, footnotes, charts, and handwritten annotations. A table header may appear on the previous page, while units may be specified only in the title. Scanned documents introduce recognition errors as well.

    Second, questions often require multiple reasoning steps. Consider: “Which region had the highest sales growth in 2024, and what share of nationwide sales did it account for?” The system must locate data for two years, calculate growth rates, and then calculate the relevant share. An error at any step can invalidate the final answer.

    Third, business answers require both precision and traceability. Users often need to know which page or row contains a figure and whether units and reporting definitions are consistent. A number without supporting evidence is rarely sufficient for decision-making.

    Evaluation must therefore examine each processing stage rather than simply checking whether the final answer happens to be correct.

    2. The Four Stages of a Document QA System

    A typical document QA system has four stages, each with distinct failure modes that should be evaluated separately.

    2.1 Document Parsing

    Parsing converts source files into structured content, including text blocks, table structures, page numbers, and layout coordinates. Common failures include:

    • Misaligned table rows or columns that associate values with the wrong headers.
    • Multicolumn layouts read as a single line, disrupting sentence order.
    • Recognition errors in scanned documents, such as reading “8” as “3.”
    • Headers and footers mixed into body text, interfering with retrieval.

    Parsing quality sets the ceiling for downstream performance. Once table structure has been lost, even a strong reasoning model may struggle to recover the correct answer.

    2.2 Retrieval and Evidence Localization

    Retrieval identifies passages or tables relevant to a question, typically combining keyword matching with semantic vector search. The main risks are insufficient recall, where the correct evidence never enters the candidate set, and excessive noise, where similar but irrelevant content ranks ahead of useful evidence.

    These problems are particularly common in annual reports and financial documents containing many similar tables. Tables from different years may have nearly identical structures, with only the year labels changing. Semantic retrieval can easily select the wrong version.

    2.3 Reasoning and Calculation

    The reasoning stage interprets the question, breaks it into steps, and performs calculations. Numerical questions require careful handling of units, time periods, reporting scope—such as tax-inclusive versus tax-exclusive figures or consolidated versus parent-company accounts—and rounding rules. A fluent response may still confuse percentages with absolute values.

    For calculations, a practical engineering approach is to let the model generate the calculation expression and have a deterministic calculation module execute it. This reduces arithmetic errors and makes the process easier to audit.

    2.4 Answer Generation and Evidence Citation

    The final stage presents the answer and its citations. A useful answer should include:

    1. The conclusion.
    2. Supporting evidence, such as page numbers or table locations.
    3. Any necessary assumptions.

    When evidence is insufficient, the system should explicitly abstain or state its uncertainty rather than invent figures.

    3. Core Principles of Evaluation Design

    Evaluation design underpins the quality assurance process. Three principles are especially important.

    3.1 Separate Ideal Conditions from End-to-End Conditions

    Some experiments provide the correct document pages directly and then compare AI agents with human analysts. These experiments measure the upper bound of reasoning performance. With the correct pages supplied, agents may approach or even exceed human performance on some question-answering tasks.

    However, this result assumes that retrieval has already succeeded. In a real system, both parsing and retrieval can fail. Reports must therefore specify the experimental conditions and include end-to-end results. Treating performance under ideal conditions as production performance is a common source of misleading conclusions.

    3.2 Evaluate in Layers

    Do not rely on a single overall score. At minimum, measure parsing quality, retrieval recall, and final-answer accuracy separately. When overall performance drops, these metrics help identify the stage responsible.

    3.3 Make Results Reproducible

    Other evaluators should be able to reproduce the results. This requires fixing the evaluation dataset version, recording model versions and parameters, retaining complete input and output logs, and using fixed settings for stochastic components, such as sampling temperature.

    4. Building a High-Quality Evaluation Dataset

    The quality of the dataset determines whether evaluation conclusions are trustworthy. A practical construction process includes the following steps:

    1. Define the business scenarios. Sample questions according to actual user demand, such as financial reconciliation, policy lookup, and contract clause retrieval.
    2. Prepare the documents. Cover different formats and layouts, including digitally generated files, scans, long tables, and multicolumn pages. Redact or anonymize sensitive information.
    3. Write questions and reference answers. Record the reference answer, acceptable tolerance, and evidence location for every question.
    4. Use independent annotation and adjudication. Have two annotators answer each question independently, with a third person resolving disagreements. The disagreement rate is itself an indicator of dataset quality.
    5. Classify question difficulty and type. Group questions into single-hop lookup, multi-hop reasoning, numerical calculation, and unanswerable questions. Unanswerable questions test the system’s ability to abstain.

    An illustrative evaluation record looks like this:

    1. {
    2. "id": "case_0153",
    3. "document": "2024 Annual Operating Report (Scanned)",
    4. "question": "What was the East Region's gross margin in the third quarter?",
    5. "reference_answer": "32.5%",
    6. "tolerance": "±0.1 percentage points",
    7. "evidence_locations": ["Page 12", "Table 3"],
    8. "difficulty": "Multi-hop reasoning",
    9. "annotators": ["A", "B"]
    10. }

    5. Designing the Metric Framework

    Track the following four metric categories separately.

    Answer Accuracy

    Use tolerance-based matching for numerical answers and semantic-equivalence judgments for text answers. Define scoring rules in advance and manually review a sample of automatically scored results to prevent the scoring process itself from introducing bias.

    Evidence Accuracy

    Check whether the cited evidence actually supports the answer. In compliance-sensitive settings, a correct answer with an incorrect citation is still a failure.

    Abstention and Hallucination Rates

    For unanswerable questions, measure the proportion for which the system correctly abstains. For answerable questions, measure the proportion for which it invents numbers or facts.

    These metrics must be considered separately: excessive abstention reduces usability, while hallucination creates real risk.

    Cost and Latency

    Record response time and resource consumption per question. If an accuracy improvement comes with a several-fold increase in cost, the trade-off needs to be reassessed against business requirements.

    6. Interpreting Human–AI Comparisons

    Human–AI comparisons provide a reference point, not an absolute verdict. Three considerations matter.

    First, human analysts’ performance depends on time pressure, fatigue, and familiarity with the tools. Results may differ when participants receive sufficient time and standardized tools.

    Second, AI agents’ strengths are primarily speed and consistency. They tend to handle large volumes of repetitive retrieval questions more consistently. Humans retain clear advantages in interpreting ambiguous context, assessing document credibility, and understanding business background.

    Third, comparison results should inform the division of work. For example, the system can perform initial screening and data localization, while people verify critical figures and high-risk conclusions. This collaborative approach is more practical than treating the results as a simple argument for replacement.

    7. Engineering Practice: Integrate Evaluation into Releases

    Evaluation prevents quality regressions only when it becomes part of the release process. A recommended approach is to include evaluation scripts in continuous integration and run them automatically whenever the model or parsing module changes.

    1. For each case in the evaluation dataset:
    2. document = load_document(case.document_path)
    3. result = qa_system.answer(question = case.question, document = document)
    4. correct = score(result.answer, case.reference_answer, tolerance = case.tolerance)
    5. evidence_hit = result.citation_locations intersect case.evidence_locations
    6. record(case.id, correct, evidence_hit, result.elapsed_time)
    7. Aggregate all metrics
    8. Compare with the baseline version
    9. If answer accuracy drops beyond the configured threshold,
    10. or the abstention rate rises abnormally:
    11. Block the release and notify the owner

    Additional implementation considerations include:

    • Update the baseline periodically and retain a record of each update.
    • Set thresholds by difficulty level rather than applying a single threshold to every question.
    • Run sampled production evaluations alongside offline dataset evaluations, since real-world question distributions often differ from the test set.
    • Add production failure cases to the evaluation dataset promptly to create a feedback loop.

    8. Common Evaluation Pitfalls

    Pitfall 1: Looking Only at the Overall Score

    Two versions with the same overall score may have very different strengths: one may handle tables well, while the other performs better on long-form text. A breakdown by stage and question type is needed to guide improvements.

    Pitfall 2: Substituting Ideal-Condition Results for Real-World Performance

    Providing the correct pages directly can demonstrate reasoning capability, but it does not establish production usability. Reports should include end-to-end results as well.

    Pitfall 3: Ignoring Unanswerable Questions

    Many systems appear strong because nearly every question in the test set has an answer. Adding unanswerable questions often exposes hallucination problems.

    Pitfall 4: Trusting Automated Scoring Without Review

    An automated scorer may treat “32.5%” and “32.50%” as different answers, or mistakenly accept an incorrect answer. Regular manual review of sampled results is necessary to keep metrics trustworthy.

    Pitfall 5: Treating Evaluation as a One-Time Exercise

    Document formats, business questions, and model versions all change. Evaluation datasets and metrics require ongoing maintenance to reflect actual system quality.

    Document QA creates value by reducing manual search time while keeping answers traceable. By evaluating each processing stage, defining appropriate metrics, and incorporating results into release workflows, teams can make verifiable decisions about the balance between efficiency and reliability.