Human–Machine Convergence

Precision-weighted attention as a testable architecture

Rajesh Ranjan Mahapatra

A first-principles design and intervention protocol for separating semantic relevance from source reliability inside attention.

© 2026 Rajesh Ranjan Mahapatra. 30 min read

Precision-weighted attention as a testable architectureAll Human–Machine Convergence
rajeshrmahapatra.com Human and machine intelligence

Original architectures and a defensible contribution

Precision-weighted attention as a testable architecture

Attention becomes more reliable under uneven input noise only when semantic relevance and evidential precision are represented as separate, intervenable quantities rather than compressed into one score.

TLDR

  1. Softmax ranks match, not trustworthiness.
  2. Precision means inverse conditional variance, not confidence theatre.
  3. A log-precision channel can reweight equally relevant evidence.
  4. Swap, calibration and homoscedastic-null tests expose false precision.
  5. Use the architecture only where reliability evidence survives intervention.

The silted gauge

At 03:10, a flood-control model receives two readings from the same bend in a river. Gauge A reports 4.1 metres. Gauge B reports 7.8 metres. Both records carry the same station name, location, unit and timestamp. Both are therefore equally relevant to the query, “What is the water level here now?”

One fact is missing from the semantic representation. Gauge A was calibrated that morning. Gauge B sits behind a silted inlet and has been oscillating for hours. A standard attention head can learn that either gauge matters, but its score has no declared place where “this measurement is noisier” must live. It may infer reliability from context. It may also fail to do so, or encode reliability in a way that nobody can isolate.

The likely intuition is that training will solve this. The hidden assumption is stronger: whatever raises or lowers a query-key score is allowed to stand simultaneously for relevance, reliability, frequency, position and convenience. When those causes move together, the shortcut works. When relevance stays fixed and reliability changes, the shortcut has no guaranteed response.

This paper asks for a narrower mechanism. Keep the relevance score. Add a separately trained estimate of how much noise the value is expected to carry. Then make the two channels face different interventions. The proposal is useful only if it predicts a change that ordinary softmax, global temperature and an equal-capacity extra scorer do not.

Figure 1. A precision field bends equally relevant currents differently

Attention currents passing through a precision field Four source currents approach a query lens. Two sources are equally semantically relevant, but the clean source keeps a wide solid current while the noisy source narrows through dashed uncertainty contours. Irrelevant sources remain weak even when reliable. uncertainty contours query lens relevant clean relevant noisy irrelevant clean irrelevant noisy same semantic match
Conceptual figure Relevance determines whether a source belongs in the conversation. Precision determines how much an admitted source should move the estimate. The geometry is the argument: one field filters current strength without redefining destination.

When match and trust diverge

Scaled dot-product attention has a clean job. For query position i, it compares a query vector with each key, turns those scores into non-negative weights, and averages the associated values. The familiar expression is compact because it leaves many semantic questions to training.

rij = qiTkj / √dk    aij = softmaxj(rij)    yi = Σjaijvj q is what the current position asks for; k advertises what a source contains; v is the contribution carried forward; d controls score scale. This is the architecture introduced by Vaswani and colleagues.[1]

Nothing in this equation requires a score to mean only semantic relevance. A key can encode source quality, recency, typography, position or a learned convention. That flexibility is a strength. It is also the reason a high attention weight cannot automatically be read as a calibrated statement of reliability, importance or causal responsibility. The empirical debate over attention as explanation reached different conclusions under different definitions and tests.[8][9] For this paper, the safe claim is narrower: a weight tells us how the configured layer mixed values on that pass.

Mechanism

Softmax creates competition among scores; it does not specify which causal property each score encodes. If reliability happens to be recoverable from the same representation, training may use it. If an intervention changes reliability while preserving the features used by the relevance score, ordinary attention has no structural obligation to respond.

Three questions hidden inside one weight

Consider three records that all mention the correct river station. The first is a recent but noisy sensor reading. The second is a stable reading from yesterday. The third is a clean message from a station technician who is not authorised to declare an evacuation. A single ranking can order them, but it cannot tell us why one outranks another.

Relevance, precision and authority answer different counterfactual questions. Relevance asks whether the content bears on the present query. Precision asks how much the observation would vary across admissible repetitions. Authority asks whether the source may be used for this purpose and whether any proposed action is permitted. A source can be relevant but imprecise, precise but stale, or precise and relevant but unauthorised.

This separation matters because attention weights are normalised mixing coefficients, not posterior probabilities that a source is true. If the query changes, relevance may change while sensor repeatability does not. If a calibration fault is injected, precision should change while semantic match does not. If a policy expires, authority should change even when both learned scores remain stable. These are three distinct interventions.

A model may compress all three into one representation and perform well on familiar data. The cost appears during diagnosis. When a weight moves, nobody can say whether the system discovered a better match, distrusted the source, or learned a policy shortcut. The proposed architecture does not solve authority. It simply reserves one testable channel for evidential reliability so that the cause of a movement can be challenged.

