ta5946/Spin

A prototype LLM system for detecting "spin" by comparing primary and reported clinical trial outcomes.

Python

0

49 commits

updated Feb 12, 2026

See the code

README

Detecting spin in clinical trials with large language models

Thesis: https://repozitorij.uni-lj.si/IzpisGradiva.php?id=169018&lang=eng

Abstract: Spin in research reports includes reporting practices that distort the presentation of results. This is particularly critical in medicine, where spin is present in more than 50% of randomized controlled trials (RCT) that fail to reach the threshold of statistical significance. Comparing declared and reported outcomes is crucial for detecting various types of spin, such as selective reporting. We developed a system for automatic detection of spin in clinical trials. We used 300 pairs of outcomes, labeled with semantic similarity. We evaluated baseline statistical models, masked language models (MLM) and generative large language models (LLM). We generated similarity scores and used Youden index to determine the classification threshold. The proposed approach to comparing outcomes using LLMs involves prompt engineering, generating similarity scores based on token probabilities and majority voting. The results on the test set of 2500 examples, with 90% accuracy and F1 score of 78%, outperform dedicated models for semantic similarity evaluation, but trail behind fine-tuned versions of BERT model. An advantage of our approach is the ability to generate explanations for the classified examples.

2026 update 🆕: We evaluated MedGemma-4b-it and got results similar to BioMistral. Maybe this model would be useful for explaining medical terminology and classified examples.

Language models

OLMo-7B-Instruct

Mistral-7B-Instruct-v0.2

BioMistral-7B-DARE

MedGemma-4b-it

Meta-Llama-3-8B-Instruct

Gpt-4-Turbo

Dataset

  • Labeled pairs of primary and reported outcomes of PubMed clinical trial abstracts.
  • 100 pairs for few shot examples and threshold tuning.
  • 2600 pairs for prompt tuning and model evaluation.
  • Biased towards negative examples, where the reported outcome does not match the primary outcome.
distribution

Note: Authors of the original paper used 3043 pairs of outcomes. After deduplication by attributes out1, out2 and label the dataset consists of 2796 rows.

Prompt templates

Zero shot

  • Sentence template:
<|endoftext|><|user|>
Are the sentences semantically similar? Answer with either Yes or No.

First sentence: {out1}

Second sentence: {out2}

Answer:
<|assistant|>
  • Outcome template:
<|endoftext|><|user|>
Does the reported outcome match the defined primary outcome? Answer with either Yes or No.
                                                
Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>
  • Role template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.
                                                
Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>
  • Article definition template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Outcome switching is an unjustified change of the predefined trial outcomes, leading to reporting only the favourable outcomes that support the hypothesis of the researchers. Outcome switching is one of the most common types of spin. It can consist in omitting the primary outcome in the results and conclusions of the abstract, or in the focus on significant secondary outcomes.

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.

Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>
  • Wikipedia definition template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Outcome switching is the practice of changing the primary or secondary outcomes of a clinical trial after its initiation. An outcome is the goal of the clinical trial, such as survival after five years for cancer treatment. Outcome switching can lead to bias and undermine the reliability of the trial, for instance when outcomes are switched after researchers already have access to trial data. That way researchers can cherry pick an outcome which is statistically significant.

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.

Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>
  • Chain of thought template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Does the reported outcome match the defined primary outcome? Lets think step by step.

Primary outcome: {out1}

Reported outcome: {out2}

Steps:
<|assistant|>

One shot

  • Random and similar example template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.

Primary outcome: {example_out1}

Reported outcome: {example_out2}

Answer: {example_ans}

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.

Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>

Few shot

More provided examples did not improve the auc score.

Separation results

Baseline models

ModelAuc score
Constant classifier0.500
Random classifier0.417
Lemmas similarity0.831
Stems similarity0.871
Levenshtein distance0.801
Sequence similarity0.850
Spacy embeddings0.711
Word2Vec embeddings0.814
Path similarity0.745
Leacock Chodorow similarity0.732
Wu Palmer similarity0.735
SciBert embeddings0.782
Sentence transformers embeddings0.884

