Choosing In-Context Examples for Radiology Report Generation by Fact-Level Payoff

When a language model is given a few worked examples in its prompt and asked to do a task (in-context learning), which examples it sees matters a great deal. The best methods for choosing those examples were built for classification. They score a candidate example by how much it raises the probability of the correct labels on other inputs. Open-ended generation has no label to raise. In medicine, the most natural replacement, the probability of the reference text, rewards examples that teach phrasing rather than correctness. "No pleural effusion" and "pleural effusion" differ by one token of likelihood but by everything clinically.

This proposal replaces the missing label with a domain-trained notion of meaning. We score candidate example sets by how much they improve the facts in the model's outputs on held-out probe cases. Facts are measured in an embedding space that a domain-pretrained radiology encoder learned specifically to separate contradictions. We then ask a sharp question: does selecting examples by fact-level payoff produce more clinically correct radiology impressions than selecting by input similarity or by reference likelihood? If the answer is yes, it is direct evidence that classification-era in-context techniques can carry over to generation once a domain metric stands in for the label.

Core Claim

Finding Support Examples for In-Context Learning introduced LENS, which first filters candidate examples by how well each one helps predict other examples' labels (its InfoScore) and then runs a diversity-guided beam search over example sets. LENS raised average accuracy on eight classification benchmarks from 44.2% with random examples to 69.8%. The authors note that how such "support examples" work in open-ended generation is unknown. Our claim is that the LENS recipe transfers to generation if its label-likelihood utility is replaced by a set-level utility computed in a domain fact space:

$$U(S) = \frac{1}{|P|}\sum_{(x,y)\in P} \mathrm{FactSim}\big(G(x \mid S),\, y\big),$$

The symbols are as follows. $S$ is a candidate set of demonstrations. $P$ is a small probe set of findings sections $x$ paired with reference impressions $y$. $G(x \mid S)$ is the impression the model generates when prompted with $S$. $\mathrm{FactSim}$ is the fact-aligned similarity score of Extracting and Encoding. That paper splits reports into atomic clinical statements, encodes them with CXRFE (CXR-BERT further pre-trained with triplet and natural language inference objectives), and aligns the facts.

The encoder's role here is new. Messina et al. built CXRFE as a post-hoc evaluation metric, reaching 89.8% accuracy on RadNLI, above GPT-4 with chain-of-thought. We use it as the selection signal at prompt-construction time. Domain-specific pre-training therefore enters as the thing that makes the signal trustworthy. A generic encoder places contradictory sentences nearly on top of each other, so it cannot provide this signal.

Research Program

The primary task is impression generation from the findings section of MIMIC-CXR reports (MIMIC-CXR). Outputs are short, and they hinge on negation and on which findings are clinically salient. We deliberately work in a low-label regime: a labeled pool of 2,000 findings–impression pairs, a 64-case probe set, and a disjoint test set of several thousand studies. This matches the realistic case of a new site with its own reporting style and only a few hundred to a few thousand curated pairs.

Selection follows LENS's two-stage structure to keep cost bounded. In the filter stage, each pool example is scored as a one-shot demonstration on 16 probes. With impressions of roughly 30 tokens, this is about 32k short decodes. The top 100 examples move on to the search stage. There, a beam search over 4-shot sets maximizes $U(S)$ on the full probe set, with LENS's diversity term. The output is a single fixed demonstration set used for every test case. We also study a per-query variant, in which the beam is seeded by the nearest neighbors of the query, to test whether a fixed fact-optimized set or input-specific retrieval matters more.

The domain pre-training direction contributes a second factor beyond the encoder: the generator itself. We run every selection method on Llama-3.1-8B-Instruct and on a copy given continued pre-training on MIMIC-CXR training reports plus PubMed abstracts. Test studies are excluded from that corpus. We follow the BioBART finding (BioBART) that scrambling sentence order hurts biomedical generation, so documents are kept in their natural order. The question is whether fact-targeted demonstrations matter less once the model already "speaks radiology", or more, because a domain model can make use of factual cues that a general model treats as formatting.

Two cheap ablations test the metric itself. First, we swap cosine for Spearman rank correlation inside the fact-matching step, following Correlation Coefficients and Semantic Textual Similarity. That paper reports that rank correlation beats cosine on non-normal embeddings (52.8 vs 46.2 on RW-STANFORD; 74.89 vs 70.18 on STS14 tweet-news), and triplet-trained encoders like CXRFE plausibly produce exactly such heavy-tailed spaces. Second, we replace CXRFE with generic BERT sentence embeddings, which isolates whether the domain-trained space is doing the work.

This work belongs to a broader effort to move classification-era techniques into generation. The best-studied branch is activation steering, which adds a fixed direction to the model's hidden states. On news summarization, steering hits a quality cliff at strength two and above (Beyond Multiple Choice). Dynamic schemes such as DIRECTER and SADI rely on the model's own logits or fixed contrastive masks. Those papers motivate the general problem but use generic models and generic metrics. We do not touch activations at all. Choosing demonstrations leaves the model's internal computation intact, which avoids the cliff entirely, and it works on models whose weights cannot be accessed.