The replacement that should matter

This thought experiment reveals why “the model could learn it” is not yet an explanation. A sufficiently expressive network could learn almost any useful correlation. The research question is whether a declared mechanism reacts to a controlled cause. That requires a channel whose intended quantity can be held fixed, changed and measured.

Figure 2. The reliability intervention leaves relevance untouched

Counterfactual intervention on source variance Two panels contain the same query and tied relevance scores. In the left panel both sources are precise and receive equal weight. In the right panel source B becomes noisy; standard attention remains tied while precision-factorised attention shifts weight to source A. World 1 · equal noise World 2 · B is corrupted query A B r = 2, π = 16r = 2, π = 16 softmax = precision: 50% / 50% query A B r = 2, π = 16r = 2, π = 1 softmax remains 50% / 50% precision response: 94% / 6%
Causal intervention The right panel alters one causal property only. A valid precision mechanism must move; a relevance-only tie need not. The percentages use illustrative precisions and are not deployment measurements.

Why existing alternatives do not answer the same question

Several useful attention variants alter concentration or geometry. Query-key normalisation controls vector scale and replaces the fixed square-root factor with a learned scale, reducing arbitrary softmax saturation in the reported setting.[2] Sparsemax and entmax can set low-scoring alternatives exactly to zero, changing support and gradient behaviour.[3][4] Elliptical Attention changes the metric used to define contextual neighbourhoods and reports robustness benefits.[14]

Each may improve a system. None, by its definition alone, says that two equally relevant values with different conditional variances should receive different influence. Sharpness, sparsity, geometric relevance and evidential precision are four different design variables. A model can use all four, but an experiment must not credit one for the work of another.

The strongest case for leaving softmax alone

Ordinary attention is not defective merely because its score lacks a fixed interpretation. On many tasks, values are complementary features rather than repeated measurements of one quantity. A syntactic relation, a named entity and a distant instruction may all need to be combined. There may be no meaningful variance target for any one value. In that case, forcing an inverse-variance story onto the layer would manufacture a probability model that the task does not possess.

There is also a simpler engineering argument. If reliability is perfectly predictable from the same key features that determine relevance, a separate head may add parameters without adding an identifiable cause. The right baseline is then a matched source-specific bias with the same capacity. A precision channel earns its complexity only when a reliability intervention changes its output in a way the matched scorer does not predict.

That criterion keeps the proposal narrow. Use standard attention when no repeatable error process can be defined, when the signals cannot be separated before observing the answer, or when a calibrated gate brings no decision benefit. The aim is not to Bayesianise every attention layer. It is to create a specialised mechanism for tasks where match and trust can genuinely diverge.

The argument in one pass
Chart · flow
flowchart TD
  A["The silted gauge"] --> B["When match and trust diverge"]
  B --> C["Two dials, one update"]
  C --> D["Make precision earn its name"]
  D -. "re-test" .-> A
  classDef first fill:#0a1424,stroke:#B96D00,stroke-width:2px,color:#e6f3ff
  classDef step fill:#0a1424,stroke:#3f7da0,stroke-width:1px,color:#e6f3ff
  class A first
  class B,C,D step
A structural route through Precision-weighted attention as a testable architecture: from The silted gauge to Keep precision only if reliability can…. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

Two dials, one update

The smallest useful meaning of precision comes from repeated measurement. Imagine several sources estimating the same scalar quantity. Each source is unbiased, and its noise is independent of the others. Under those assumptions, the minimum-variance linear estimate gives more influence to smaller variance.

πj = 1 / σj2    ŷ = (Σjπjxj) / (Σjπj) x is a source estimate; σ² is its conditional noise variance; π is precision. The equation is valid when the sources estimate the same quantity, are unbiased and have known independent noise.

Worked example 1 · two tied sources

Suppose two keys have the same relevance logit, 2. Source A has standard deviation 0.2, so its precision is 25. Source B has standard deviation 1, so its precision is 1. Standard softmax gives 50% to each because the relevance logits tie. Precision weighting gives A a share of 25 ÷ 26, or 96.2%, and B 3.8%.

The numerical result is not a universal attention rule. It follows from the observation model. Remove independence, common target or unbiasedness, and the optimal weights change.

Figure 3. Three measurements on one line expose the role of variance

Three source measurements and two aggregate estimates A number line shows a clean measurement at 10.1 with a narrow uncertainty band, a moderately noisy measurement at 10.4 and a highly noisy outlier at 14 with a wide uncertainty band. The equal average is pulled right while the precision-weighted estimate remains near the clean measurements. 9 10 11 12 13 14 A · 10.1narrow noise B · 10.4 C · 14.0, wide noise equal average 11.5 precision estimate 10.3
Annotated worked example · illustrative The uncertainty bands, not the distance from the final answer, determine the precision weights. Using realised error to set precision would leak the answer into the estimator.

Deriving the rule from a physical situation