Large language models

Auc scoreOlmoMistralBioMistralLlama
Sentence template0.8970.8780.8930.875
Outcome template0.9220.9080.9310.939
Role template0.9120.9060.9190.920
Article definition template0.8970.9220.9070.931
Wikipedia definition template0.8840.9080.9080.934
Negative example template0.8980.8990.9170.883
Positive example template0.9000.9060.9210.884
Random example template0.9070.8920.8810.860
Similar example template0.8800.8740.9030.823

Note: Model role is a part of the user prompt, except in the case of Llama that uses a dedicated system prompt.

Key takeaways:

  • Domain specific BioMistral is most effective with minimal prompt engineering.
  • State of the art Llama 3 excels at understanding complex prompts.
  • Olmo and Mistral are relatively stable in their predictions.
distribution

Classification results

Olmo

distribution1 distribution2

Mistral

distribution1 distribution2

BioMistral

distribution1 distribution2

Llama

distribution1 distribution2

Note: Model bias is corrected by adjusting the threshold based on Youdens J statistic.

Top models

ModelAccuracyF1 scorePrediction time
Stems similarity0.8300.6910.07 s
Sentence transformers embeddings0.8750.7062.52 s
Olmo role prompt0.8700.72364.50 s
Mistral role prompt0.8100.64272.09 s
BioMistral role prompt0.8400.67371.31 s
Llama role prompt0.8800.69273.23 s
Voting classifier (Olmo, Mistral, BioMistral)0.8550.713-
Voting classifier (Olmo, BioMistral, Llama)0.8850.729-

Note: Combination of diverse language models achieves the highest classification accuracy.

Mistake analysis

Primary outcomeReported outcomeLabelOlmo predictionMistake interpretation
log HbA 1cglycaemic control10model lacks medical terminology
blood pressuresystolic BP01model lacks medical terminology
difference in plasma bone marker concentration between treatment groupsmarkers of bone formation or resorption01model lacks reasoning capacity
intra-operative painpain control01model lacks reasoning capacity
1) defecation frequency > 3/week; 2) normalization of stool consistency; 3) no more painful defecationpainful defecation01model accepts less detailed reported outcome
response ratesresponse rates to a postal health questionnaire10model rejects more detailed reported outcome
pain severity and knee range of motion (ROM)pain01dataset inconsistency
the throughput times length of ED stay (LOS)times10dataset inconsistency

Key takeaways:

  • BioMistral is more effective for examples containing medical terminology.
  • Llama is more effective for examples requiring complex reasoning.

Edge analysis

Adjusted Olmo threshold is 0.1 and examples close to this value are considered to be on the edge of classification.

Primary outcomeReported outcomeLabelOlmo scoreOlmo predictionExample interpretation
absence of parasites and clinical signs on days 14 and 28, and good clinical and biological tolerabilityclinical and parasitological response rate00.0200similar concepts
the proportion of patients with plasma HIV-1 RNA levels < 200 copies/mL at week 24virologic suppression00.0470similar concepts
sucrose/pacifier effect on pain reductioneffective00.0530similar phrases
improved PFS for the maintenance phasepromising PFS10.2021similar phrases
health-related quality of life (HRQOL)6-minute walking distance00.2021model confusion

Key takeaways:

  • Olmo edge examples are often based on phrase similarity.
  • BioMistral edge examples are often based on concept similarity.

Mistake fix

The prompt is adjusted to reject generalized reported outcomes.

  • Detail template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Primary outcome is defined at the start of a clinical trial and is the observed variable of the study.
This outcome is later reported in the results section of the report.
The reported outcome should match the defined primary outcome.
That means it should include all its components and details.

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.

Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>
ModelThresholdAuc scoreAccuracyF1 score
Olmo detail prompt0.30.9060.8850.729
Mistral detail prompt0.40.9320.8850.716
BioMistral detail prompt0.10.9220.8250.679
Llama detail prompt0.10.9310.8300.393
Voting classifier (Olmo, Mistral, BioMistral)--0.9150.809
Fine tuned Bert classifier---0.868

