Skip to content

SDM-TIB/PRISM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

License: MIT

PRISM: Path-guided Reasoning and Interpretation for Semantic Models πŸ§ πŸ”

PRISM

Overview

PRISM is a neuro-symbolic explanation framework for Link Prediction (LP) over Knowledge Graphs (KGs). It explains why a Knowledge Graph Completion (KGC) model predicts a missing fact by identifying the facts that are most relevant to the prediction.

PRISM combines symbolic reasoning with Knowledge Graph Embeddings (KGEs) to generate explanations that are:

  • Faithful to the behaviour of the underlying LP model.
  • Interpretable through explicit KG facts and symbolic reasoning patterns.
  • Efficient by reducing the number of candidate facts that must be explored.

🎯 PRISM builds on top of the KELPIE [1] framework and extends it with neuro-symbolic explanation strategies that exploit both explicit semantic knowledge and latent embedding-based representations.

PRISM associates each predicted relationship with two complementary forms of explanation:

  • Necessary explanations identify facts that are essential for the prediction. Removing these facts should weaken or invalidate the predicted relationship.
  • Sufficient explanations identify additional facts that support the predicted relationship. Adding or emphasizing these facts should strengthen the prediction.

We empirically evaluate PRISM across 336 testbeds for necessary explanations and 336 testbeds for sufficient explanations, assessing explanation quality, faithfulness, interpretability, and computational efficiency.

Note: The complete reproducibility of all testbeds is estimated to require approximately five or six months.


πŸ”Ž Exemplary Subgraph

Below is an example of how PRISM explains a missing link prediction in a KG:

PRISM Subgraph

The figure illustrates how PRISM uses symbolic rules, KG structure, and embedding-based relevance signals to generate necessary and sufficient explanations for a predicted missing relationship.

🧾 Repository Structure

Path Description
data/ All experiment-related artifacts.
β”œβ”€β”€ 0_rules/ Symbolic rules used during explanation generation.
β”œβ”€β”€ 1_triple_store/ KG triples, including train, validation, and test splits.
β”œβ”€β”€ 2_stored_models/ Pre-trained KGE models.
β”œβ”€β”€ 3_filtered_ranks/ LP model predictions with ranking information.
β”œβ”€β”€ 4_predictions/ Tab-separated triples used as input for explanation generation.
β”œβ”€β”€ 5_explanations/ Explanations generated by PRISM and used for verification.
β”œβ”€β”€ 6_statistics/ Evaluation metrics from explanation generation and verification.
β”œβ”€β”€ 7_logging/ Logs for tracking experimental runs.
β”œβ”€β”€ temp/ Temporary files generated during rule and triple processing.
scripts/ Benchmark-specific folders containing run.sh scripts and configuration files.
src/ Source code of the project.
β”œβ”€β”€ embeddings/ Training, testing, explanation, and verification scripts for KGE models.
β”œβ”€β”€ explanation_builders/ Logic for constructing necessary and sufficient explanations.
β”œβ”€β”€ link_prediction/ Embedding model implementations and LP utilities.
β”œβ”€β”€ model/ PRISM and KELPIE architecture logic.
β”œβ”€β”€ prefilters/ Filtering strategies for selecting semantically relevant candidate facts.
β”œβ”€β”€ relevance_engines/ Score computation for candidate explanatory triples.
β”œβ”€β”€ rules/ Code and binaries for symbolic rule mining.
create_environment.sh Shell script to install Python dependencies.
requirements.txt Python dependency list.
config.py Project-wide configuration values.

πŸ” Reproducibility of Experiments

Reproducing the results in our study is straightforward with the provided scripts and input configurations.

βœ… Steps to Reproduce

  1. Set up the environment

    bash create_environment.sh
  2. Prepare symbolic rules

    Run AMIE [2] with the appropriate training triples:

    java -jar amie -const -minpca 0.7 -dpr -optimai path/to/train.txt > path/to/rules.txt
  3. Navigate to a benchmark folder

    cd scripts/FrenchRoyalty  # or DB100K, FB15K-237, YAGO3-10
  4. Edit the input configuration

    Update input.json or the benchmark-specific configuration file to specify:

    • the explanation mode: necessary or sufficient,
    • the embedding model: TransE, ComplEx, or ConvE,
    • the explanation builders to be used,
    • the rule files and prediction files.
  5. Run explanation generation

    bash run.sh
  6. Analyze the results

    Explanation and verification metrics are stored in the data/ folder, especially in:

    • 6_statistics/
    • 7_logging/

πŸ§ͺ Our full experimental pipeline was executed using:

  • OS: Ubuntu 20.04.5
  • Python: 3.10
  • GPU: NVIDIA A100 with 40 GiB VRAM
  • CUDA: 12.2

Running PRISM πŸš€

Navigate to a benchmark-specific folder and execute run.sh to generate explanations:

cd scripts/FrenchRoyalty
bash run.sh

This executes the explanation extraction script, for example transe-fr-script.py, using the configuration specified in input_transe_fr.json. The script generates explanations across the selected explanation builders and stores the outputs in the corresponding data/ subfolders.