Let each source observe the same hidden scalar level z. Source j returns xj = z + εj, where the error has mean zero and variance σj2. Assume the errors are independent. We seek a weighted estimate whose weights sum to one, so an unbiased set of observations remains unbiased. Minimising the variance of that estimate gives weights proportional to inverse variance.

wj = πj / Σkπk    πj = 1 / σj2    Var(ẑ) = 1 / Σkπk Here π is precision. The result is valid only for a shared target, unbiased observations and independent errors with known variances.

For the two-source example, equal averaging has variance 0.25 × 0.04 + 0.25 × 1 = 0.26. Precision weighting has variance 1 ÷ 26, about 0.0385. Its standard deviation is therefore about 0.196 rather than 0.510. The clean source does not win because it is more semantically related. It wins because repeated readings cluster more tightly around the same quantity.

Change one assumption and the rule changes. If the errors are correlated, the optimal weights depend on the full covariance matrix and are proportional to Σ−11, not to a list of independent precisions. If a source has a stable bias, minimising variance can favour a repeatably wrong observation; mean-squared error must include that bias. If values carry different features rather than estimates of one latent quantity, the derivation no longer licenses inverse-variance averaging.

The architecture therefore borrows a rule from estimation only where the task supplies the corresponding observation model. Elsewhere, the same algebra may still be useful as a gate, but “precision” becomes a hypothesis to test rather than a meaning guaranteed by notation.

What the word precision commits us to

Precision is not attention entropy. A sharp distribution can be confidently wrong. Precision is not model confidence in the final class. Output calibration and source-level observation noise are related only through a specified model. Precision is not source prestige. A prestigious source can be irrelevant; a low-status sensor can be repeatable. In the minimal proposal, precision is the inverse conditional variance of the value contribution, given the evidence available before the target is known.

That definition targets heteroscedastic aleatoric uncertainty: noise changes across inputs. Epistemic uncertainty concerns what the precision estimator does not know and may require ensembles, approximate posteriors or other model-uncertainty methods. Kendall and Gal’s widely used distinction is helpful here, but it does not make every learned variance well calibrated.[6] Accuracy and calibration are separate properties.[7]

The minimal factorisation

Let the ordinary relevance logit remain r. Let a separate head predict log precision ℓ from reliability evidence. To keep extreme claims from overwhelming semantic match, clip this term within a declared bound b. The attention weight is then:

ℓj = clip(log πj, −b, b)    wij = softmaxj(rij + ℓj)    yi = Σjwijvj The ratio between two tied sources becomes wi1/wi2 = π1/π2. When every π is the same constant, the constant cancels and the layer reduces exactly to standard attention.

This algebra is not claimed as historically first. Heo and colleagues previously learned input-dependent uncertainty over attention and assessed calibration and abstention.[5] Recent preprints go further. The Bayesian Filtering Transformer reweights attention by relevance times precision and propagates precision through residual and feed-forward updates.[11] Robust Filter Attention derives weighting from a linear stochastic dynamical prior.[12] Kalman Linear Attention carries belief-state uncertainty through an efficient sequence mixer.[13]

Evidence status

The earlier attention, calibration and sparsity papers are peer-reviewed. The three 2026 filtering architectures are recent preprints or current review-stage work and should be treated as promising, not settled. The contribution here is a minimal identifiability contract and matched intervention protocol, not a claim to have originated uncertainty-aware attention.

Why log precision enters additively

Standard attention assigns unnormalised mass exp(rj) to source j. If that mass expresses relevance and πj expresses independently estimated reliability, the smallest factorisation multiplies them: exp(rj)πj. Normalising across sources is exactly the same as applying softmax to rj + log πj.

This form has three useful invariants. Multiplying every precision by the same positive constant changes no weight. Setting every precision equal recovers ordinary softmax exactly. Swapping two precisions while keeping relevance fixed swaps only the reliability contribution. By contrast, multiplying a raw relevance logit by precision can behave strangely when logits are negative, and a global temperature cannot distinguish tied sources.

The factorisation still needs restraints. A predicted log precision can dominate the semantic score, especially when the estimator extrapolates beyond training data. The minimal design therefore bounds the log-precision term, records when clipping occurs and calibrates the estimator on held-out corruption levels. Addition in log space is not a proof of Bayesian correctness; it is the simplest algebra that makes the two causes separately inspectable.

Make precision earn its name

An unconstrained neural head can write any useful bias into ℓ. Calling that output “precision” would add vocabulary, not knowledge. The architecture therefore needs an information boundary and a test contract.

The precision-factorisation contract

The smallest useful implementation gives the relevance path and the precision path different inputs and different losses.

Practitioner synthesis

Relevance asks whether a value bears on the query. Precision asks how variable that value would be across admissible repetitions. The relevance head may see query and key content. The minimal precision head should not see the query. It receives source-local reliability evidence such as sensor health, extraction quality, observation count or a corruption signature. A query-dependent precision extension is possible, but its identifiability burden is higher because it can become a second relevance model.