Key takeaways:

  • Llama is the only model that is too sensitive to the prompt change.
  • Combination of the rest achieves by far the best f1 score.
distribution

Explanation results

Open ended

  • Explanation template:
<|endoftext|><|user|>
Why? Explain your answer in one sentence.
            
Explanation:
<|assistant|>
Primary outcomeReported outcomeOlmo predictionOlmo explanation
pain severity and knee range of motion (ROM)pain0The reported outcome is "pain," but the defined primary outcome was "pain severity and knee range of motion (ROM)." The reported outcome does not include the specific components of pain severity, and it does not mention knee ROM. Therefore, the reported outcome does not match the defined primary outcome.
instrumental birthintervention during labour and delivery0The reported outcome, "intervention during labour and delivery," is broader in scope than the defined primary outcome, "instrumental birth." The primary outcome focuses on the specific method of birth control, while the reported outcome encompasses various interventions and events that occur during labor and delivery.
the total stool weight in grams during hospitalizationthe mean stool weight during hospital stay1The reported outcome, "the mean stool weight during hospital stay," is a measure of the total stool weight during hospitalization, which was the defined primary outcome. The reported outcome includes all components of the primary outcome, such as the total weight, which validates that it is a match.
a reduction in depressionGDS scores1The reported outcome, GDS scores, are a measure of depression, which is the primary outcome in this clinical trial. The GDS is a well-known and widely used tool to assess depression in elderly individuals. Therefore, the reported outcome matches the defined primary outcome.

Multiple choice

Probabilistic selection of the provided explanations did not reach the desired results.

References

biomedicine
nlp
sentence-similarity

ta5946/Spin

A prototype LLM system for detecting "spin" by comparing primary and reported clinical trial outcomes.

Python

0

49 commits

updated Feb 12, 2026

See the code

README

Detecting spin in clinical trials with large language models

Thesis: https://repozitorij.uni-lj.si/IzpisGradiva.php?id=169018&lang=eng

Abstract: Spin in research reports includes reporting practices that distort the presentation of results. This is particularly critical in medicine, where spin is present in more than 50% of randomized controlled trials (RCT) that fail to reach the threshold of statistical significance. Comparing declared and reported outcomes is crucial for detecting various types of spin, such as selective reporting. We developed a system for automatic detection of spin in clinical trials. We used 300 pairs of outcomes, labeled with semantic similarity. We evaluated baseline statistical models, masked language models (MLM) and generative large language models (LLM). We generated similarity scores and used Youden index to determine the classification threshold. The proposed approach to comparing outcomes using LLMs involves prompt engineering, generating similarity scores based on token probabilities and majority voting. The results on the test set of 2500 examples, with 90% accuracy and F1 score of 78%, outperform dedicated models for semantic similarity evaluation, but trail behind fine-tuned versions of BERT model. An advantage of our approach is the ability to generate explanations for the classified examples.

2026 update 🆕: We evaluated MedGemma-4b-it and got results similar to BioMistral. Maybe this model would be useful for explaining medical terminology and classified examples.

Language models

OLMo-7B-Instruct

Mistral-7B-Instruct-v0.2

BioMistral-7B-DARE

MedGemma-4b-it

Meta-Llama-3-8B-Instruct

Gpt-4-Turbo

Dataset

  • Labeled pairs of primary and reported outcomes of PubMed clinical trial abstracts.
  • 100 pairs for few shot examples and threshold tuning.
  • 2600 pairs for prompt tuning and model evaluation.
  • Biased towards negative examples, where the reported outcome does not match the primary outcome.
distribution

Note: Authors of the original paper used 3043 pairs of outcomes. After deduplication by attributes out1, out2 and label the dataset consists of 2796 rows.

Prompt templates

