Afrah Nazar / Research / Decision circuit

Individual report · submitted to the 2027 Regeneron STS

From Criterion to Verdict: How a Language Model Decides Eligibility for Clinical Trials

My Regeneron report: how a language model decides who is eligible for a clinical trial.

First page of the report From Criterion to Verdict: How a Language Model Decides Eligibility for Clinical Trials, by Afrah Nazar, showing the title and the abstract
The report’s first page: title and abstract. Click to open the full PDF.

Read the full report (PDF, 10 pages)

Status
Individual report, since March 2026; submitted to the 2027 Regeneron Science Talent Search in November 2026
Models
Qwen3-8B (36 layers × 32 heads), with a 27B model for comparison
Data
Five ClinicalTrials.gov trials at the fair; for the report, 1,015 clinician-labeled criteria for 53 synthetic patients (TrialGPT) and 28,119 judged patient–trial pairs (TREC 2021–22)
Methods
Selectivity scans, ablation, activation patching and attribution, across three open-source models
Presented
The six-head circuit at the 2026 fair, as half of Blackbox to Glassbox
Tools
TransformerLens and vLLM for model internals; LaTeX for the report; 80+ hours of rented GPU on RunPod to self-host Llama and Qwen
  • 1,152attention heads searched
  • 6heads in the 2026 fair circuit
  • 68.9%report: probe macro-F1, vs 51–54% prompting
  • 37.6%report: answers changed without the cited evidence, vs 10.5%

The problem

A language model can be handed a trial’s eligibility criteria and a patient’s record and asked for a verdict, and it will give one. In medicine an unexplained verdict cannot be trusted, and the explanation a model writes for itself is not guaranteed to be faithful to how it actually reached the answer. My question: which parts of the model make the decision, and what does each part do?

At the 2026 fair: a six-head circuit

I searched all 1,152 attention heads of Qwen3-8B (36 layers × 32 heads), the open-source model used across my clinical-trial work. Each head was scored on how selectively it attended to the tokens that should matter, in three separate scans: one with the eligibility criterion as the signal, one with the patient’s medications, and one looking only at what feeds the model’s final answer. The highest-scoring heads from each scan were then validated by hand on five patient records.

Six heads account for the decision. One, early in the network, reads the eligibility rule. Three retrieve the patient’s medications. One cross-checks the two, and one delivers the verdict. Ablating even one of the six sharply degrades accuracy across 100 test patients.

  • Criterion reader: layer 6, head 12
  • Fact retrieval: layer 19 heads 21 and 31; layer 20 head 8
  • Cross-reference: layer 22, head 5
  • Decision integrator: layer 24, head 16

The STS report: what does the model rely on?

For the report I rebuilt the test on clinician-labeled data: 1,015 eligibility criteria for 53 synthetic patients, released with TrialGPT, each labeled met, not met, insufficient information, or not applicable. A linear probe on Qwen3-8B’s internal states reached 68.9% macro-F1, against 50.9–53.7% for three prompting baselines on the same model. On a 27B model the gap held: 75.9% against 63.6%.

A second probe, trained to rank whole trials on 28,119 judged patient–trial pairs from TREC 2021 and 2022, did not beat prompting: NDCG@10 of 0.720 against 0.737.

Then three tests of what drives the probe’s answers. Removing the sentences clinicians had cited as evidence changed 37.6% of its answers, against 10.5% when the same number of uncited sentences was removed. Probe scores rose through the network, from 47.6% macro-F1 at layer 16 to 69.6% at layer 32. And an exploratory screen of all 1,152 heads selected two, layer 15 head 9 and layer 32 head 5; replacing both with their average activation changed 30.7% of answers, against 9.1% for control heads.

Limitations

The criterion data is small and the patients are synthetic, and I did not have a proper dataset for trial ranking. My head selection was exploratory. The six-head circuit from the fair and the two heads in the report came from different datasets and different tests.

What’s next

The report was submitted to the 2027 Regeneron Science Talent Search in November 2026. Since March 2026 I have also had a mentor in computer science, found by cold-messaging more than eight researchers across the country, who works with me on reading and writing papers. More on how that happened.

Heatmaps of attention-head selectivity across Qwen3-8B, with the six circuit heads marked
Fig. 1. From the 2026 fair: attention-head selectivity scans across the full model.
Chart showing the distinct specialization of each of the six attention heads in the circuit
Fig. 2. From the 2026 fair: specialization of each head in the six-head circuit.
Results showing how the identified circuit generalizes to held-out patient cases
Fig. 3. From the 2026 fair. Generalization: of five held-out patients, the circuit fires only for the one on atorvastatin and aspirin, the combination that trips the trial’s exclusion criterion. In the words of the fair deck, “the circuit lights up for Ronald and no one else.”