Train the precision head against a held-out residual target, repeated observations or known synthetic corruption. For Gaussian residuals, a heteroscedastic likelihood is one option, but it is not automatically safe. Seitzer and colleagues show that common likelihood training can settle on poor, stable variance estimates under certain optimisation conditions.[10] A practical implementation should compare loss choices, cap log precision, monitor calibration and refuse to infer causal reliability from training loss alone.

ContractRequired observationFailure interpretation
Uniform-precision reductionAll equal precisions reproduce standard attention within numerical tolerance.The implementation changes more than reliability.
Relevance invarianceNoise-only corruption leaves the relevance score stable.Reliability is leaking into the semantic channel.
Precision monotonicityControlled noise lowers predicted precision on held-out samples.The head is not tracking the declared quantity.
Precision swapSwapping reliability evidence swaps influence under tied relevance.The channel lacks causal leverage.
Homoscedastic nullNo systematic gain when every source has equal noise.Improvement may come from capacity or regularisation.
CalibrationPredicted variance agrees with residual frequency or interval coverage.The numbers cannot support precision semantics.

Six tests before the label is earned

  1. Input separation. Declare which features each path may see. The relevance path can inspect query and content. The precision path begins with source-local evidence. Any shared features must be justified and ablated.
  2. Held-out calibration. Predict residual variance on examples not used to fit the precision head. Report calibration by corruption regime, not only one aggregate likelihood. A low training loss does not establish usable precision.
  3. Intervention invariance. Change known corruption while preserving content. Relevance should remain approximately stable, precision should move monotonically, and the output should move in the predicted direction.
  4. Homoscedastic null. When all sources have equal noise, the calibrated method should reduce to its ordinary-attention baseline. A gain in this regime suggests extra capacity or optimisation, not reliability weighting.
  5. Matched rival. Give an unconstrained bias head the same parameter budget and source features. Precision earns an interpretation only if calibration and swap behaviour explain gains that raw capacity cannot.
  6. Boundary faults. Inject stable bias, duplicated evidence, distribution shift and forged reliability metadata. The system should expose or abstain at these boundaries rather than convert low variance into counterfeit certainty.

These tests are deliberately redundant. A model can pass calibration while ignoring the channel during inference. It can pass the swap test with a badly calibrated estimator. It can improve task error while exploiting a leakage feature. The claim becomes credible only when predictive performance, calibration and causal response agree.

Figure 4. Interactive tied-relevance laboratory

2.0
25.0
2.0
1.0
1.0
Current allocation
softmax A
50.0%
softmax B
50.0%
precision A
96.2%
precision B
3.8%

Try changing temperature while relevance stays tied. Softmax remains tied. Then swap the precisions and watch only the precision allocation reverse.

Executable browser instrument · illustrative The widget exposes the invariance that distinguishes a source-specific precision intervention from global temperature. It makes no claim that the selected precision values are calibrated.

A synthetic benchmark that can return a null

Worked example 2 · four sources, one controlled cause

The executable lab generates a scalar target and four observations: a clean relevant source, a noisy relevant source, a clean distractor and a noisy distractor. Relevance logits stay fixed at 2, 2, −1.5 and −1.5. Only the noisy sources’ standard deviation changes. The precision method receives inverse variance, with an optional log-normal calibration error.

At a noise ratio of 1, every source has the same noise. Calibrated precision attention therefore equals standard softmax by construction. As the ratio grows, standard attention continues to split mass between the two relevant sources, while precision attention discounts the noisy one. A global temperature is allowed to choose its best value from a grid, so the comparison is not against a deliberately weak baseline.

Figure 5. The gain appears only when noise becomes uneven

Synthetic mean squared error as source noise risesA log-scale line chart compares softmax, the best global temperature, calibrated precision-factorised attention and a deliberately noisy precision estimator over five noise ratios. Precision methods match softmax when noise is uniform and separate strongly as heteroscedasticity rises.0.060.10.312124812Noisy-source standard deviation ÷ clean-source standard deviationMean squared error, log scaleSoftmaxBest global temperaturePrecision, calibratedPrecision, noisy estimate
Measured synthetic simulation Forty thousand Monte Carlo trials per condition, random seed 203. Calibrated precision matches softmax at the homoscedastic point, then remains near 0.06 MSE as the noisy-source standard deviation rises. The noisy precision estimator degrades but stays below the best-temperature baseline in these conditions. These results test the mechanism, not language-model scale.
Open research hypothesis

On tasks with independently verifiable heteroscedastic input noise, a calibrated precision channel will improve error and intervention fidelity more than an equal-parameter unconstrained bias head. Evidence strengthens the claim only if the gain grows with heteroscedasticity, disappears when noise is uniform, survives a matched-capacity baseline and tracks precision calibration. A result that improves accuracy while failing those tests weakens the precision interpretation.

Executable lab

Reading the benchmark without flattering the method

