WA Health Summary

Washington Health Summary (WAHS) · AI strategy

WAHS AI architecture and model strategy.

When a patient asks about their health record, the AI needs the right parts of that record. It must never see another patient’s data, large records still have to fit, and the answer should not take long. This page explains the approach the UW CIRG & WAHS team chose and the evidence behind it.

Updated November 2026 · Written for the whole project team · Developers: Engine reference

Key decisions

  1. Condense the record first. The engine shrinks the patient’s record into a short, numbered summary and sends it to the model with the question, in one call.
  2. A small middle service does that work. The WAHS engine sits between the WAHS app and the model server, so the app stays simple and the model can be swapped.
  3. One model for the pilot: Gemma 4 12B. It scored within 1.6 points of the largest model tested and gave the fewest unsafe answers.

90 to 99%

Reduction in record size after the engine condenses it.

67.2 → 80.5

Gemma 4 12B score out of 100, without and with the engine. Unsafe answers fell from 7 to 2 of 36.

2.5 to 4 s

Median wait for a follow-up answer on the shared GPU server in testing.

On this page
  1. System components
  2. Worked example
  3. Approaches compared
  4. Test evidence
  5. Model selection
  6. Design clarifications
  7. Project status
  8. Glossary
  9. Technical reference

System components

Three components with separate responsibilities

A question passes through three components. Each can change without touching the other two.

  1. CIRG · patient-facing app

    WAHS app

    • Shows the chat and the record.
    • Keeps the conversation in the browser.
    • Sends each question through its own server, never straight to the model.
  2. This project · middle service

    WAHS engine

    • Fetches the signed-in patient’s current record.
    • Condenses it and adds clinical knowledge for the question.
    • Returns the answer with links to source records.

    Reads from the record store using the patient’s own sign-in. The engine has no access of its own, so it can only ever receive that patient’s records.

  3. UW CIRG GPU server · or an agency’s own

    Model server

    • Runs the open-weight model, Gemma 4 12B by default.
    • Keeps nothing between requests.
    • Can be any server that speaks the standard OpenAI chat format.
The app does not call the model directly, for three reasons. The model server cannot check who is asking. A raw record is too large: on big charts the start of the record was cut off and answers scored 0 to 2.8 out of 100. And the answer would carry no links back to source records.

Worked example

Tracing “What are my diabetes labs?” through six steps

Steps 2 to 5 happen inside the engine and take about a tenth of a second. Almost all of the wait is the model writing its answer.

  1. The app sends the question.

    It goes with the conversation so far and the patient’s sign-in token. The app does not send the record itself.

  2. The engine fetches the patient’s current record. Checked every question

    It asks the record store with the patient’s own token and checks whether anything changed. Unchanged data is reused from memory.

  3. The engine condenses the record. Same for every question

    The record shrinks by 90 to 99% into a numbered list. Allergies, active medications and active problems are kept first. Anything left out is counted in a note at the top, so nothing disappears silently.

  4. The engine adds clinical knowledge for this question. Changes with the question

    A short block is picked to match the question: which tests count as diabetes labs, and how this patient’s conditions, medications and labs connect.

  5. The engine looks up relevant items that were left out. Only when needed

    When the condensed chart had to drop items, the engine searches the full record for matches to the question and attaches the closest ones.

  6. The model answers, and the answer streams back.

    Each claim carries a number such as [12] that opens the exact source record in the app. If the record does not hold the answer, the model is told to say so.

The three parts of the model input

Part 1 · The condensed chart · same for every question

[1] Patient summary
[2] Completeness note: what, if anything, was left out
[4] Type 2 diabetes (active)
[12] HbA1c 7.8%
[14] eGFR 44
… more numbered entries

Part 2 · The conversation so far

Part 3 · For this question · changes each time

Diabetes labs include HbA1c, fasting glucose, eGFR and urine albumin.
Type 2 diabetes [4] is monitored by HbA1c 7.8% [12] and eGFR 44 [14].
Question: What are my diabetes labs?
Illustration only, not a patient record. Because Part 1 does not change between questions, the model server can reuse its work on it. That is why follow-up answers are faster than the first one.