Baselines

The naive reference points are zero-shot generation with a task instruction and four randomly drawn demonstrations, averaged over ten random draws. The ten draws also expose the order and selection variance that LENS reported in classification.

The strongest existing competitor is nearest-neighbor retrieval: for each test query, pick the four pool examples whose findings sections are closest to the query in an embedding space. We run it with CXR-BERT embeddings so it has access to the same domain pre-training as our method, and also with a generic encoder. It is the strongest baseline because similar findings often imply similar impressions, and it costs nothing at selection time. We count it as beaten only if our method improves the independent clinical metrics described below by a margin that holds across three random choices of pool and probe set.

The second key baseline is the cheap way to adapt LENS to generation. It uses the same filter-then-search procedure and the same compute budget, but its utility is the teacher-forced log-likelihood of reference impressions, with no decoding. This is the ablation that isolates our key ingredient. Both methods share the search procedure and the pool and differ only in the utility function. A method beats it if it produces fewer negation and omission errors at matched average output length.

We also include LoRA fine-tuning of the same backbone on the same 2,000 pairs, with a small learning-rate sweep. This baseline is the realistic alternative whenever weights are available. As a ceiling, we include the same model fine-tuned on the full MIMIC-CXR training set.

There is no reported in-context result for MIMIC-CXR impression generation on Lacuna. The closest reported numbers in the file are CXRFE's 89.8% RadNLI accuracy, which validates the selection signal rather than a generator, and LENS's 69.8% average classification accuracy. All baselines receive identical prompts, decoding settings (greedy, fixed maximum length), and pool access. The two search-based methods receive the same number of model calls.

Why not just…?

Why not just retrieve the most similar past reports as examples? This is the real threat. It may win outright on routine studies. Our hypothesis is that it fails on a specific subpopulation: queries whose nearest neighbors have similar findings but a different conclusion, for example the same opacity read as atelectasis in one report and pneumonia in another. In those cases retrieval copies the wrong conclusion. We will stratify test cases by whether the retrieved neighbors' impressions agree with the query's reference, using labels from the CheXpert labeler (reported F1 of 0.973 for pleural effusion mentions in MIMIC-CXR). If fact-utility selection does not beat retrieval on the disagreement stratum, the idea fails. The per-query hybrid also tests whether the two signals are complementary.

Why not just use reference likelihood as the utility, which is far cheaper? If per-example likelihood utility and fact utility rank candidates almost identically, the expensive decoding step buys nothing. We will therefore report the rank correlation between the two utilities over the 2,000-example pool before running any search. If that correlation is high, above about 0.8, we will drop fact-level scoring and report the cheap method as the finding. Our expectation that it will be lower rests on a single observation: likelihood barely registers the negation tokens that dominate clinical errors.

Why not just fine-tune with LoRA on the 2,000 pairs? With weights available and this much data, fine-tuning may well win on absolute scores. A Comparative Study of PEFT Methods for Python Code Generation suggests the backbone's pre-training matters more than the adaptation method, which makes the comparison worth running rather than presuming. We will report pool sizes of 200, 500, and 2,000. The claim narrows honestly if LoRA dominates throughout: demonstration selection would then matter mainly for closed models and for rapid restyling to a new site without retraining.

Why not just sample several impressions and rerank them by agreement with the findings? This is complementary rather than competing. It costs N decodes per test query, whereas our search cost is paid once. We run the reranker, with CXRFE scoring each output's facts against the input findings, both on top of random demonstrations and on top of our selected set, to show whether the gains add up.

Proposed Experiments

Selecting with CXRFE and then evaluating with CXRFE would be circular, so the headline metrics are independent of the selector. The first is agreement between CheXpert-labeler outputs on generated and reference impressions across the 14 observations (macro F1, with positive, negative, and uncertain mentions kept separate). The second is RadGraph F1. The third is a targeted negation-error rate on studies where the reference asserts the absence of a finding. CXRFEScore is reported but flagged as the optimized quantity. A board-certified radiologist will blindly rate 200 test impressions from retrieval, likelihood selection, and fact selection for clinically significant errors. This rating is the decisive check.

The analysis has three parts. The first is the cross-arm generator comparison, which establishes whether domain pre-training of the generator changes the size of the selection gain. The second is the generic-encoder and Spearman-versus-cosine ablations, which establish whether the domain-trained metric space is necessary. The third is a secondary run on MeQSum consumer-health question summarization, where no fact encoder exists and selection must fall back on likelihood or generic embeddings. The only Lacuna reference point there is BioBART-Large fine-tuned at 53.15 Rouge-L, against 51.05 for general BART-Large (BioBART). MeQSum tests whether the selection procedure helps at all without a domain metric, which bears on whether the domain encoder or the search procedure carries the effect.

The proposal succeeds if fact-utility selection beats nearest-neighbor retrieval and likelihood selection on CheXpert agreement and on radiologist-rated significant errors, with the advantage concentrated where neighbors disagree. It fails if the two utilities are highly correlated or if retrieval matches it on the disagreement stratum.