The synthetic run uses 40,000 trials and seed 203. When the noise ratio is 1, the oracle precision method and ordinary softmax have the same mean-squared error, about 0.031. This equality is not an inconvenience. It is the required null. A noisy estimate of precision is worse in the same regime, about 0.042, because an unnecessary uncertain channel perturbs a problem that needed no reweighting.

At a noise ratio of 8, softmax reaches about 0.958 error. The best global temperature on the declared grid improves that to about 0.759 by changing overall concentration. It still cannot favour one of two tied relevant sources. Calibrated precision reaches about 0.060 because it changes their relative influence. With noisy log precision, error rises to about 0.084. At log-precision error standard deviation 2, the calibration experiment deteriorates further to roughly 0.260.

These numbers do not predict a language-model gain. They expose the signature the architecture must reproduce: no advantage under equal noise, increasing advantage as heteroscedasticity grows, and graceful loss of advantage as precision calibration worsens. An empirical paper that reports only the favourable high-noise point would hide the very evidence needed to identify the mechanism.

Run the intervention, not just the equation

The standard-library Python programme reproduces Figure 5, emits CSV, and asserts three invariants: uniform precision reduces to softmax; swapping precision swaps influence under a relevance tie; global temperature cannot break that tie.

Python 3 · no third-party packagesprecision-attention-lab.py
#!/usr/bin/env python3
"""Synthetic intervention lab for precision-factorised attention.

The experiment holds semantic relevance fixed while changing source noise.
It compares standard softmax, the best global temperature on a small grid,
and precision-factorised attention (PFA):

    weight_j = softmax(relevance_logit_j + log(precision_j))

Only Python's standard library is required.
"""

from __future__ import annotations

import argparse
import csv
import math
import random
import sys
from dataclasses import dataclass
from typing import Iterable, Sequence


LOGITS = (2.0, 2.0, -1.5, -1.5)
TEMPERATURE_GRID = (0.20, 0.30, 0.45, 0.67, 1.0, 1.5, 2.2, 3.3, 5.0, 7.5)


@dataclass(frozen=True)
class Record:
    target: float
    values: tuple[float, float, float, float]
    variances: tuple[float, float, float, float]


def softmax(scores: Sequence[float]) -> tuple[float, ...]:
    maximum = max(scores)
    exps = [math.exp(score - maximum) for score in scores]
    total = sum(exps)
    return tuple(value / total for value in exps)


def weighted_sum(weights: Sequence[float], values: Sequence[float]) -> float:
    return sum(weight * value for weight, value in zip(weights, values, strict=True))


def make_records(*, trials: int, noise_ratio: float, seed: int) -> list[Record]:
    rng = random.Random(seed)
    clean_sigma = 0.25
    noisy_sigma = clean_sigma * noise_ratio
    sigmas = (clean_sigma, noisy_sigma, clean_sigma, noisy_sigma)
    variances = tuple(sigma * sigma for sigma in sigmas)
    records: list[Record] = []

    for _ in range(trials):
        target = rng.gauss(0.0, 1.0)
        distractor_target = rng.gauss(0.0, 1.0)
        values = (
            target + rng.gauss(0.0, sigmas[0]),
            target + rng.gauss(0.0, sigmas[1]),
            distractor_target + rng.gauss(0.0, sigmas[2]),
            distractor_target + rng.gauss(0.0, sigmas[3]),
        )
        records.append(Record(target, values, variances))
    return records


def mse(records: Iterable[Record], weights_for) -> float:
    squared_error = 0.0
    count = 0
    for record in records:
        prediction = weighted_sum(weights_for(record), record.values)
        squared_error += (prediction - record.target) ** 2
        count += 1
    if count == 0:
        raise ValueError("At least one record is required")
    return squared_error / count


def standard_weights(_: Record) -> tuple[float, ...]:
    return softmax(LOGITS)


def temperature_weights(temperature: float):
    if temperature <= 0:
        raise ValueError("temperature must be positive")
    weights = softmax(tuple(logit / temperature for logit in LOGITS))
    return lambda _: weights


def pfa_weights(*, calibration_log_sd: float, seed: int):
    """Create a deterministic stochastic precision estimator.

    calibration_log_sd=0 uses oracle inverse variances. Larger values apply
    multiplicative log-normal error to precision estimates. Log precision is
    clipped to [-4, 4], modelling the bounded precision bias proposed in the paper.
    """

    rng = random.Random(seed)

    def weights(record: Record) -> tuple[float, ...]:
        scores: list[float] = []
        for logit, variance in zip(LOGITS, record.variances, strict=True):
            log_precision = -math.log(variance)
            if calibration_log_sd:
                log_precision += rng.gauss(0.0, calibration_log_sd)
            log_precision = min(4.0, max(-4.0, log_precision))
            scores.append(logit + log_precision)
        return softmax(scores)

    return weights


