Preprint · arXiv 2026

UAT-LITE: Inference-Time Uncertainty-Aware
Attention for Pretrained Transformers

Elias Hossain1, Shubhashis Roy Dipta2, Subash Neupane3, Rajib Rana4, Ravid Shwartz-Ziv5, Ivan Garibay1, Niloofar Yousefi1

1University of Central Florida  ·  2University of Maryland, Baltimore County  ·  3Meharry Medical College  ·  4University of Southern Queensland  ·  5New York University

Post-hoc calibration adjusts output probabilities but leaves internal computation untouched; ensembles and Bayesian methods fix that at real training or storage cost. UAT-LITE injects epistemic uncertainty into attention itself at inference time — no weight updates, no change to the training objective.

arXiv 📄 PDF 🖼 Figure

Code release pending

0
Weights Updated
M=10
MC Passes
5
Datasets
5
Seeds

The Problem

Confident, and wrong

Neural NLP models are routinely miscalibrated and overconfident, assigning high confidence to incorrect predictions and expressing no uncertainty at all during internal evidence aggregation. That combination undermines selective prediction and makes high-stakes deployment hard to justify. The existing remedies each give something up.

Post-hoc calibration is skin-deep

Temperature scaling rescales output probabilities globally and does it well, but the internal computation that produced the logits is unchanged. There is no per-token signal and no uncertainty-aware routing — only a sharper or flatter final distribution.

$

Bayesian and ensemble methods cost

Deep ensembles, variational inference, and SNGP improve uncertainty but demand substantial extra training or storage. For an already fine-tuned production checkpoint, retraining to get calibrated confidence is often not on the table.

?

Uncertainty is not localized

A single scalar confidence per prediction says nothing about which tokens were unstable, or where in depth the uncertainty accumulated. That is exactly the diagnostic a practitioner needs when a model fails.


Method

How UAT-LITE works

UAT-LITE estimates token-level epistemic uncertainty from stochastic forward passes with Monte Carlo dropout at the embedding layer, then uses it to modulate self-attention during contextualization. Tokens the model is unsure about are attenuated as sources of evidence rather than trusted equally. Nothing about the pretrained weights or the training objective changes.

α′ij = αij · exp( −λ · U(xj) ) Attention from token i to token j is down-weighted in proportion to the epistemic uncertainty of the key token j, with λ controlling modulation strength.
UAT-LITE architecture: Bayesian embedding calibration with Monte Carlo sampling produces token-level epistemic uncertainty, which modulates attention inside a pretrained transformer encoder; layer-wise variance decomposition and a confidence-guided decision module follow

Figure 1. Overview of UAT-LITE. Token-level epistemic uncertainty is estimated by Monte Carlo sampling at the embedding layer and used to modulate self-attention in a pretrained transformer encoder. A layer-wise variance decomposition attributes predictive uncertainty across depth, and a confidence-guided decision module converts sequence-level uncertainty into a predict-or-abstain choice.

1

Estimate

MC dropout at the embedding layer gives M stochastic representations per token. Token-level epistemic uncertainty is the variance across those samples, computed without touching the pretrained parameters.

2

Modulate

Uncertainty scales attention multiplicatively during contextualization, so unstable tokens contribute less evidence. A Q/K/V ablation isolates where the modulation should be applied.

3

Decompose

A layer-wise variance decomposition diagnoses how predictive uncertainty accumulates across transformer depth. It is purely diagnostic and does not alter the forward pass.

4

Decide

Aggregated stochastic logits drive a confidence-guided decision: predict when confident, abstain when not. Temperature scaling can be applied to the MC-mean logits when calibrated probabilities are required.


Results

Calibration without retraining

Evaluated on SQuAD 2.0 answerability, MNLI, and SST-2 over five seeds with a fine-tuned BERT-base backbone, plus MedQA and PubMedQA as a clinical domain-transfer stress test. Expected Calibration Error uses 15 fixed-width confidence bins.

