Skip to main content
Back

Warsaw University Study Shows Random Forests Still Beat LLMs on Medical Research Screening

A systematic study of prompting recipes, few-shot selection, and output processing for classifying medical abstracts finds LLMs match but rarely beat naive Bayes.

Pro

Paper, Full Access
  • Systematic study tests LLMs on 15 biomedical screening datasets for systematic reviews
  • Reading first-token probabilities beats parsing text output, lifting AUPRC from 0.23 to 0.36
  • Few-shot with similarity-based retrieval helps, but gains plateau after three examples
  • Chain of thought, tree of thoughts, and chunking failed to beat plain few-shot prompting
  • Tuned random forest (0.556 AUPRC) still beats every LLM tested, including GPT-4.1 mini
  • Code and datasets released on Zenodo for full reproducibility

A new study out of Warsaw University of Technology puts large language models through an unusually thorough wringer on a niche but practically important task: deciding whether a biomedical paper belongs in a systematic literature review. The paper tests dozens of prompt, output, and few-shot configurations across 15 real screening datasets, and lands on a somewhat humbling conclusion. LLMs can classify medical abstracts respectably without training data, but they still struggle to beat a well tuned random forest.

Why abstract screening is a hard test

Systematic reviews are the backbone of evidence-based medicine, and building one starts with humans reading thousands of abstracts to decide which papers meet inclusion criteria. In the Drug Class Review datasets articles were rejected due to inadequate quality, i.e., failure to meet certain criteria (among rejection reasons were: "wrong outcome", "wrong population", "wrong study design"). That makes it harder than typical topical classification: every abstract in a dataset is already about the drug in question, so the model has to judge study design and quality, not just topic.

The authors evaluated on 15 Drug Class Review datasets covering topics like ACE inhibitors, statins, and beta blockers. Class imbalance is severe on some, with positive rates as low as 2.2 percent for skeletal muscle relaxants and 2.4 percent for opioids, which is exactly where naive accuracy scores mislead.

The setup they actually tested

Most prior LLM-as-classifier papers stop at accuracy and F1 on a train-test split. This one pushes further, using stratified 5-fold cross-validation and reporting area under the precision-recall curve (AUPRC) so you can see what happens across decision thresholds. The lineup:

  • Four open source models: Llama 3.1 8B Instruct, Llama 3.1 70B Instruct, Gemma 2 9B, and Mistral 7B v0.3, plus GPT-4.1 mini and GPT-4.1 nano in the final comparison
  • Six prompt variants ranging from a one-line question to a multi-sentence expert persona
  • Five output processing methods, including asking for a JSON answer, asking for a 0-5 score, and reading the raw probability of the first output token
  • Few-shot counts from 0 to 4, with example selection by random draw or by cosine similarity in three different sentence-transformer embedding spaces
  • Chain of thought (one and two calls), tree of thoughts, and chunk-then-aggregate

The trick that actually moved the needle

The clearest win came from a small implementation detail rather than fancier prompting. Instead of parsing the model's text output for "yes" or "no," the authors read the probability distribution over the first generated token, summed the probabilities of tokens that spell each class, and normalized. Processing model output by calculating class probabilities based on first token probabilities has proven to produce the best class probabilities, as shown by the AUPRC score being significantly higher for this output method, than for other tested methods.

Averaged across models and datasets, AUPRC jumped from 0.228 with plain word output to 0.362 with token-probability output in the zero-shot setting. This also gives you something conventional text classifiers give for free but LLM pipelines usually throw away: a tunable confidence score for adjusting the decision threshold when misclassification costs are asymmetric.

Few-shot helps, but only a little

Going from zero-shot to one-shot lifted average AUPRC from 0.363 to 0.428. Going from one to three examples added another 0.04. The fourth example added nothing. All of them achieve considerably better results than random selection. Enforcing a class balance among the examples turned out not to be an effective strategy. The specific embedding model used for retrieval barely mattered, so all-MiniLM-L6-v2 is a reasonable default.

More strikingly, the elaborate reasoning techniques flopped. Chain of thought, tree of thoughts, and chunking all underperformed the plain few-shot baseline on AUPRC despite using far more compute.

How LLMs stack up against boring baselines

Here is the comparison developers will actually care about, averaged across 15 datasets:

ClassifierAUPRC
Random forest (tuned)0.556
SciDeBERTa-v2 (fine-tuned)0.531
Random forest (default)0.513
Naive Bayes0.499
Llama 3.1 8B (best config)0.495
Llama 3.1 70B (best config)0.485
DeBERTa (fine-tuned)0.474
Gemma 2 9B0.469
GPT-4.1 nano0.439
GPT-4.1 mini0.335

Two surprises stand out. Surprisingly, the 8B variant performed slightly better than the much larger 70B variant, though Llama 3.1 70B achieved better results in all other performance scores. And a noticeable anomaly is the smaller and cheaper model GPT-4.1 nano having better AUPRC score than GPT-4.1 mini on all datasets. Bigger and pricier is not automatically better when your task is picky domain classification.

When to reach for an LLM anyway

If you already have thousands of labeled abstracts, a bag-of-words random forest will beat every LLM tested here while running on a laptop. LLMs earn their keep when labels are scarce or nonexistent, when class definitions are easier to write in English than to demonstrate with examples, or when you want a single system that generalizes across many review topics without retraining. The practical recipe the paper endorses:

  1. Put the task description in the system message and a direct question plus the abstract in the user message
  2. Pull three examples by embedding similarity from whatever labeled data you have
  3. Read the first-token probabilities to get calibrated confidence scores
  4. Skip chain of thought and chunking, they cost more and help less

Code, processed datasets, and full results are on Zenodo, which makes this one of the few LLM classification studies you can actually reproduce end to end.