Research use only. Not a medical device. This software was developed in the HEREDITARY project as a research prototype. It has not been assessed or certified under the EU Medical Device Regulation (EU) 2017/745. It must not be used to diagnose, treat, monitor or make any other decision about individual patients.
- Overview
- Features
- Installation
- Quick Start
- Datasets
- Methodologies
- Configuration
- Usage Examples
- Results
- Web Platform
- Repository Structure
- Contributing
- Extra Experiments
FactCheck is a comprehensive benchmark designed to evaluate Large Language Models (LLMs) capabilities in Knowledge Graph (KG) fact verification. This repository implements multiple verification methodologies and provides extensive evaluation across three real-world KG datasets with over 13,530 facts.
FactCheck addresses three fundamental research questions in the domain of LLM-based knowledge graph fact verification:
-
RQ1: Internal Knowledge Assessment: How effective are Large Language Models at knowledge graph fact-checking when relying solely on their internal knowledge representations acquired during pre-training?
-
RQ2: External Evidence Integration: Does augmenting LLMs with external evidence through Retrieval-Augmented Generation (RAG) methodologies improve their capability to verify knowledge graph facts, and at what computational cost?
-
RQ3: Multi-Model Consensus: Does aggregating predictions from multiple LLMs through consensus mechanisms lead to more reliable and robust verification of knowledge graph facts compared to individual model performance?
Our evaluation across three real-world KG datasets (FactBench, YAGO, DBpedia) reveals several critical insights:
- Promising but Limited: While LLMs demonstrate promising fact verification capabilities, they remain insufficient for reliable deployment in real-world KG validation scenarios
- Model Hierarchy: Open-source models achieve competitive performance, with Gemma2 consistently outperforming others (balanced accuracy up to 0.90 on FactBench with RAG)
- Dataset Sensitivity: Performance varies significantly across datasets due to class imbalance and schema complexity
- Inconsistent Improvements: RAG integration provides fluctuating performance gains, offering inconsistent improvements over streamlined internal knowledge approaches
- Computational Trade-offs: External evidence integration increases computational overhead by approximately 10Γ processing time (0.3s β 2.0s+ per fact)
- Context Dependency: RAG effectiveness is highly dependent on dataset characteristics and retrieval quality
- Modest Gains: Consensus strategies provide average 4.5% balanced accuracy improvement over individual models in knowledge-constrained scenarios
- Limited Consistency: "Wisdom of the crowd" approaches fail to consistently outperform individual models across all experimental conditions
- Resource Implications: Consensus methods require 1-1.5Γ additional computational resources while providing marginal accuracy improvements
- Structured Prompting: Few-shot guided iterative verification (GIV-F) consistently outperforms zero-shot approaches
- Evidence Quality: External evidence effectiveness is constrained by retrieval noise and source reliability
- Class Imbalance Challenges: Extreme class imbalance (as in YAGO with 99.2% correct facts) presents significant verification challenges
These findings underscore the urgent need for systematic benchmarking and highlight the complexity of automated KG fact verification, emphasizing that current LLM-based approaches require substantial advancement before practical deployment.
- π For comprehensive ablation study results: Ablation Study Results
- π° For token usage analysis and computational cost implications: Token Usage Analysis
- π For dataset-wise analysis of LLM performance: Dataset-wise Analysis
- Multiple LLM Support: Both open-source (Gemma2, Qwen2.5, Llama3.1, Mistral) and commercial (GPT-4o mini) models
- Diverse Methodologies: Direct Knowledge Assessment (DKA), Guided Iterative Verification (GIV), RAG, and Multi-model Consensus
- Real-world Datasets: FactBench, YAGO, and DBpedia with 13,530 total facts
- RAG Dataset: 2+ million documents specifically curated for KG fact verification
- Mock API: Simulated API for testing and development -- refer to FactCheck MockAPI.
- Interactive Platform: Web-based exploration tool for verification analysis
- Comprehensive Evaluation: Balanced accuracy, F1-macro, efficiency metrics, and cost analysis
Prompt templates for each methodology are available in the prompts directory.
- Python 3.8+
- Ollama (for open-source models)
- Azure OpenAI API access (for commercial models)
- Clone the repository
git clone https://github.com/FactCheck-AI/factcheck-benchmark
cd factcheck-benchmark- Install dependencies
pip install -r requirements.txt- Install Ollama (for open-source models)
# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.ai/install.sh | sh
# Start Ollama service
ollama serve- Download required models
ollama pull gemma2:9b
ollama pull qwen2.5:7b
ollama pull llama3.1:8b
ollama pull mistral:7bpython main.py # Run with default configuration in `config.yml`| Dataset | Facts | Predicates | Gold Accuracy | Description |
|---|---|---|---|---|
| FactBench | 2,800 | 10 | 0.54 | Systematically generated with balanced true/false distribution |
| YAGO | 1,386 | 16 | 0.99 | High-quality facts with extreme class imbalance |
| DBpedia | 9,344 | 1,092 | 0.85 | Diverse schema with extensive predicate coverage |
- 130,820 questions generated from KG facts
- 2,090,305 documents from Google SERP
- 87.4% text coverage rate
- Similarity scores for question relevance ranking
Basic fact verification using only LLM's internal knowledge without external guidance.
method:
name: "DKA"Enhanced verification with structured guidelines and examples.
GIV-Z (Zero-shot):
method:
name: "GIV-Z"GIV-F (Few-shot):
method:
name: "GIV-F"Verification using external evidence from web search results.
method:
name: "RAG"
rag:
embedding_model: 'bge-small-en-v1.5'
chunking_strategy: 'sliding_window'
window_size: 3
similarity_cutoff: 0.3
top_k: 6Combines predictions from multiple models using majority voting with tie-breaking.
majority_vote:
mode: 'commercial' # Options: commercial, open_source
final_tie_breaker: 'most_consistent' # Options: least_consistent, most_consistent, Null (for commercial)
num_votes: 3 # Number of votes for each model
llms:
- "mistral:7B"
- "qwen2.5:7B"
- "llama3.1:7B"
- "gemma2:9B"
higher_parameter_model:
qwen2.5:7b: 'qwen2.5:7b'
mistral:7b: 'mistral:7b'
llama3.1:7b: 'llama3.1:latest'
gemma2:9b: 'gemma2:9b'
commercial_model:
- "gpt-4o-mini"# Dataset configuration
dataset:
name: "FactBench" # Options: DBpedia, YAGO, FactBench
# Method configuration
method:
name: "DKA" # Options: DKA, GIV-Z, GIV-F, RAG
# LLM configuration
llm:
mode: "open_source" # Options: commercial, open_source
model: "gemma2:9B"
parameters:
temperature: 0.75
top_p: 0.9
max_tokens: 512
# Evaluation configuration
evaluation:
metrics:
accuracy: 'balanced' # Options: balanced, normal
f1_score: "macro" # Options: micro, macro, weighted
# Knowledge Graph configuration
knowledge_graph:
kg_ids: ['correct_death_00106', 'correct_death_00040']
# Output configuration
output:
directory: "./results"For commercial models, configure Azure OpenAI:
OpenAI:
azure_endpoint: "https://your-resource.openai.azure.com/"
api_key: "your-api-key"
api_version: "2024-02-15-preview"python main.pypython evaluation.py --file results/factbench_results.jsonFor full evaluation use --full flag to include all metrics.
python evaluation.py --file results/factbench_results.json --fullThis module is interactive. You can run it as follows:
python consensus.py --dataset FactBenchif you don't specify files it will ask you to enter which files you want to use for the consensus. The output example will be:
Found 3 files for FactBench:
1. FactBench_open-source_gemma2:9b_rag_20250527-103716.json
Model: open-source_gemma2:9b, Method: rag
Facts: 2, Success: 100.0%
2. FactBench_open-source_qwen2.5:7B_rag_20250527-103404.json
Model: open-source_qwen2.5:7B, Method: rag
Facts: 2, Success: 100.0%
3. FactBench_open-source_qwen2.5:7B_rag_20250527-103603.json
Model: open-source_qwen2.5:7B, Method: rag
Facts: 2, Success: 100.0%
How many files do you want to select? (1-3): Or you can simply define the files you want to use for the consensus:
python consensus.py --files results/factbench_open-source_gemma2:9b_rag_20250527-103716.json results/factbench_open-source_qwen2.5:7B_rag_20250527-103404.json- add parallel processing for the consensus
| Method | FactBench BAcc | YAGO BAcc | DBpedia BAcc | Avg Time/Fact |
|---|---|---|---|---|
| DKA | 0.72 | 0.53 | 0.64 | ~0.3s |
| GIV-F | 0.74 | 0.58 | 0.65 | ~0.8s |
| RAG | 0.90 | 0.56 | 0.67 | ~2.3s |
| Consensus | 0.90 | 0.64 | 0.68 | ~1.5s |
- Model Rankings: Gemma2 > Qwen2.5 > Mistral > Llama3.1 > GPT-4o mini
- Dataset Difficulty: FactBench (easiest) > DBpedia > YAGO (hardest due to class imbalance)
- Cost-Performance Trade-off: RAG provides best accuracy but 10Γ computational cost
- Consensus Benefits: 1-5% improvement over individual models
Explore verification results interactively at: https://factcheck.dei.unipd.it/
- Fact Search: Find specific KG triples and their verification results
- Step-by-step Analysis: Inspect RAG pipeline components
- Model Comparison: Compare reasoning patterns across different LLMs
- Error Analysis: Categorized failure analysis with systematic insights
- User Feedback: Collaborative annotation and feedback system
factcheck-benchmark/
βββ config.yml # Main configuration file
βββ main.py # Entry point for experiments
βββ config.py # Configuration validation and management
βββ data_loader.py # Dataset loading and preprocessing
βββ llm_client.py # LLM client implementations
βββ evaluate.py # Evaluation metrics and analysis
βββ requirements.txt # Python dependencies
βββ prompts/ # Prompt templates for each methodology
βββ consensus.py # Multi-model consensus implementation
βββ rag_dataset/ # RAG dataset -- filtered -- for complete dataset refer to mockapi
βββ methods/
β βββ dka.py # Direct Knowledge Assessment
β βββ giv.py # Guided Iterative Verification
β βββ rag.py # Retrieval-Augmented Generation
βββ dataset/
β βββ FactBench/
β βββ YAGO/
β βββ DBpedia/
βββ results/ # Output directory for results
βββ README.md # This file
config.py: Comprehensive configuration validation with support for multiple LLM providersevaluate.py: Scikit-learn based evaluation with balanced accuracy and F1-macro metricsmethods/: Implementation of all verification methodologiesprompts/: Contains prompt templates for each methodology
# Balanced Accuracy (addresses class imbalance)
BAcc = (Sensitivity + Specificity) / 2
# F1-Macro Score (unweighted average across classes)
F1_macro = (1/N) * Ξ£(2 * Precision_i * Recall_i / (Precision_i + Recall_i))
# Consistency (model agreement)
Consistency = |{f β F | response(m,f) = majorityVote(f)}| / |F|
# Efficiency
Time_per_fact = average_response_time_excluding_outliers- Ollama Connection Error
# Ensure Ollama is running
ollama serve
# Check available models
ollama list- Memory Issues
# Reduce batch size or use smaller models
config["llm"]["model"] = "gemma2:2b" # Instead of 9bWe welcome contributions!
- New Datasets: Integration of additional KG datasets
- Model Support: Adding support for new LLM architectures
- Evaluation Metrics: Implementation of additional evaluation measures
- Optimization: Performance improvements and efficiency enhancements -- important aspect
This project is licensed under the MIT License - see the LICENSE file for details.
- Paper: EDBT 2026 (edbt:2026.45)
- Dataset: Hugging Face Repository
- Web Platform: https://factcheck.dei.unipd.it/
- Issues: GitHub Issues
- Farzad Shami - University of Padua - farzad.shami@studenti.unipd.it
- Stefano Marchesin - University of Padua - stefano.marchesin@unipd.it
- Gianmaria Silvello - University of Padua - gianmaria.silvello@unipd.it
The work was supported by the HEREDITARY project, as part of the EU Horizon Europe program under Grant Agreement 101137074.
If you use or extend our work, please cite the following:
@inproceedings{shami_etal-edbt2026,
title = {Benchmarking Large Language Models for Knowledge Graph Validation},
author = {F. Shami and S. Marchesin and G. Silvello},
booktitle = {Proceedings of the 29th International Conference on Extending Database Technology, {EDBT} 2026, Tampere, Finland, March 24-27, 2026},
pages = {551--565},
publisher = {OpenProceedings.org},
year = {2026},
url = {https://doi.org/10.48786/edbt.2026.45},
doi = {10.48786/EDBT.2026.45}
}