Skip to content

UKPLab/conspired

Repository files navigation

🧠 ConspirED Dataset Overview

Welcome to the repo for ConspirED: A Dataset for Cognitive Traits of Conspiracy Theories and Large Language Model Safety.

ConspirED is a dataset for identifying cognitive traits of conspiracy theories in text. It contains annotated conspiracy snippets labeled with the CONSPIR traits of conspiratorial ideation.


πŸ“ Directory Structure

The repository is organized as follows:

arxiv2025-conspired/
β”œβ”€β”€ data/                              # Dataset files
β”‚   β”œβ”€β”€ context_training.xlsx          # Training split
β”‚   β”œβ”€β”€ context_testing.xlsx           # Test split
β”‚   β”œβ”€β”€ val_splits/                    # Validation splits
β”‚   └── LICENSE-CC-BY-4.0.txt          # CC-BY-4.0 license for datasets
β”œβ”€β”€ .github/                           # GitHub Actions and workflows
β”œβ”€β”€ static/                            # Project page assets
β”œβ”€β”€ conspir_tils.py                    # Utility functions for prompting experiments
β”œβ”€β”€ main.py                            # Main script for LLM prompting experiments
β”œβ”€β”€ train_clf.py                       # Script for fine-tuning LaGoNN classifiers
β”œβ”€β”€ lagonn.py                          # LaGoNN model implementation
β”œβ”€β”€ setup_utils.py                     # Setup and evaluation utilities
β”œβ”€β”€ finetuning_environment.yml         # Conda environment for LaGoNN
β”œβ”€β”€ prompting_environment.yml          # Conda environment for prompting
β”œβ”€β”€ README.md                          # This file
β”œβ”€β”€ LICENSE                            # Apache 2.0 license for code
β”œβ”€β”€ NOTICE.txt                         # Copyright notices
β”œβ”€β”€ .gitignore                         # Git ignore rules
β”œβ”€β”€ .nojekyll                          # GitHub Pages configuration
└── index.html                         # Project landing page

data/

Contains all processed dataset files:

Dataset Fields

Each dataset file contains the following columns:

  • doc_id: Unique identifier for the source document
  • snippet: The annotated text snippet exhibiting conspiratorial thinking
  • context500: Surrounding context (500 tokens) around the snippet
  • context1000: Surrounding context (1000 tokens) around the snippet
  • labels: Multi-hot encoded list of conspiracy traits (0/1 for each of 6 traits)
  • consolidated_trait: Human-readable list of trait names present in the snippet
  • dominant_consol_trait: The most salient/dominant trait in the snippet
  • single_dominant_one_hot_dm: One-hot encoded dominant trait vector
  • OverallTrait: Original annotation of overall conspiracy traits
  • DominantTrait: Original annotation of the dominant trait
  • Justification: Annotator's justification for trait assignment
  • Confidence: Annotator confidence score
  • ConspiracyTheoryorMainstream: Classification of source as conspiracy theory or mainstream
  • annotated_text: Original annotated text with markup
  • linkingpassage: Context linking the snippet to broader narrative
  • begin/end: Character offsets of the snippet in the source document
  • name: Source annotator where relevant
  • id: Snippet identifier
  • Label: Additional label information
  • remove_row: Flag for data quality filtering

The six conspiracy traits are (in order): Contradictory, Overriding suspicion, Nefarious intent, Persecuted victim, Immune to evidence, and Re-interpreting randomness.


βš™οΈ Environment Setup

To set up the environment, use the provided Conda YAML files:

  • finetuning_environment.yml β€” for training and evaluating LaGoNN.
  • prompting_environment.yml β€” for prompting experiments with LLaMA or GPT models.

βœ… Create a Conda environment

Use the following commands:

LaGoNN (fine-tuning)

conda env create -f finetuning_environment.yml
conda activate lagonn-env

Prompting

conda env create -f prompting_environment.yml
conda activate prompting-env

πŸ”‘ API Configuration

If you plan to use OpenAI models (GPT-4, etc.), you need to set your API key as an environment variable:

export OPENAI_API_KEY='your-api-key-here'

For permanent configuration, add this line to your ~/.bashrc or ~/.zshrc file.


πŸ‹οΈβ€β™‚οΈ Fine-Tuning LaGoNN

Use the train_clf.py script to fine-tune LaGoNN classifiers on the ConspirED dataset.