def benchmark(*, trials: int, seed: int) -> list[dict[str, float]]:
    rows: list[dict[str, float]] = []
    for index, ratio in enumerate((1.0, 2.0, 4.0, 8.0, 12.0)):
        records = make_records(trials=trials, noise_ratio=ratio, seed=seed + index)
        baseline = mse(records, standard_weights)
        best_temperature = min(
            mse(records, temperature_weights(temperature))
            for temperature in TEMPERATURE_GRID
        )
        oracle = mse(records, pfa_weights(calibration_log_sd=0.0, seed=seed + 100 + index))
        noisy = mse(records, pfa_weights(calibration_log_sd=1.0, seed=seed + 200 + index))
        rows.append(
            {
                "noise_ratio": ratio,
                "softmax_mse": baseline,
                "best_temperature_mse": best_temperature,
                "oracle_pfa_mse": oracle,
                "noisy_pfa_mse": noisy,
            }
        )
    return rows


def calibration_stress(*, trials: int, seed: int) -> list[dict[str, float]]:
    records = make_records(trials=trials, noise_ratio=8.0, seed=seed)
    rows = []
    for index, log_sd in enumerate((0.0, 0.5, 1.0, 1.5, 2.0)):
        rows.append(
            {
                "precision_log_sd": log_sd,
                "pfa_mse": mse(records, pfa_weights(calibration_log_sd=log_sd, seed=seed + 300 + index)),
            }
        )
    return rows


def intervention_checks() -> None:
    base = softmax((2.0, 2.0))
    uniform_precision = softmax((2.0 + math.log(3.0), 2.0 + math.log(3.0)))
    if max(abs(a - b) for a, b in zip(base, uniform_precision, strict=True)) > 1e-12:
        raise AssertionError("Uniform precision must reduce exactly to standard attention")

    high_low = softmax((2.0 + math.log(25.0), 2.0 + math.log(1.0)))
    low_high = softmax((2.0 + math.log(1.0), 2.0 + math.log(25.0)))
    if not (high_low[0] > 0.95 and low_high[1] > 0.95):
        raise AssertionError("Swapping precision should swap influence under tied relevance")

    for temperature in (0.25, 1.0, 4.0):
        tie = softmax((2.0 / temperature, 2.0 / temperature))
        if abs(tie[0] - 0.5) > 1e-12:
            raise AssertionError("A global temperature cannot break a relevance tie")


def write_csv(rows: Sequence[dict[str, float]], stream) -> None:
    writer = csv.DictWriter(stream, fieldnames=list(rows[0].keys()))
    writer.writeheader()
    writer.writerows(rows)


def main() -> int:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--trials", type=int, default=40_000, help="Monte Carlo trials per condition")
    parser.add_argument("--seed", type=int, default=203, help="Random seed")
    parser.add_argument(
        "--mode",
        choices=("benchmark", "calibration", "checks"),
        default="benchmark",
        help="Experiment to run",
    )
    args = parser.parse_args()

    if args.trials < 1:
        parser.error("--trials must be at least 1")

    intervention_checks()
    if args.mode == "checks":
        print("PASS: uniform-precision, precision-swap and temperature-tie invariants")
        return 0
    if args.mode == "calibration":
        write_csv(calibration_stress(trials=args.trials, seed=args.seed), sys.stdout)
        return 0

    write_csv(benchmark(trials=args.trials, seed=args.seed), sys.stdout)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

How to use it

python precision-attention-lab.py --trials 40000 --seed 203 prints the benchmark. Add --mode calibration to corrupt the precision estimates, or --mode checks to run only the invariants.

A positive result permits a limited statement: precision weighting helps this declared observation model under uneven noise. A negative result may mean the estimator is miscalibrated, the independence assumptions fail, or the task does not benefit from reliability weighting. The lab cannot establish gains in a trained transformer, the correctness of a real reliability signal or general robustness.

Simulation outputs and calibration stress test
Noise ratioSoftmax MSEBest temperatureCalibrated precisionNoisy precision
10.0310.0310.0310.042
20.0750.0750.0490.069
40.2530.2390.0570.083
80.9580.7590.0600.084
122.1421.4940.0600.080

At noise ratio 8, increasing log-precision error produces the expected deterioration:

Log-precision error SDPrecision MSE
0.00.060
0.50.062
1.00.081
1.50.148
2.00.260

A configured RAG system

Worked example 3 · policy evidence with unequal reliability

A retrieval system finds four passages for “What overdraft limit applies to this account?” One is the current signed policy. One is an expired memo. One is a duplicated copy of the signed policy. One is an OCR extraction with damaged numbers. All can be semantically close to the query, so relevance alone may rank them highly.

A source-local precision head may use version status, effective-time consistency, signature authority, extraction confidence and prior residuals. These are still proxies until calibrated against retrieval errors. The layer may reweight the context proposal, but it must not decide permission or execute an account change. Precision belongs inside probabilistic evidence allocation; authority remains in a deterministic policy boundary.

