This repository contains the code, figures, and analysis scripts accompanying the paper
"Semantic Calibration Prevails Where Token Confidence Fails: Benchmarking Long-Form Scientific QA".
Uncertainty estimation is critical for reliable deployment of LLMs in scientific applications. This work benchmarks different methods to assess calibration of confidence scores in natural science question answering.
The repository is designed to ensure full reproducibility of the experiments and benchmarks conducted in the paper. It provides:
βββ async_graph_bench/ # Local benchmarking framework
βββ llm-unc-bench/ # Main benchmark project
βββ label_prob_calibration # Benchmark 1: Label Probability Calibration
βββ seq_uc_calibration # Benchmark 2: Sequence-level Uncertainty Calibration
βββ requirements.txt # Requirements for running the benchmarks
βββ container.def # Container definition file
βββ pip_freeze.txt # Exact Python package versions for reference
Each of the experiment folders label\_prob\_calibration and seq\_uc\_calibration contains:
βββ run.py # main entry point for running the benchmark
βββ data_sources/ # datasource implementations containing exact dataset versions used
βββ models.py # model definitions and hardware-specific parameters
βββ data/ # created when you run new benchmarks (initially empty)
βββ analysis.ipynb # notebook for analyzing data and generating plots and tables
| # for seq_uc_calibration execute the notebooks prepare and plot subsequently
βββ resources/ # figures and tables generated from analysis
βββ figures
βββ tables
The data directory will contain the resulting data after benchmark runs, and is initially left empty. In _data/ leaf-node outputs from the benchmark run seen in the paper have been included for reference and reproducibility of plots. Rename it to data and run the analysis.ipynb to reproduce the figures and tables in resources.
Experiments were performed on NVIDIA H100 GPUs (80GB HBM3).
Different hardware may require adjustments. Consult the kwargs properties in models.py, which will be supplied to the vllm LLM instances, based on the run.py --gpu parameter.
nvcc --version)async_graph_bench (installed locally, see below)For exact python package versions, see pip_freeze.txt. These versions reflect the exact setup used in the paper experiments. Newer CUDA or driver versions may work, but adjustments in models.py may be required.
Alternatively, you can build a container with the required software using the provided definition file (container.def). The file is compatible with Apptainer (recommended) and Singularity (used in some HPC environments).
apptainer build vllm_container.sif container.def
apptainer shell --writable --nv \
--bind /usr/bin/nvidia-smi:/usr/bin/nvidia-smi,/path/to/hf-cache:/hf_home \
vllm_container.sif
Inside the container, set Hugging Face cache:
export HF_HOME=/hf_home/
Notes:
--nv is enabled for GPU passthrough.nvidia-smi must be accessible inside the container.models.py under each experiment, including kwargs parameters passed to vLLM.nvidia-smi and nvcc --version should be available).git clone <REPO_URL>.git
cd llm-unc-bench
cd async_graph_bench
pip install -e .
cd ../llm-unc-bench
pip install -r requirements.txt
Two main experiments are provided in the llm-unc-bench project:
label_prob_calibration
Investigates the effect of instruction tuning on calibration of label probabilities as confidence scores.
seq_uc_calibration
Benchmarks calibration of multiple sequence-level uncertainty methods.
cd seq_uc_calibration # or label_prob_calibration
python run.py --gpu h100 --models Ministral,Llama-3.3 --datasets MMLU,GPQA
Use --help to inspect available parameters.
Important:
models.py in the experiments folder matches your hardware.data/ subfolder of each experiment.Benchmark outputs are analyzed in analysis.ipynb notebooks located in each experiment subfolder.
Run:
jupyter notebook analysis.ipynb
By default, figures and tables are written to each experimentβs resources/ subfolder.
This repository is licensed under the MIT License.
nvidia-smi, nvcc --version)async-graph-bench and benchmark requirementsrun.py)data/analysis.ipynb to generate figures/tablesasync-graph-bench and benchmark requirements (or use container)_data/ β data/ in each experimentanalysis.ipynb to regenerate figures/tablesThis repository contains the code, figures, and analysis scripts accompanying the paper
"Semantic Calibration Prevails Where Token Confidence Fails: Benchmarking Long-Form Scientific QA".
Uncertainty estimation is critical for reliable deployment of LLMs in scientific applications. This work benchmarks different methods to assess calibration of confidence scores in natural science question answering.
The repository is designed to ensure full reproducibility of the experiments and benchmarks conducted in the paper. It provides:
βββ async_graph_bench/ # Local benchmarking framework
βββ llm-unc-bench/ # Main benchmark project
βββ label_prob_calibration # Benchmark 1: Label Probability Calibration
βββ seq_uc_calibration # Benchmark 2: Sequence-level Uncertainty Calibration
βββ requirements.txt # Requirements for running the benchmarks
βββ container.def # Container definition file
βββ pip_freeze.txt # Exact Python package versions for reference
Each of the experiment folders label\_prob\_calibration and seq\_uc\_calibration contains:
βββ run.py # main entry point for running the benchmark
βββ data_sources/ # datasource implementations containing exact dataset versions used
βββ models.py # model definitions and hardware-specific parameters
βββ data/ # created when you run new benchmarks (initially empty)
βββ analysis.ipynb # notebook for analyzing data and generating plots and tables
| # for seq_uc_calibration execute the notebooks prepare and plot subsequently
βββ resources/ # figures and tables generated from analysis
βββ figures
βββ tables
The data directory will contain the resulting data after benchmark runs, and is initially left empty. In _data/ leaf-node outputs from the benchmark run seen in the paper have been included for reference and reproducibility of plots. Rename it to data and run the analysis.ipynb to reproduce the figures and tables in resources.
Experiments were performed on NVIDIA H100 GPUs (80GB HBM3).
Different hardware may require adjustments. Consult the kwargs properties in models.py, which will be supplied to the vllm LLM instances, based on the run.py --gpu parameter.
nvcc --version)async_graph_bench (installed locally, see below)For exact python package versions, see pip_freeze.txt. These versions reflect the exact setup used in the paper experiments. Newer CUDA or driver versions may work, but adjustments in models.py may be required.
Alternatively, you can build a container with the required software using the provided definition file (container.def). The file is compatible with Apptainer (recommended) and Singularity (used in some HPC environments).
apptainer build vllm_container.sif container.def
apptainer shell --writable --nv \
--bind /usr/bin/nvidia-smi:/usr/bin/nvidia-smi,/path/to/hf-cache:/hf_home \
vllm_container.sif
Inside the container, set Hugging Face cache:
export HF_HOME=/hf_home/
Notes:
--nv is enabled for GPU passthrough.nvidia-smi must be accessible inside the container.models.py under each experiment, including kwargs parameters passed to vLLM.nvidia-smi and nvcc --version should be available).git clone <REPO_URL>.git
cd llm-unc-bench
cd async_graph_bench
pip install -e .
cd ../llm-unc-bench
pip install -r requirements.txt
Two main experiments are provided in the llm-unc-bench project:
label_prob_calibration
Investigates the effect of instruction tuning on calibration of label probabilities as confidence scores.
seq_uc_calibration
Benchmarks calibration of multiple sequence-level uncertainty methods.
cd seq_uc_calibration # or label_prob_calibration
python run.py --gpu h100 --models Ministral,Llama-3.3 --datasets MMLU,GPQA
Use --help to inspect available parameters.
Important:
models.py in the experiments folder matches your hardware.data/ subfolder of each experiment.Benchmark outputs are analyzed in analysis.ipynb notebooks located in each experiment subfolder.
Run:
jupyter notebook analysis.ipynb
By default, figures and tables are written to each experimentβs resources/ subfolder.
This repository is licensed under the MIT License.
nvidia-smi, nvcc --version)async-graph-bench and benchmark requirementsrun.py)data/analysis.ipynb to generate figures/tablesasync-graph-bench and benchmark requirements (or use container)_data/ β data/ in each experimentanalysis.ipynb to regenerate figures/tables