Approaches compared

Condensation is the pilot default; note search and model queries build on it

A raw health record is far too large to hand to a small model. One multi-year test record is 18.4 MB, and real exports can reach 100 to 200 MB. The team compared three ways to give the model what it needs. They are not rivals: the second and third still need condensation.

Tested · best overall

2. Condensation with note search

Method
Keep the condensed chart. For long notes, find the passages that match the question and add only those.
Strengths
Hospital and specialist notes of 4,000 to 14,000 tokens, and very large records.
Limitations
One more step per question, so answers take a little longer.
Test result
Passed 76% of checks, the highest of the three.
Tested · needs a large model

3. Model-written record queries

Method
The model writes its own searches against the record store, then reads what comes back.
Strengths
Huge records, when the model is strong enough to write correct medical codes.
Limitations
Smaller models pick wrong codes. It needs guardrails on every search and takes several steps.
Test result
Passed 61% overall, but 96% on the largest model.

Results are from 384 test runs on four models. An answer passes only if it meets every automated check: the expected clinical facts, the size limit and the citation rules. Sending the raw record with no engine passed 19% and leaked private items in 12 of 12 sharing tests. Retrieval and portability report

Test evidence

Five findings that support the design

Tested on 18 record bundles from 10 patients, including synthetic multi-clinic records and real de-identified hospital records.

Condensing removes 90 to 99% of a record and keeps the safety core

Condensing removed 90 to 99.4% of the size and kept the full safety core: allergies, active medications, active problems and implants. An 18.4 MB record fits in 8,000 tokens, and every omitted item is counted.

The engine looks up omitted items before calling the model

This covers the case where the answer sits in a part of the record that was left out. On very small summaries, the lookup raised Gemma 4 12B from 47.0 to 68.2 out of 100, with no unsafe answers.

Added clinical knowledge helps models of 4B and larger

Small models do not know lab codes or drug interactions. Adding clinical rules improved accuracy. Adding the patient’s own links between conditions, medications and labs cut unsafe answers by 43 to 71%.

An overfull model silently drops the start of the chart

This is why the engine condenses the record instead of sending a very large chart. On a shared GPU with a 16k limit, sending 32k to 128k of chart text erased allergies and medications, and scores fell to 0 to 2.8 out of 100.

Citation rules limit guessing by the model

Every claim must cite a source record, and the model must say when the record has no answer. In tests built to pressure it into guessing, Gemma 4 12B gave 2 unsafe answers in 36 and no made-up citations.

Model selection

Gemma 4 12B is the pilot model; the engine improves seven of nine models

Nine open-weight models answered the same 36 clinical questions, first with the condensed chart alone and then through the full engine. Two judge models graded the answers without knowing which setup produced them.

Score out of 100, before and after adding the engine

Condensed chart alone Through the full engine

  • Gemma 4 26BGoogle 71.3 → 82.1Unsafe: 6 → 3 of 36
  • Gemma 4 12BGooglePilot model 67.2 → 80.5Unsafe: 7 → 2 of 36
  • Gemma 4 E4BGoogle · smallest that works 62.8 → 70.4Unsafe: 8 → 4 of 36
  • Qwen 3 14BAlibaba 53.4 → 65.4Unsafe: 13 → 5 of 36
  • Qwen 3.5 9BAlibaba 49.4 → 57.1Unsafe: 12 → 10 of 36
  • Llama 3.1 8BMeta 50.6 → 55.3Unsafe: 14 → 8 of 36
  • Qwen 3 4BAlibaba 34.7 → 43.5Unsafe: 12 → 8 of 36
  • Hermes 3 8BNous · no gain 43.3 → 43.0Unsafe: 11 → 8 of 36
  • Llama 3.2 3BMeta · got worse 44.2 → 33.8Unsafe: 9 → 15 of 36

Gemma 4 12B fits a one-model pilot

It is within 1.6 points of the 26B model and gave the fewest unsafe answers of any setup.

The engine improves most models

Seven of nine scored higher through the engine, and eight of nine gave fewer unsafe answers.

Models below 4B are not sufficient

The 3B model got worse with more to read. Treat 4B (Gemma 4 E4B) as the minimum.

