A Deployed Framework for Structured Clinical Extraction from Multi-Turn Health Conversations: From Model Selection to Scenario-Based Release Gating

Read the publication

Background

Conversational health agents in low- and middle-income country settings generate clinically important information as unstructured, multi-turn dialogue. Converting them into structured records is difficult: extraction is stochastic, disclosures may be corrected across turns, uncertain models can silently omit fields, and unsafe inference can create false clinical facts. Aggregate benchmarks identify promising models but do not establish release stability or characterize field-level risk.

Methods

We describe a structured-extraction framework deployed across four HIV programmes in South Africa and Zimbabwe (one also covering TB) that together have served more than 170,000 users. An LLM extracts canonical values into programme-specific schemas drawn from 137 declared fields; deterministic code derives fixed clinical mappings and field-level validation preserves unaffected outputs. A benchmark of 398 counselor- and clinician-annotated conversations selects candidate models. Before release, 134 scenariobased tests across 14 clinical categories repeatedly evaluate complete production configurations. Structured-record assertions are checked deterministically, while conversationdependent behavior is evaluated by an operational LLM reporter that is itself audited.

Results:

The selected primary and incumbent were nearly tied on the aggregate benchmark, but critical-field analysis exposed an HIV-status omission deficit. A within-sample rerun under a later configuration changed the critical-field model ordering, the incumbent regressing while the primary remained stable; the aggregate score again concealed the change. Across 356 matched scenario-programme cells, the primary passed 8.4 percentage points more cells than the deployed cross-provider fallback. The fallback also produced substantially more fabrications, including 20 unsupported HIV-status assertions against one. Removing both static guidance layers reduced stable-pass rate from 87.3% to 63.9%; layerseparation experiments showed that guardrails and field descriptions provide overlapping protection. Auditing the reporter against direct record checks exposed defects in the test specifications, the evidence supplied to the reporter, the comparison rules and the reporter itself; correcting the gate left the model ordering and failover conclusions unchanged.

Conclusions:

Reliable deployment required more than model selection. It required layered safeguards, repeated configuration-level release gating, analysis of error composition, and validation of the gate itself. Assertions encoded in the structured record should be checked deterministically, with LLM judgment reserved for conversation-dependent behavior.

[see full publication at the link above, below are selected excerpts from the paper]

3.1 System overview and the dual-pass design

During an active conversation the product issues four LLM calls per user message (summary, per-message (PM) extraction, function calling, response), and a separate end-of-conversation (EoC) extraction runs once after the conversation closes. Only the two extraction calls are in scope. Figure 1 shows the end-to-end dataflow. The two passes share 18 core guardrail blocks; the EoC prompt composes further field-specific blocks for fields absent from the smaller PM schema.

Fig. 1. End-to-end extraction dataflow (Section 3.1).

Active schemas vary by programme. In the releases evaluated here, the PM pass (∼50 fields) runs on every user message; its outputs steer the live conversation and feed the Section 3.5 escalation, making it blocking and latency-sensitive. Each programme’s active schema held 106 to 117 top-level fields drawn from 137 declared; counting nested custom-object attributes separately, 192 elements carry a field description. The EoC pass runs once with the full programme-specific schema and six custom object types on a lower-cost service tier, and serves as the authoritative record for downstream programme workflows. Within a conversation the final EoC record supersedes the PM record. The subsequent write into the longitudinal profile applies merge rules that prevent an unknown from overwriting a known value; the remaining reconciliation and provenance rules are in supplement Part 5, and alternatives to post-hoc validation (constrained decoding, fine-tuning, self-consistency voting) in Part 4.

Cost, latency, and query composition. The programmes run under a binding perpatient cost constraint and the per-message pass is synchronous, so its latency is user-visible: each pass is a single call returning all applicable fields under a stable, cacheable prefix, with inference-time reasoning disabled on both. Guidance sits at the most structural layer that can express it: schema constraints for representation, field descriptions for field-local semantics, and prompt guardrails for cross-field reasoning. All three stay static so the prefix caches; Section 5.4 examines the last two.

4.2. Annotated benchmark (selection tier)

Dataset. 398 real counseling conversations from two of the four deployed programmes, Aimee (291) and Self-Cav (107), both in South Africa, collected from March to November 2025 (Aimee pilot) and from May 2025 to January 2026 (Self-Cav). They were annotated by trained HIV testing services counselors and clinicians, one annotator per conversation, so inter-annotator agreement could not be estimated (Section 7).

Fig. 2. Reliability loop from candidate selection to deployment. The quarterly benchmark ranks candidate models (Section 4.2); repeated scenario-based testing then gates each production configuration, checking unconditional record assertions deterministically before the operational reporter evaluates conversation-dependent behavior (Sections 4.1 and 5.5). The figure shows the corrected deterministic-first gate, with the historical gate audited in Section 5.5. Field-specific failover policy is supported by the evidence but is not yet deployed, and downstream human-review performance is not evaluated in this paper.

6. Discussion and Conclusion

The deployable unit is the complete production configuration, not the model alone. Fieldlevel analysis exposed a hiv_status deficit concealed by the aggregate and documented a change in model ordering under a later configuration. A validator change also improved the fallback without a prompt edit. Benchmarking identifies viable candidates; release gating must evaluate the model together with its prompt, schema and validation layer.

The failover comparison shows why a single global ranking is insufficient. The two models differed moderately in stable-pass rate but much more sharply in fabrication and substitution, and those failures do not carry interchangeable consequences in a clinical record. A fallback may remain usable for some fields while safety-critical fields are set to unknown or routed for review. That policy is not yet implemented.

No single safeguard accounted for the system’s reliability. Guardrails had the larger isolated effect but field descriptions provided backup when guardrails were absent, and selective requiredness, deterministic derivation and field-level recovery protect at different stages. The relevant comparison is therefore between complete configurations, not between base models stripped of the structures they run under.

The release gate had failure modes of its own: some disagreements arose from the reporter, others from drift between prose criteria and structured expectations or from incomplete evidence supplied to it. Assertions encoded in a field should be checked deterministically, and judgment reserved for conversation-dependent behavior the record cannot encode. Together these results support the continuing loop of Figure 2: production failures expand the suite, changes are re-tested, and configuration and instruments are both reviewed.

Future work. Implement the field-specific failover controls these results support, adopt a sequential release rule for high-risk fields, hold out a frozen scenario set, strengthen the reference standard through independent re-annotation, evaluate longitudinal merge correctness and escalation performance, and test transfer across languages and tasks.

 
Next
Next

Acceptability and usability of home-based HIV and blood glucose self-testing and home-based blood pressure measurement in Kenya, South Africa, and Zambia