Example input_transe_fr.json

{
  "dataset": "FR_Reduced_2K",
  "embedding_model": "TransE",
  "predictions": "FR_10.csv",
  "rules_file": "fr_reduced_2k_rules_optimai.csv",
  "editorial_rules": "FR_editorial_rules.csv",
  "dimension": 50,
  "batch_size": 1906,
  "negative_samples_ratio": 5,
  "e_regularizer_weight": 50.0,
  "v_regularizer_weight": 2.0,
  "margin": 2,
  "e_learning_rate": 0.003,
  "v_learning_rate": 0.00003,
  "e_epochs": 100,
  "v_epochs": 10,
  "thr": 0.7,
  "coverage": 3,
  "mode": "sufficient",
  "builders": ["kelpie", "pca", "frequency"]
}

Parameter Description

Parameter Description
dataset Name of the dataset, for example FR_Reduced_2K.
embedding_model KGE model used for LP, such as TransE, ComplEx, or ConvE.
predictions CSV file containing the predictions to explain.
rules_file Symbolic rules generated by AMIE.
editorial_rules Optional user-defined rules.
dimension Embedding vector dimension.
batch_size Batch size for model training.
negative_samples_ratio Number of negative samples per positive triple.
e_regularizer_weight Regularization weight for embedding training.
v_regularizer_weight Regularization weight during verification.
margin Margin used in the loss function.
e_learning_rate Learning rate for embedding training.
v_learning_rate Learning rate for verification.
e_epochs Number of epochs for embedding training.
v_epochs Number of epochs used during verification.
thr Threshold used for rule or candidate filtering, for example PCA confidence.
coverage Number of explanations to return per prediction.
mode Explanation type: necessary or sufficient.
builders List of explanation builders to apply.

βš™οΈ Hyperparameters for Training Knowledge Graph Embedding Models

The experimental evaluation encompasses three embedding representation spaces: TransE [6], ConvE [7], and ComplEx [8].

Model Epochs Batch Size Learning Rate Embedding Dim
TransE 100 2048 0.001 200
ConvE 500 128 0.003 200
ComplEx 50 128 0.1 100

πŸ’‘ These hyperparameters were tuned for fair comparison and consistent results across benchmarks.


πŸ“š Benchmark Knowledge Graphs

πŸ“ˆ Statistics

Benchmark Entities Relations Triples
French Royalty 2,601 12 10,526
YAGO3-10 123,086 37 1,080,264
FB15K-237 40,943 18 151,442
DB100K 99,604 470 695,572

πŸ“„ Benchmark Descriptions

  • French Royalty πŸ‘‘ [3]
    A curated KG derived from DBpedia about historical French royals, including facts such as gender, spouse, successor, and related relations.
    Entities: 2,601 | Triples: 10,526 | Relations: 12

  • YAGO3-10 🌍 [9]
    A dense subset of the multilingual YAGO3 KG with rich information about persons, cities, sports, and organizations.
    Entities: 123,086 | Triples: 1,080,264 | Relations: 37

  • FB15K-237 🎬 [10]
    A subset of Freebase with inverse relations removed to avoid data leakage, covering domains such as music, sports, film, and people.
    Entities: 40,943 | Triples: 151,442 | Relations: 18

  • DB100K πŸ“˜ [11]
    A DBpedia-derived KG focused on hierarchical and structured relations. Only entities with rich neighborhoods are retained.
    Entities: 99,604 | Triples: 695,572 | Relations: 470


License πŸ“„

This project is licensed under the MIT License.


References πŸ“š

  1. Andrea Rossi et al. (2022). Explaining Link Prediction Systems. SIGMOD.
  2. J. Lajus et al. (2020). Fast and Exact Rule Mining with AMIE 3. ESWC.
  3. Halliwell et al. (2021). User Scored Evaluation of Non-Unique Explanations. K-CAP.
  4. Kristina Toutanova and Danqi Chen (2015). Observed versus Latent Features for Knowledge Base and Text Inference. ACL Workshop.
  5. Jingxiong Wang et al. (2023). Attention-Based High-Low Level Features Interaction for Knowledge Graph Embedding. IPM.
  6. Bordes et al. (2013). Translating Embeddings for Modeling Multi-Relational Data. NeurIPS.
  7. Dettmers et al. (2018). Convolutional 2D Knowledge Graph Embeddings. AAAI.
  8. Trouillon et al. (2016). Complex Embeddings for Simple Link Prediction. ICML.
  9. Mahdisoltani et al. (2015). YAGO3: A Knowledge Base from Multilingual Wikipedias. CIDR.
  10. Toutanova et al. (2015). Observed versus Latent Features for Knowledge Base and Text Inference. ACL.
  11. Wang et al. (2023). Knowledge Graph Embedding Model with Attention-Based High-Low Level Features Interaction Convolutional Network. IPM.

About

Neuro-Symbolic Explanations for Link Prediction over Knowledge Graphs

Topics

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors