s2labres/U-Space

Official implementation of the U-Space and U-Lens for training-free, interpretable uncertainty tracing in language-model reasoning.

Python

7

18 commits

updated Oct 10, 2026

See the code

See what people are saying

SourceMessageScoreDate

U-Space: Uncovering When and Why Uncertainty Arises in Language Models [R][D] (r/MachineLearning)

If you build on open-weight reasoning models, you have probably wanted a "how sure is the model about this answer?" signal that does not cost 5x sampling, a judge model, or a labeled dataset. Hence, we built the ***U-Lens.*** In one line: >**score** = (how strongly the hidden state points toward…

5

Oct 12, 2026

README

U-Space

Official code for U-Space: Uncovering When and Why Uncertainty Arises in Language Models.

U-Space tracks ambiguity, incomplete information, conflicting evidence, and general uncertainty through language-model generation. U-Lens combines this verbalizable signal with predictive entropy into a label-free, single-pass uncertainty score.

Project page · Paper · PDF · Reproduction guide

This repository reproduces U-Lens and the single-pass baselines in Tables 1 and 2 on Gemma-4-31B-it, Qwen3.5-27B, and Magistral-Small-2507 across MMLU-Pro, Omni-MATH, SuperGPQA, and TriviaQA with seeds 41, 42, and 43.

Setup

pip install -r requirements.txt

Configs

  • configs/reproduce.yaml: paper settings.
  • configs/smoke.yaml: 10 TriviaQA items, one seed, Qwen3.5-4B.

Run

./run.sh          # configs/reproduce.yaml
./run_smoke.sh    # configs/smoke.yaml

run.sh <config> runs every step below in order; finished outputs are skipped.

Pipeline

Inputs and outputs live in data/ (see data/README.md).

stepdescriptionhardware
01_sample_items.pysample 1,000 items per benchmarkCPU
02_generate.pyone reasoning trace per item and seed1 GPU per model
03_label.pyend-of-think position, exclusion, correctnessCPU
04_forward.pyper-token log-probabilities, end-of-think residual state1 GPU per model
05_build_uspace.pyU-Space basis from the terms in data/uspace_terms.yamlCPU
06_score.pyper-item scores of every method in src/methods/CPU
07_tables.pyTables 1 and 2 and the per-model raw tableCPU
python pipeline/01_sample_items.py --config configs/reproduce.yaml
python pipeline/02_generate.py     --config configs/reproduce.yaml --model gemma
python pipeline/03_label.py        --config configs/reproduce.yaml --model gemma
python pipeline/04_forward.py      --config configs/reproduce.yaml --model gemma
python pipeline/05_build_uspace.py --config configs/reproduce.yaml --model gemma
python pipeline/06_score.py        --config configs/reproduce.yaml --model gemma
python pipeline/07_tables.py       --config configs/reproduce.yaml

Run steps 2 to 6 once per model: gemma, qwen, magistral.

Methods

Each method is one module in src/methods/ with NEEDS and score(cell); the interface is documented in src/methods/base.py.

methodmoduleneeds
U-Lensulensforward, basis
A_conea_coneforward, basis
Generation lengthgen_length
MSPmspforward
Predictive entropypredictive_entropyforward
Max entropymax_entropyforward
Mean NLLmean_nllforward
Self-Certaintyself_certaintyforward
DeepConfdeepconfforward

License

The code is released under the BSD 3-Clause License.

Third-party material keeps its own terms:

  • data/lens/magistral_block26.npy is derived from Magistral-Small-2507 (Apache 2.0) and was fitted with Anthropic's jacobian-lens reference implementation (Apache 2.0).
  • The Gemma and Qwen lenses are downloaded at run time from neuronpedia/jacobian-lens and are not redistributed here.
  • The anchor terms in data/uspace_terms.yaml are drawn from the uncertainty cues of Chen et al. (2018, Journal of Informetrics) and the certainty norm of Rocklage et al. (2023, Journal of Marketing Research).
  • Models and benchmark datasets are downloaded at run time and are subject to their own licenses.

Citation

@article{braun2026uspace,
  title   = {U-Space: Uncovering When and Why Uncertainty Arises in Language Models},
  author  = {Braun, Tobias and Loose, Nils and Herzog, Alexander and Ceccatelli, Virginia and Rohrbach, Marcus and Eisenbarth, Thomas and Cavallaro, Lorenzo},
  journal = {arXiv preprint arXiv:2610.09087},
  year    = {2026},
  url     = {https://arxiv.org/abs/2610.09087}
}
ai
interpretability
uncertainty

s2labres/U-Space

Official implementation of the U-Space and U-Lens for training-free, interpretable uncertainty tracing in language-model reasoning.

Python

7

18 commits

updated Oct 10, 2026

See the code

See what people are saying

SourceMessageScoreDate

U-Space: Uncovering When and Why Uncertainty Arises in Language Models [R][D] (r/MachineLearning)

If you build on open-weight reasoning models, you have probably wanted a "how sure is the model about this answer?" signal that does not cost 5x sampling, a judge model, or a labeled dataset. Hence, we built the ***U-Lens.*** In one line: &gt;**score** = (how strongly the hidden state points toward…

5

Oct 12, 2026

README

U-Space

Official code for U-Space: Uncovering When and Why Uncertainty Arises in Language Models.

U-Space tracks ambiguity, incomplete information, conflicting evidence, and general uncertainty through language-model generation. U-Lens combines this verbalizable signal with predictive entropy into a label-free, single-pass uncertainty score.

Project page · Paper · PDF · Reproduction guide

This repository reproduces U-Lens and the single-pass baselines in Tables 1 and 2 on Gemma-4-31B-it, Qwen3.5-27B, and Magistral-Small-2507 across MMLU-Pro, Omni-MATH, SuperGPQA, and TriviaQA with seeds 41, 42, and 43.

Setup

pip install -r requirements.txt

Configs

  • configs/reproduce.yaml: paper settings.
  • configs/smoke.yaml: 10 TriviaQA items, one seed, Qwen3.5-4B.

Run

./run.sh          # configs/reproduce.yaml
./run_smoke.sh    # configs/smoke.yaml

run.sh <config> runs every step below in order; finished outputs are skipped.

Pipeline

Inputs and outputs live in data/ (see data/README.md).

stepdescriptionhardware
01_sample_items.pysample 1,000 items per benchmarkCPU
02_generate.pyone reasoning trace per item and seed1 GPU per model
03_label.pyend-of-think position, exclusion, correctnessCPU
04_forward.pyper-token log-probabilities, end-of-think residual state1 GPU per model
05_build_uspace.pyU-Space basis from the terms in data/uspace_terms.yamlCPU
06_score.pyper-item scores of every method in src/methods/CPU
07_tables.pyTables 1 and 2 and the per-model raw tableCPU
python pipeline/01_sample_items.py --config configs/reproduce.yaml
python pipeline/02_generate.py     --config configs/reproduce.yaml --model gemma
python pipeline/03_label.py        --config configs/reproduce.yaml --model gemma
python pipeline/04_forward.py      --config configs/reproduce.yaml --model gemma
python pipeline/05_build_uspace.py --config configs/reproduce.yaml --model gemma
python pipeline/06_score.py        --config configs/reproduce.yaml --model gemma
python pipeline/07_tables.py       --config configs/reproduce.yaml

Run steps 2 to 6 once per model: gemma, qwen, magistral.

Methods

Each method is one module in src/methods/ with NEEDS and score(cell); the interface is documented in src/methods/base.py.

methodmoduleneeds
U-Lensulensforward, basis
A_conea_coneforward, basis
Generation lengthgen_length
MSPmspforward
Predictive entropypredictive_entropyforward
Max entropymax_entropyforward
Mean NLLmean_nllforward
Self-Certaintyself_certaintyforward
DeepConfdeepconfforward

License

The code is released under the BSD 3-Clause License.

Third-party material keeps its own terms:

  • data/lens/magistral_block26.npy is derived from Magistral-Small-2507 (Apache 2.0) and was fitted with Anthropic's jacobian-lens reference implementation (Apache 2.0).
  • The Gemma and Qwen lenses are downloaded at run time from neuronpedia/jacobian-lens and are not redistributed here.
  • The anchor terms in data/uspace_terms.yaml are drawn from the uncertainty cues of Chen et al. (2018, Journal of Informetrics) and the certainty norm of Rocklage et al. (2023, Journal of Marketing Research).
  • Models and benchmark datasets are downloaded at run time and are subject to their own licenses.

Citation

@article{braun2026uspace,
  title   = {U-Space: Uncovering When and Why Uncertainty Arises in Language Models},
  author  = {Braun, Tobias and Loose, Nils and Herzog, Alexander and Ceccatelli, Virginia and Rohrbach, Marcus and Eisenbarth, Thomas and Cavallaro, Lorenzo},
  journal = {arXiv preprint arXiv:2610.09087},
  year    = {2026},
  url     = {https://arxiv.org/abs/2610.09087}
}
ai
interpretability
uncertainty