This repository contains the source code for the paper "Double-Calibration: Towards Reliable LLMs via Calibrating Knowledge and Reasoning Confidence" accepted by IJCAI 2026.
conda create -n doublycal python=3.9
conda activate doublycal
pip install -r requirements.txt Download the publicly available RoG benchmark dataset:
cd src
bash scripts/download_ori_datasets.shThe dataset will be saved to datasets/ori/.
Extract KG evidence (i.e., constrained relational paths) and perform Bayesian calibration for confidence estimation:
bash scripts/evidence_preprocess.shThe results are saved to datasets/paths.
Building Supervised Fine-Tuning (SFT) and Reinforcement Learning (RL) datasets for training the Proxy model:
bash scripts/train_preprocess.shThe results are saved to datasets/betap-[ALPHA].[BETA].
The training process of the Proxy model consists of two stages: Supervised Fine-tuning (SFT) followed by Reinforcement Learning (RL).
Access Token Setup: Remember to set the
ACCESS_TOKENfor the base modelllama2-7b-chatinsrc/training/sft_finetuning.py.
bash scripts/train_proxy_sft.shThe Proxy model trained after SFT is saved to saved_model/betap0.5.0.5-sft. In our experiments, training was early-stopped at checkpoint-800 based on the validation loss.
bash scripts/train_proxy_rl.shThe Proxy model trained after RL is saved to saved_model/betap0.5.0.5-rl. In our experiments, training was early-stopped at checkpoint-1200 based on the validation reward.
Use the trained Proxy model to generate KG evidence with calibrated confidence scores:
bash scripts/gen_evidence_sft.sh
bash scripts/gen_evidence_rl.shThe results are saved to results/gen_evidence.
The well-calibrated KG evidence serves as context to assist black-box LLMs in predicting the final answer and expressing confidence in the prediction:
API Key Setup: Remember to set the
API_KEYin the corresponding environment file (e.g.,src/env/.env.[MODEL_NAME]) before running the prediction script.
bash scripts/predict_answer.shKey script arguments:
MODEL_LIST: Specifies the black-box LLMs to use (e.g.,gpt-3.5-tubo).UQ_MODE: Sets the verbalized Uncertainty Quantification (UQ) technique (e.g.,vanilla).RULE_PATH: Provides the file path to the KG evidence generated by the proxy model.