This repository is divided into two main components.
The first is CONCRETE, a symbolic fact-checking system.
To run CONCRETE, you must create a Conda environment with Python 3.7:
conda create -n <env_name> python=3.7
conda activate concrete
Then, install the required dependencies:
conda install --yes --file requirements_conda.txt
This will set up the environment needed to run the tool via terminal.
To execute CONCRETE and its respective steps, please refer to the instructions in the original CONCRETE repository.
scripts folder.This part of the project contains a suite of metamorphic tests over the dataset, organized as follows:
claim_tests/: Modifies the textual claim, testing robustness against synonymous, lexical or structural changes.claimant_tests/: Alters or removes the claimant field to assess model dependency on the source of the claim.context_tests/: Edits the context evidence, simulating noisy, contradictory or incomplete scenarios.date_tests/: Modifies dates related to the claim, evidence, and review to evaluate temporal consistency.Available in the scripts/ folder:
analyze_examples.py: Prints example outputs from mutated inputs.merge_predictions.py: Combines predictions from different models or mutation types.calculate_f1.py: Computes F1-score based on ground truth labels.generate_confusion_matrix.py: Creates a confusion matrix comparing expected vs. predicted labels.normalize_labels.py: Standardizes labels across different outputs.unify_datasets.py: Merges different mutation datasets into a single evaluation file.We use these scrips to clean, normalize and analize the data.
__init__.py)To execute the entire metamorphic testing pipeline — from mutation generation to fact-checking — run the __init__.py module directly.
python -m xfact-metamorphic-tests --mode mutate --input path/to/input.tsv --output path/to/output_mutated.tsv
This will apply all metamorphic relations (MRs) defined in the framework and save the result to output_mutated.tsv.
python -m xfact-metamorphic-tests --mode check --input path/to/output_mutated.tsv --output path/to/predictions.json --model openai --temperature 0
Replace --model with one of the supported models:
openai → GPT (via OpenAI API)maritaca → Sabiá 3.0 (via custom API)gemini → Google Gemini (via API)You can also pass --temperature, --max_tokens, and other model-related parameters.
python -m xfact-metamorphic-tests --mode mutate --input data/xfact_subset.tsv --output data/xfact_mutated.tsv
python -m xfact-metamorphic-tests --mode check --input data/xfact_mutated.tsv --output results/openai_predictions.json --model openai --temperature 0.2
Ensure your .env or environment variables include the API keys required by each model.
Make sure you are in an environment where all dependencies from requirements.txt are installed:
pip install -r requirements.txt
You can access our internal working files and scripts in the following Google Drive folder:
Main Drive
Experimental results are located in the "resultados" folder inside this Drive:
Results Folder
Feel free to check each subdirectory for additional usage examples, configurations, and scripts tailored for metamorphic testing over fact-checking models.
27 commits
2 commits
Python
99.3%
This repository is divided into two main components.
The first is CONCRETE, a symbolic fact-checking system.
To run CONCRETE, you must create a Conda environment with Python 3.7:
conda create -n <env_name> python=3.7
conda activate concrete
Then, install the required dependencies:
conda install --yes --file requirements_conda.txt
This will set up the environment needed to run the tool via terminal.
To execute CONCRETE and its respective steps, please refer to the instructions in the original CONCRETE repository.
scripts folder.This part of the project contains a suite of metamorphic tests over the dataset, organized as follows:
claim_tests/: Modifies the textual claim, testing robustness against synonymous, lexical or structural changes.claimant_tests/: Alters or removes the claimant field to assess model dependency on the source of the claim.context_tests/: Edits the context evidence, simulating noisy, contradictory or incomplete scenarios.date_tests/: Modifies dates related to the claim, evidence, and review to evaluate temporal consistency.Available in the scripts/ folder:
analyze_examples.py: Prints example outputs from mutated inputs.merge_predictions.py: Combines predictions from different models or mutation types.calculate_f1.py: Computes F1-score based on ground truth labels.generate_confusion_matrix.py: Creates a confusion matrix comparing expected vs. predicted labels.normalize_labels.py: Standardizes labels across different outputs.unify_datasets.py: Merges different mutation datasets into a single evaluation file.We use these scrips to clean, normalize and analize the data.
__init__.py)To execute the entire metamorphic testing pipeline — from mutation generation to fact-checking — run the __init__.py module directly.
python -m xfact-metamorphic-tests --mode mutate --input path/to/input.tsv --output path/to/output_mutated.tsv
This will apply all metamorphic relations (MRs) defined in the framework and save the result to output_mutated.tsv.
python -m xfact-metamorphic-tests --mode check --input path/to/output_mutated.tsv --output path/to/predictions.json --model openai --temperature 0
Replace --model with one of the supported models:
openai → GPT (via OpenAI API)maritaca → Sabiá 3.0 (via custom API)gemini → Google Gemini (via API)You can also pass --temperature, --max_tokens, and other model-related parameters.
python -m xfact-metamorphic-tests --mode mutate --input data/xfact_subset.tsv --output data/xfact_mutated.tsv
python -m xfact-metamorphic-tests --mode check --input data/xfact_mutated.tsv --output results/openai_predictions.json --model openai --temperature 0.2
Ensure your .env or environment variables include the API keys required by each model.
Make sure you are in an environment where all dependencies from requirements.txt are installed:
pip install -r requirements.txt
You can access our internal working files and scripts in the following Google Drive folder:
Main Drive
Experimental results are located in the "resultados" folder inside this Drive:
Results Folder
Feel free to check each subdirectory for additional usage examples, configurations, and scripts tailored for metamorphic testing over fact-checking models.
27 commits
2 commits
Python
99.3%