Figure 6. Precision changes the proposal, not the authority boundary

A retrieval system with separate relevance, precision and authority boundaries Four document passages enter a relevance lens and a source-local precision sieve. Their combined weights form a context proposal. A separate deterministic authority boundary checks identity, purpose, temporal entitlement and action type before any effect. retrieved evidence signed current policyrelevant · reliable expired memorelevant · stale duplicate policy copyrelevant · correlated damaged OCR extractrelevant · noisy relevance lensquery ↔ content precision sievesource-local evidence context proposalweighted passagesplus provenance authorityboundary identitypurposetimepermissiontyped actionreadback no direct effect path
Configured-system view Relevance and precision shape permitted context. They do not establish factual entitlement, authority or verified outcome. Correlated duplicates remain a separate risk.

From reweighting to operating evidence

A deployed system needs to preserve the facts that justified each precision value. For a sensor, that may include calibration record, operating range and recent residual history. For retrieval, it may include document lineage, effective time, extraction method and duplicate cluster. Store those inputs beside the model version, the bounded log precision, the relevance logit and the resulting contribution.

This record supports a different-path review. A downstream verifier can inspect the authoritative source or read back the world state without reusing the same attention calculation. It also prevents the word precision from laundering an unverifiable model score into fact. The attention layer may propose how evidence is mixed; it does not authorise the evidence, grant permission or prove the resulting action succeeded.

How the claim changes under pressure
Chart · state
stateDiagram-v2
  [*] --> Claim
  state "Figure 1. A precision field<br/>bends equally relevant<br/>currents differently" as Claim
  state "Three questions hidden inside<br/>one weight" as Test
  state "The replacement that should matter" as Revision
  Claim --> Test: expose mechanism
  Test --> Decision: evidence survives
  Test --> Revision: rival survives
  Revision --> Claim: narrow or rebuild
  Decision --> [*]
The revision loop begins with Figure 1. A precision field bends… and keeps counterexamples inside the reasoning path. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

Evidence before architecture

The strongest rival explanation is simple: an extra head gives the network extra capacity. The model improves, but the output called precision is merely a useful second score. A credible experiment must make that rival work hard.

A matched experiment with rival generators

Train four models with matched width, optimiser, data and parameter count: standard attention; temperature or entropy-controlled attention; an unconstrained auxiliary bias head; and precision-factorised attention. The auxiliary bias head may see the same number of features and add a source-specific term to the logits, but receives no variance target and carries no precision semantics. Add sparsemax or entmax if support is a plausible cause of the gain.

Then create paired examples from the same underlying source. Preserve content and labels. Change only known corruption severity. Record task error, calibration of predicted variance, relevance invariance, precision monotonicity, output movement under a precision swap, and the homoscedastic null. Performance without mechanism confirmation counts as an architecture result, not evidence for precision.

Figure 7. The release path contains a deliberate off-ramp

Experimental protocol The final checkpoint is not “accuracy improved”. It is “accuracy improved for the predicted reason, and the declared nulls remained null”. A failed mechanism gate routes the design back to ordinary architecture search.

What would strengthen or weaken the proposal

Figure 8. Evidence matrix for a precision claim

ObservationPrecision interpretationCapacity alternativeDecision
Gain grows with controlled heteroscedasticityExpectedPossibleContinue
Gain persists under uniform noiseUnexpectedLikelyInvestigate regularisation
Variance is calibrated and swap moves influenceStrong supportHarder to explainAdvance claim
Accuracy rises but precision is uncalibratedWeakStrongRename as auxiliary gating
Independent corruption test reverses gainWeakenedOpenDo not release
Correlated duplicates are overcountedModel misspecificationAlso vulnerableAdd covariance or deduplication
Decision instrument No single metric earns the word precision. The claim requires a pattern across performance, calibration, intervention and null conditions.

The strongest boundary: witnesses are rarely independent

Figure 9. Duplicate evidence creates a false precision cascade

Correlated evidence and forged precision failure paths A single source root fans into six duplicate documents, each stamped high precision, and they converge on an overconfident estimate. A separate adversarial document forges a precision stamp. Deduplication, provenance clustering and calibration gates interrupt the paths. onerumour copy · π highcopy · π highcopy · π highcopy · π highcopy · π highcopy · π high falsecertaintysix weightsone lineage forged reliability“trust me” metadata interruptionprovenance clusterscovariance estimateoutcome calibration
Failure and adversarial path High precision is not self-authenticating. Dependence, provenance and manipulation must be assessed outside the scalar variance head or represented in a richer covariance model.

Other boundaries that should stop deployment

First, many attention values are not noisy estimates of one common latent quantity. They may carry complementary features that should be composed, not averaged. The inverse-variance derivation then becomes an analogy rather than a justification. The architecture can still be tested empirically, but the word precision needs a task-specific target.

