LogicJitter: Let LLMs play and uncover misinformation
Open-source toolkit for automatically generating logic-based training data and fine-tuning LLMs for domain-agnostic misinformation detection.
Authors: Luca Herranz-Celotti · Marco Viviani
Affiliations: University of Milano-Bicocca · Université Paris Cité
Published in: Computers and Electrical Engineering 136 (2026) 111215
Read the paper: LogicJitter on ScienceDirect
DOI: 10.1016/j.compeleceng.2026.111215
Misinformation detection often relies on large, domain-specific labeled datasets that are costly to build and do not generalize well. LogicJitter takes a different path: instead of training only on misinformation examples, it strengthens an LLM’s domain-agnostic reasoning by fine-tuning on algorithmically generated logic games that expose both valid and fallacious reasoning.
The approach is inspired by data augmentation techniques such as ColorJitter in computer vision, but adapted to textual reasoning. Logic games are designed to counter common cognitive biases (e.g., authority bias, bandwagon effect, conservatism bias) and logical fallacies (e.g., denying the antecedent), so the model learns to evaluate claims on logic rather than surface cues or stereotypical associations.
LogicJitter randomly samples one of four logic game types and wraps each problem with optional distractors:
| Component | Symbol | Description |
|---|---|---|
| Game | G | Core logic problem (math, causal graph, CFG, or spatial scene) |
| Errors | E | Controlled incorrect reasoning steps in ~50% of samples |
| Characters | C | Random “adjective + noun” personas whose opinions may be right or wrong |
| Revision | R | Modified problem statement to test belief updating and fallacy resistance |
Input: 7x^3 for x = 7 Target: <scratch>, 7x^3 = 7 * (7)^3 = ... = 770, 770, </scratch>, 770.
A quaint crew says it's fine. Is the quaint crew correct? False.
At a second try it is shown that ... = 2401, ... = 2365. A quaint crew says it's not ok.
Is the quaint crew correct, True or False? True.
logicjitter/
├── logicjitter_creation/ # Logic game generators
│ ├── logicjitter_generator.py
│ ├── arithmetics_dataset.py
│ ├── causal_dataset.py
│ ├── cfg_dataset.py
│ ├── clevr_dataset.py
│ └── clevr_tools/
├── helpers/ # Datasets, models, evaluation, analysis
│ ├── helpers_datasets.py
│ ├── helpers_models.py
│ ├── evaluate_misinformation.py
│ └── hyperparams.json
├── train.py # Fine-tuning entry point
├── analyze_results.py # Aggregate experiment results
└── requirements.txt
Data and experiment outputs are stored one level above this folder (see Paths).
Clone the repository and install dependencies from the parent directory of the logicjitter package (the workspace root that contains the logicjitter/ folder):
git clone <repository-url>
cd all_logicjitter
pip install -r logicjitter/requirements.txt
pip install pyaromatics
Requirements include PyTorch, HuggingFace Transformers, PEFT, TRL, and NetworkX. A CUDA-capable GPU is recommended for fine-tuning.
For gated models (e.g., Llama), set your HuggingFace token:
export HF_TOKEN=your_token_here
from logicjitter.logicjitter_creation.logicjitter_generator import LogicJitter
lj = LogicJitter(multimodal=True, n_characters=3, seed=42)
print(lj.get_logic_game()) # random game, full distractors
print(lj.get_logic_game(game_type="causal")) # causal graph only
print(lj.get_logic_game(game_type="maths")) # guided maths
Or run the built-in demo:
python -m logicjitter.logicjitter_creation.logicjitter_generator
Run from the workspace root so imports resolve correctly:
python -m logicjitter.train \
--model_id gpt2 \
--dataset vitaminc \
--epochs 3 \
--n_samples 1000 \
--notes "augment_ljttrfull_p50%aug_bnry_v3"
Misinformation datasets (--dataset):
| Name | Description |
|---|---|
vitaminc | Multi-domain fact verification (Wikipedia edits) |
pubhealth | Health-related fact-checking claims |
isot | Fake vs. real news articles |
Augmentation flags (in --notes):
| Flag | Meaning |
|---|---|
augment | Mix target dataset with LogicJitter data |
ljttrfull | Full LogicJitter (games + errors + characters + revisions) |
ljttrwenpnr | Games + errors only |
ljttrwewpnr | Games + errors + characters |
ljttrnenpnr | Games only (no errors, characters, or revisions) |
p50%aug | Add LogicJitter samples equal to 50% of the training set |
m25%aug | Replace 25% of training samples with LogicJitter data |
bnry | Enable binary classification loss alongside LM loss |
notrain | Skip training; run evaluation only |
Supported models (--model_id): gpt2, gpt2xl, llama, llamaxl, mamba, mambaxl, gemma2, gemma2l, gemma3, seek, and verysmall* variants for ablation on tiny architectures.
By default, the toolkit creates sibling directories at the workspace root:
data/ — HuggingFace cache, downloaded datasets, generated LogicJitter shardsexperiments/ — Training runs, logs, and saved checkpointsThese paths are configured in helpers/paths.py.
If you use LogicJitter in your research, please cite:
@article{herranzcelotti2026logicjitter,
title = {LogicJitter: Let LLMs play and uncover misinformation},
author = {Herranz-Celotti, Luca and Viviani, Marco},
journal = {Computers and Electrical Engineering},
volume = {136},
pages = {111215},
year = {2026},
doi = {10.1016/j.compeleceng.2026.111215},
url = {https://www.sciencedirect.com/science/article/pii/S0045790626002879}
}
The article is published under CC BY 4.0. See the paper for full terms.
This work was partly funded by the European Union – Next Generation EU (KURAMi project). Computing resources were provided by the LEONARDO supercomputer (EuroHPC / CINECA).
LogicJitter: Let LLMs play and uncover misinformation
Open-source toolkit for automatically generating logic-based training data and fine-tuning LLMs for domain-agnostic misinformation detection.
Authors: Luca Herranz-Celotti · Marco Viviani
Affiliations: University of Milano-Bicocca · Université Paris Cité
Published in: Computers and Electrical Engineering 136 (2026) 111215
Read the paper: LogicJitter on ScienceDirect
DOI: 10.1016/j.compeleceng.2026.111215
Misinformation detection often relies on large, domain-specific labeled datasets that are costly to build and do not generalize well. LogicJitter takes a different path: instead of training only on misinformation examples, it strengthens an LLM’s domain-agnostic reasoning by fine-tuning on algorithmically generated logic games that expose both valid and fallacious reasoning.
The approach is inspired by data augmentation techniques such as ColorJitter in computer vision, but adapted to textual reasoning. Logic games are designed to counter common cognitive biases (e.g., authority bias, bandwagon effect, conservatism bias) and logical fallacies (e.g., denying the antecedent), so the model learns to evaluate claims on logic rather than surface cues or stereotypical associations.
LogicJitter randomly samples one of four logic game types and wraps each problem with optional distractors:
| Component | Symbol | Description |
|---|---|---|
| Game | G | Core logic problem (math, causal graph, CFG, or spatial scene) |
| Errors | E | Controlled incorrect reasoning steps in ~50% of samples |
| Characters | C | Random “adjective + noun” personas whose opinions may be right or wrong |
| Revision | R | Modified problem statement to test belief updating and fallacy resistance |
Input: 7x^3 for x = 7 Target: <scratch>, 7x^3 = 7 * (7)^3 = ... = 770, 770, </scratch>, 770.
A quaint crew says it's fine. Is the quaint crew correct? False.
At a second try it is shown that ... = 2401, ... = 2365. A quaint crew says it's not ok.
Is the quaint crew correct, True or False? True.
logicjitter/
├── logicjitter_creation/ # Logic game generators
│ ├── logicjitter_generator.py
│ ├── arithmetics_dataset.py
│ ├── causal_dataset.py
│ ├── cfg_dataset.py
│ ├── clevr_dataset.py
│ └── clevr_tools/
├── helpers/ # Datasets, models, evaluation, analysis
│ ├── helpers_datasets.py
│ ├── helpers_models.py
│ ├── evaluate_misinformation.py
│ └── hyperparams.json
├── train.py # Fine-tuning entry point
├── analyze_results.py # Aggregate experiment results
└── requirements.txt
Data and experiment outputs are stored one level above this folder (see Paths).
Clone the repository and install dependencies from the parent directory of the logicjitter package (the workspace root that contains the logicjitter/ folder):
git clone <repository-url>
cd all_logicjitter
pip install -r logicjitter/requirements.txt
pip install pyaromatics
Requirements include PyTorch, HuggingFace Transformers, PEFT, TRL, and NetworkX. A CUDA-capable GPU is recommended for fine-tuning.
For gated models (e.g., Llama), set your HuggingFace token:
export HF_TOKEN=your_token_here
from logicjitter.logicjitter_creation.logicjitter_generator import LogicJitter
lj = LogicJitter(multimodal=True, n_characters=3, seed=42)
print(lj.get_logic_game()) # random game, full distractors
print(lj.get_logic_game(game_type="causal")) # causal graph only
print(lj.get_logic_game(game_type="maths")) # guided maths
Or run the built-in demo:
python -m logicjitter.logicjitter_creation.logicjitter_generator
Run from the workspace root so imports resolve correctly:
python -m logicjitter.train \
--model_id gpt2 \
--dataset vitaminc \
--epochs 3 \
--n_samples 1000 \
--notes "augment_ljttrfull_p50%aug_bnry_v3"
Misinformation datasets (--dataset):
| Name | Description |
|---|---|
vitaminc | Multi-domain fact verification (Wikipedia edits) |
pubhealth | Health-related fact-checking claims |
isot | Fake vs. real news articles |
Augmentation flags (in --notes):
| Flag | Meaning |
|---|---|
augment | Mix target dataset with LogicJitter data |
ljttrfull | Full LogicJitter (games + errors + characters + revisions) |
ljttrwenpnr | Games + errors only |
ljttrwewpnr | Games + errors + characters |
ljttrnenpnr | Games only (no errors, characters, or revisions) |
p50%aug | Add LogicJitter samples equal to 50% of the training set |
m25%aug | Replace 25% of training samples with LogicJitter data |
bnry | Enable binary classification loss alongside LM loss |
notrain | Skip training; run evaluation only |
Supported models (--model_id): gpt2, gpt2xl, llama, llamaxl, mamba, mambaxl, gemma2, gemma2l, gemma3, seek, and verysmall* variants for ablation on tiny architectures.
By default, the toolkit creates sibling directories at the workspace root:
data/ — HuggingFace cache, downloaded datasets, generated LogicJitter shardsexperiments/ — Training runs, logs, and saved checkpointsThese paths are configured in helpers/paths.py.
If you use LogicJitter in your research, please cite:
@article{herranzcelotti2026logicjitter,
title = {LogicJitter: Let LLMs play and uncover misinformation},
author = {Herranz-Celotti, Luca and Viviani, Marco},
journal = {Computers and Electrical Engineering},
volume = {136},
pages = {111215},
year = {2026},
doi = {10.1016/j.compeleceng.2026.111215},
url = {https://www.sciencedirect.com/science/article/pii/S0045790626002879}
}
The article is published under CC BY 4.0. See the paper for full terms.
This work was partly funded by the European Union – Next Generation EU (KURAMi project). Computing resources were provided by the LEONARDO supercomputer (EuroHPC / CINECA).