Zero shot

  • Sentence template:
<|endoftext|><|user|>
Are the sentences semantically similar? Answer with either Yes or No.

First sentence: {out1}

Second sentence: {out2}

Answer:
<|assistant|>
  • Outcome template:
<|endoftext|><|user|>
Does the reported outcome match the defined primary outcome? Answer with either Yes or No.
                                                
Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>
  • Role template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.
                                                
Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>
  • Article definition template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Outcome switching is an unjustified change of the predefined trial outcomes, leading to reporting only the favourable outcomes that support the hypothesis of the researchers. Outcome switching is one of the most common types of spin. It can consist in omitting the primary outcome in the results and conclusions of the abstract, or in the focus on significant secondary outcomes.

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.

Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>
  • Wikipedia definition template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Outcome switching is the practice of changing the primary or secondary outcomes of a clinical trial after its initiation. An outcome is the goal of the clinical trial, such as survival after five years for cancer treatment. Outcome switching can lead to bias and undermine the reliability of the trial, for instance when outcomes are switched after researchers already have access to trial data. That way researchers can cherry pick an outcome which is statistically significant.

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.

Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>
  • Chain of thought template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Does the reported outcome match the defined primary outcome? Lets think step by step.

Primary outcome: {out1}

Reported outcome: {out2}

Steps:
<|assistant|>

One shot

  • Random and similar example template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.

Primary outcome: {example_out1}

Reported outcome: {example_out2}

Answer: {example_ans}

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.

Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>

Few shot

More provided examples did not improve the auc score.

Separation results

Baseline models

ModelAuc score
Constant classifier0.500
Random classifier0.417
Lemmas similarity0.831
Stems similarity0.871
Levenshtein distance0.801
Sequence similarity0.850
Spacy embeddings0.711
Word2Vec embeddings0.814
Path similarity0.745
Leacock Chodorow similarity0.732
Wu Palmer similarity0.735
SciBert embeddings0.782
Sentence transformers embeddings0.884

Large language models

Auc scoreOlmoMistralBioMistralLlama
Sentence template0.8970.8780.8930.875
Outcome template0.9220.9080.9310.939
Role template0.9120.9060.9190.920
Article definition template0.8970.9220.9070.931
Wikipedia definition template0.8840.9080.9080.934
Negative example template0.8980.8990.9170.883
Positive example template0.9000.9060.9210.884
Random example template0.9070.8920.8810.860
Similar example template0.8800.8740.9030.823

Note: Model role is a part of the user prompt, except in the case of Llama that uses a dedicated system prompt.

Key takeaways:

  • Domain specific BioMistral is most effective with minimal prompt engineering.
  • State of the art Llama 3 excels at understanding complex prompts.
  • Olmo and Mistral are relatively stable in their predictions.
distribution

Classification results

Olmo

distribution1 distribution2

Mistral

distribution1 distribution2

BioMistral

distribution1 distribution2

Llama

distribution1 distribution2

Note: Model bias is corrected by adjusting the threshold based on Youdens J statistic.

Top models

ModelAccuracyF1 scorePrediction time
Stems similarity0.8300.6910.07 s
Sentence transformers embeddings0.8750.7062.52 s
Olmo role prompt0.8700.72364.50 s
Mistral role prompt0.8100.64272.09 s
BioMistral role prompt0.8400.67371.31 s
Llama role prompt0.8800.69273.23 s
Voting classifier (Olmo, Mistral, BioMistral)0.8550.713-
Voting classifier (Olmo, BioMistral, Llama)0.8850.729-

Note: Combination of diverse language models achieves the highest classification accuracy.

Mistake analysis