The score combines the judges’ grades, weighted toward accuracy and completeness, with points taken off for unsafe answers and citation errors. A middle setup (chart plus clinical rules, without the patient links) and the full table are in the nine-model report .

Design clarifications

Nine points on sessions, data handling and deployment

These points were raised in project meetings. Full detail is in the Engine reference.

The chat session is kept in the patient’s browser

On each turn the app sends the conversation so far. Neither the engine nor the model server keeps a copy, and there is no session ID. Starting a new chat clears the browser’s copy.

Sessions and scope

No new database holds patient data

The engine holds the condensed chart in memory to save time, tied to the signed-in patient, and loses it on restart. Before real records are used, prompt logging on the model server is turned off.

The KV cache is a speed feature and cannot cross patients

The KV cache is the model’s short-term memory of text it has just read. It is not the knowledge base (KB). The model skips re-reading only when a new request starts with exactly the same text. Every request starts with one patient’s own chart, so another patient’s request cannot match it.

The chart is rebuilt when the record store reports a change

The engine checks the record store on every question. When the store reports that part of the record has changed, only that part is fetched again and the chart is condensed again. This takes about a tenth of a second.

Chart size is a setting, about 8,000 tokens by default

The size is a setting called the token budget. A token is about three-quarters of a word. The default is about 8,000 tokens, and the app can request a different size. It does not change with the question. Smaller charts are faster but leave more out.

Clinical knowledge is selected for each question

The engine selects clinical guidelines and patient graph links that match the question in the Layer-3 suffix without a hardcoded 800-token cap. When tests compared chart sizes, the questions and the knowledge base were held fixed so that size was the only thing changing.

Med Agent Hub and the WAHS engine share the same core code

Med Agent Hub is the research workbench where approaches are built and benchmarked. The WAHS engine is a small service holding only what WAHS needs to run. Both use the same core code, so a result measured in the Hub applies to the engine.

The model and the front end can be replaced

Both sides of the engine use the standard OpenAI chat format. Pointing it at a different model or server is a configuration change, tested with no code edits. An agency that must use its own approved model can do so.

The pilot runs on a 35 GB slice of a shared GPU

The GPU is a shared UW CIRG server. How many people can chat at once depends on a server setting that trades speed against memory. That setting is being tuned for the pilot.

Project status

The engine is built and verified in the development setup

  • The engine runs as its own small service.
  • It reads records only with the patient’s sign-in.
  • The web app and a mobile front end both reach it through their own servers, in the development setup.
  • Automated checks for cross-patient leaks and stale charts pass.
  • The three approaches were compared across 384 runs.

Each item links to its evidence in the build record .

Glossary

Terms used on this page

FHIR
The standard format health systems use to exchange records. It is detailed and very wordy, which is why records need condensing.
Condensed chart
The short, numbered summary of a patient’s record that the engine builds for the model.
Token, token budget
Models measure text in tokens, each about three-quarters of a word. The token budget is the size limit for the condensed chart.
Safety core
Allergies, active medications, active problems and implants. These are kept first at every chart size.
Citation [N]
A number in the answer that opens the source record it came from.
Knowledge base (KB)
Clinical reference rules the engine can add to a question, such as which labs relate to diabetes.
Overflow lookup
A search of the full record for items the condensed chart left out. It runs only when something was left out. The reference calls it Tier-0.
Note search
Finding the passages in long clinical notes that match the question and adding only those. Engineers call this retrieval, or RAG.
KV cache
The model’s short-term memory of text it has just read. A speed feature, and not the knowledge base.
WAHS engine
The middle service this page describes. In code it is wahs-engine, built on a shared core called wahs_core.
Record store
Where patient records live: a FHIR server behind a gatekeeper (fhir-auth) that returns only the signed-in patient’s records.
Open-weight model
A model whose files can be downloaded and run on servers the team controls.

Technical reference

Engine documentation for builders and reviewers

Wire contract

The request and response format between the app’s server and the engine.

Build record

Each milestone with its status and a link to the code or test that backs it.

Also: sandbox walkthrough · live sandbox · engine source code · all evaluation reports

Back to top