MethodSQuADMNLISST-2Avg ECE ↓
BERT-base0.18680.08160.05310.1072
MC Dropout (uniform)0.1730.0900.0390.101
Deep Ensemble (5)0.1680.0600.0370.089
Global MC Dropout0.16000.05650.05010.0889
UAT-LITE0.16470.06380.06080.0964
Base + TS0.07880.01480.01630.0366
UAT-LITE + TS0.07600.02010.01910.0384

Table 1. In-domain ECE (lower is better), mean over five seeds, M = 10. UAT-LITE improves on the fine-tuned baseline (0.1072 → 0.0964) while preserving accuracy, and UAT-LITE + TS reaches the best SQuAD ECE of any method here. Temperature scaling remains the strongest single lever for marginal ECE, and the paper says so plainly — UAT-LITE's contribution is uncertainty-aware internal routing and token-level diagnostics, which TS cannot provide at all.

MethodID ECE ↓OOD ECE ↓Avg ECE ↓ID Acc ↑OOD Acc ↑
Base0.08090.05550.06820.71620.7459
Base + TS0.01470.02080.01770.71620.7459
Global MC Dropout0.05860.03340.04600.70900.7398
UAT-LITE0.06500.04020.05260.70990.7395
UAT-LITE + TS0.01630.01990.01810.71050.7394

Table 2. Distribution-shift robustness on MNLI (matched → mismatched), mean over five seeds. UAT-LITE cuts average ECE from 0.0682 to 0.0526, roughly a 23% relative reduction, at accuracy within 0.6 points of the base model. UAT-LITE + TS gives the smallest ID-to-OOD calibration gap of any configuration (0.0035), which is the property that matters when the deployment distribution is not the training one.

Q

Where to modulate

A Q/K/V ablation at λ = 0.5 finds K-only lowest in ECE on SST-2 and MNLI but sharply damaging to SQuAD accuracy; Q-only gives the most consistent trade-off across tasks; V-only best preserves accuracy; and modulating all three can over-regularize.

Depth-wise attribution

The layer-wise variance decomposition separates aleatoric from epistemic contributions across depth, identifying which layers drive predictive uncertainty. This is a diagnostic no output-level calibration method can produce.

Clinical transfer

MedQA and PubMedQA serve as a domain-transfer stress test beyond the general NLP suites, reported with ECE and accuracy side by side rather than calibration alone.


Limitations

What this does not claim

The paper is deliberate about not overselling the method against a very strong and very cheap baseline.

T

Temperature scaling wins on marginal ECE

For the single goal of minimizing marginal calibration error in-domain, temperature scaling is stronger and far cheaper than modulating attention. UAT-LITE is not positioned as a replacement; the most reliable configuration in these evaluations is UAT-LITE + TS, which combines them.

λ

Sensitivity is modest but real

ECE varies within a narrow band (range under 0.007) across the settings swept, with negligible accuracy change, and the Q/K/V choice matters more than it might appear — K-only trades SQuAD accuracy for calibration gains elsewhere.

Reading the tables honestly. SNGP records a lower in-domain average ECE than UAT-LITE, and temperature scaling is close behind at a fraction of the cost. The case for UAT-LITE is not that it wins the ECE column outright: it is that it delivers uncertainty-aware internal routing, token-level signals, and depth-wise attribution on a frozen checkpoint, none of which output-level rescaling can offer, and that it composes with TS rather than competing with it.

Citation

Cite UAT-LITE

If you find UAT-LITE or the layer-wise variance decomposition useful in your research, please consider citing the paper.

@article{hossain2026uatlite, title = {UAT-LITE: Inference-Time Uncertainty-Aware Attention for Pretrained Transformers}, author = {Hossain, Elias and Dipta, Shubhashis Roy and Neupane, Subash and Rana, Rajib and Shwartz-Ziv, Ravid and Garibay, Ivan and Yousefi, Niloofar}, year = {2026}, journal = {arXiv preprint arXiv:2602.02952}, eprint = {2602.02952}, archivePrefix = {arXiv}, }