Primary outcomeReported outcomeLabelOlmo predictionMistake interpretation
log HbA 1cglycaemic control10model lacks medical terminology
blood pressuresystolic BP01model lacks medical terminology
difference in plasma bone marker concentration between treatment groupsmarkers of bone formation or resorption01model lacks reasoning capacity
intra-operative painpain control01model lacks reasoning capacity
1) defecation frequency > 3/week; 2) normalization of stool consistency; 3) no more painful defecationpainful defecation01model accepts less detailed reported outcome
response ratesresponse rates to a postal health questionnaire10model rejects more detailed reported outcome
pain severity and knee range of motion (ROM)pain01dataset inconsistency
the throughput times length of ED stay (LOS)times10dataset inconsistency

Key takeaways:

  • BioMistral is more effective for examples containing medical terminology.
  • Llama is more effective for examples requiring complex reasoning.

Edge analysis

Adjusted Olmo threshold is 0.1 and examples close to this value are considered to be on the edge of classification.

Primary outcomeReported outcomeLabelOlmo scoreOlmo predictionExample interpretation
absence of parasites and clinical signs on days 14 and 28, and good clinical and biological tolerabilityclinical and parasitological response rate00.0200similar concepts
the proportion of patients with plasma HIV-1 RNA levels < 200 copies/mL at week 24virologic suppression00.0470similar concepts
sucrose/pacifier effect on pain reductioneffective00.0530similar phrases
improved PFS for the maintenance phasepromising PFS10.2021similar phrases
health-related quality of life (HRQOL)6-minute walking distance00.2021model confusion

Key takeaways:

  • Olmo edge examples are often based on phrase similarity.
  • BioMistral edge examples are often based on concept similarity.

Mistake fix

The prompt is adjusted to reject generalized reported outcomes.

  • Detail template:
<|endoftext|><|user|>
You are a clinical trial report reviewer. Your task is to detect incorrectly reported outcomes.

---

Primary outcome is defined at the start of a clinical trial and is the observed variable of the study.
This outcome is later reported in the results section of the report.
The reported outcome should match the defined primary outcome.
That means it should include all its components and details.

---

Does the reported outcome match the defined primary outcome? Answer with either Yes or No.

Primary outcome: {out1}

Reported outcome: {out2}

Answer:
<|assistant|>
ModelThresholdAuc scoreAccuracyF1 score
Olmo detail prompt0.30.9060.8850.729
Mistral detail prompt0.40.9320.8850.716
BioMistral detail prompt0.10.9220.8250.679
Llama detail prompt0.10.9310.8300.393
Voting classifier (Olmo, Mistral, BioMistral)--0.9150.809
Fine tuned Bert classifier---0.868

Key takeaways:

  • Llama is the only model that is too sensitive to the prompt change.
  • Combination of the rest achieves by far the best f1 score.
distribution

Explanation results

Open ended

  • Explanation template:
<|endoftext|><|user|>
Why? Explain your answer in one sentence.
            
Explanation:
<|assistant|>
Primary outcomeReported outcomeOlmo predictionOlmo explanation
pain severity and knee range of motion (ROM)pain0The reported outcome is "pain," but the defined primary outcome was "pain severity and knee range of motion (ROM)." The reported outcome does not include the specific components of pain severity, and it does not mention knee ROM. Therefore, the reported outcome does not match the defined primary outcome.
instrumental birthintervention during labour and delivery0The reported outcome, "intervention during labour and delivery," is broader in scope than the defined primary outcome, "instrumental birth." The primary outcome focuses on the specific method of birth control, while the reported outcome encompasses various interventions and events that occur during labor and delivery.
the total stool weight in grams during hospitalizationthe mean stool weight during hospital stay1The reported outcome, "the mean stool weight during hospital stay," is a measure of the total stool weight during hospitalization, which was the defined primary outcome. The reported outcome includes all components of the primary outcome, such as the total weight, which validates that it is a match.
a reduction in depressionGDS scores1The reported outcome, GDS scores, are a measure of depression, which is the primary outcome in this clinical trial. The GDS is a well-known and widely used tool to assess depression in elderly individuals. Therefore, the reported outcome matches the defined primary outcome.

Multiple choice

Probabilistic selection of the provided explanations did not reach the desired results.

References

biomedicine
nlp
sentence-similarity