Second, a biased source can be repeatable. Its variance is low while its mean is wrong. Precision weighting can make the bias more influential. The experiment therefore needs bias shifts as well as zero-mean noise. Third, a precision head trained on the same distribution may be overconfident under shift. Epistemic uncertainty, out-of-distribution detection and abstention remain separate controls.

Fourth, source reliability can be adversarially presented. In a RAG system, a document can claim authority or mimic a trusted format. Reliability evidence should come from verified provenance and operating history, not untrusted content alone. Fifth, correlation can invalidate diagonal variance propagation. Recent filtering architectures make different conditional-independence, linearity or covariance approximations; their reported gains do not dissolve those assumptions.[11][12][13]

Boundary condition

Do not use precision-factorised attention where you cannot define admissible repetitions, estimate residual variation, or control dependence. In those settings, call the second channel a gate or bias, evaluate it as architecture search, and avoid probabilistic language that the evidence cannot support.

The evidence conversation
Chart · sequence
sequenceDiagram
  participant Q as Question
  participant M as Mechanism
  participant E as Evidence
  participant D as Decision
  Q->>M: The silted gauge
  M->>E: Figure 1. A precision field bends equally relevant currents differently
  E-->>M: compare rival explanations
  E->>D: Keep precision only if reliability can be intervened on
  D-->>Q: revise scope or act
Question, mechanism, evidence and decision exchange the burdens developed in Precision-weighted attention as a testable architecture. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

Keep precision only if reliability can be intervened on

When an attention system fails on noisy context, the default response is often to tune temperature, add sparsity, enlarge the model or let the relevance scorer absorb another feature. This paper changes the order of operations.

Decision rule

Add an explicit precision channel only when reliability can be defined before the answer, calibrated against repeatable error, and manipulated independently of relevance. Require the uniform-noise null, the precision swap, a matched-capacity bias baseline and a dependence check before keeping the word precision.

The smallest implementation is one bounded log-variance scalar per source, added to ordinary attention logits, plus the six contract tests. Start on a synthetic or instrumented task where corruption is known. If the mechanism passes, move to a configured system with verified provenance. If it fails, the right decision is not to defend the Bayesian vocabulary. Improve relevance, data quality or ordinary gating instead.

This is a modest conclusion, but it is operational. The architecture is valuable not because it can express another weight, but because it creates a causal question the system can answer wrongly. That possibility of a clean negative result is what turns a metaphor about confidence into an engineering hypothesis.

Glossary

Relevance
The relation between a query and the content advertised by a key. It says whether a source bears on the current update.
Precision
Inverse conditional variance under a declared observation model. It says how variable a value contribution is expected to be across admissible repetitions.
Calibration
Agreement between predicted uncertainty and observed error frequency or interval coverage on held-out conditions.
Heteroscedasticity
Noise whose variance changes across inputs or sources.
Intervention fidelity
Whether a mechanism responds in the predicted direction when its declared cause is changed and relevant alternatives are held fixed.
Rival generator
A different mechanism, such as extra capacity or an unconstrained bias head, that could produce the same performance gain.

References

  1. Vaswani, A. et al. (2017). Attention Is All You Need. NeurIPS.
  2. Henry, A., Dachapally, P. R., Pawar, S. & Chen, Y. (2020). Query-Key Normalization for Transformers. arXiv.
  3. Martins, A. F. T. & Astudillo, R. F. (2016). From Softmax to Sparsemax. ICML.
  4. Peters, B., Niculae, V. & Martins, A. F. T. (2019). Sparse Sequence-to-Sequence Models. ACL.
  5. Heo, J. et al. (2018). Uncertainty-Aware Attention for Reliable Interpretation and Prediction. NeurIPS.
  6. Kendall, A. & Gal, Y. (2017). What Uncertainties Do We Need in Bayesian Deep Learning for Computer Vision? NeurIPS.
  7. Guo, C., Pleiss, G., Sun, Y. & Weinberger, K. Q. (2017). On Calibration of Modern Neural Networks. ICML.
  8. Jain, S. & Wallace, B. C. (2019). Attention is not Explanation. NAACL.
  9. Wiegreffe, S. & Pinter, Y. (2019). Attention is not not Explanation. EMNLP-IJCNLP.
  10. Seitzer, M., Tavakoli, A., Antic, D. & Martius, G. (2022). On the Pitfalls of Heteroscedastic Uncertainty Estimation with Probabilistic Neural Networks. ICLR.
  11. Long, B. et al. (2026). Precision Tracked Transformer via Kalman Filtering, Kriging and Process Noise. arXiv preprint.
  12. Racioppo, P. (2026). Robust Filter Attention: Self-Attention as Precision-Weighted State Estimation. arXiv preprint.
  13. Shaj, V. et al. (2026). Kalman Linear Attention: Parallel Bayesian Filtering for Efficient Language Modelling and State Tracking. arXiv preprint.
  14. Nielsen, S. K., Abdullaev, L. U., Teo, R. S. Y. & Nguyen, T. M. (2024). Elliptical Attention. NeurIPS.