πŸ”§ Command-Line Arguments

Argument Description
--model HuggingFace model to fine-tune (e.g., paraphrase-mpnet-base-v2).
--model_seed Random seed for model initialization.
--num_iter Number of LaGoNN message-passing iterations.
--epochs Number of training epochs.
--multilab Set to True for multi-label classification; False for single-label.
--lagonn_config Graph configuration (e.g., LABEL, TEXT, etc.).
--lagonn_mode Name of the experimental setup (e.g., LAGONN_EXP).
--NUM_NEIGHBORS Number of neighbors per node in the graph.
--DISTANCE_PRECISION Optional: precision mode for node distance (default: None).
--context Whether to include surrounding context in the input.
--window Token window size used when --context is enabled.

πŸš€ Example Usage

python train_clf.py \
  --model paraphrase-mpnet-base-v2 \
  --model_seed 4 \
  --num_iter 17 \
  --epochs 3 \
  --multilab True \
  --lagonn_config LABEL \
  --lagonn_mode LAGONN_EXP \
  --NUM_NEIGHBORS 1 \
  --setfit False \
  --context True \
  --window 1000

πŸ’¬ Prompting with LLaMA and GPT Models

The main.py script runs prompting experiments to identify conspiratorial traits using LLaMA, GPT, or other LLMs.

πŸ”§ Command-Line Arguments

Argument Description
--strategy Prompting strategy used (e.g., what_to_look_for).
--icl In-context learning setup: zero_shot, few_shot_similar, few_shot_dissimilar, or few_shot_both.
--k Number of examples used in few-shot prompting.
--cot Whether to use chain-of-thought prompting (True or False).
--dev Run on development set instead of test set (True or False).
--model Path to the local LLaMA model (if not using OpenAI).
--context Whether to include surrounding context in the prompt (True or False).
--window Token window size for included context (ignored if --context=False).
--openai Whether to use OpenAI API models (True) or local models (False).
--openai_model OpenAI model name (e.g., gpt-4o.).

πŸš€ Example Usage

python main.py \
  --strategy what_to_look_for \
  --icl few_shot_both \
  --k 20 \
  --cot True \
  --dev False \
  --model path/to/llama-2-7b-chat \
  --context True \
  --window 1000 \
  --openai False

πŸ“Š Expected Results

After running experiments, results will be automatically saved to disk in JSON format with the following structure:

Standard Evaluation

Results are saved to: llm_trainclf_jsons/{seed}/{model}/{strategy}/{icl}/{k}/{cot}/{dev}/{context}/{window}/{openai}/{openai_model}/

Each experiment produces JSON files containing:

  • Classification report: Per-class precision, recall, and F1-scores for each conspiracy trait
  • Aggregated metrics: Macro, micro, samples, and weighted averages for:
    • F1-score
    • Precision
    • Recall

Relaxed Evaluation

Relaxed evaluation files (*_relaxed_results.json) assess whether the model correctly identifies the dominant trait when multiple traits are present. This evaluation considers a prediction correct if the model assigns a probability β‰₯ 0.5 to the dominant trait, providing a less strict measure of model performance focused on identifying the most salient conspiracy trait in each instance.

Both standard and relaxed evaluation results are printed to the console during execution and saved as JSON files for further analysis.

πŸ“„ License

This repository uses dual licensing:

  • Code: Licensed under the Apache License 2.0 (see LICENSE)
  • Data: Licensed under Creative Commons Attribution 4.0 International (CC-BY-4.0) (see data/LICENSE-CC-BY-4.0.txt)

πŸ“– Citation

If our work was helpful for your work, please be so kind as to cite us:

@article{bates2025conspired,
  title={ConspirED: A Dataset for Cognitive Traits of Conspiracy Theories and Large Language Model Safety},
  author={Bates, Luke and Glockner, Max and Nakov, Preslav and Gurevych, Iryna},
  journal={arXiv preprint arXiv:2508.20468},
  year={2025},
  url={https://arxiv.org/abs/2508.20468}
}

πŸ‘₯ Contact

Don't hesitate to send us an email or report an issue if something is broken or if you have further questions.


⚠️ Disclaimer

This repository contains experimental software and is published for the sole purpose of giving additional background details on the respective publication.

About

Data and source code for the CONSPIR Evaluation Dataset (CONSPIRED).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published