Manuscript Offprint
arXiv:2610.34682Beyond Deduplication: Sharp Retrieval Limits for Attention with Correlated Distractors
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
HEEHYUN PARK
ABSTRACT. Redundant context affects attention through two distinct mechanisms: repeated items add normalization mass, while score variation within correlated groups can produce extreme individual scores. We separate these effects in a planted retrieval model with exponentially many Gaussian distractors arranged in known, exponentially large clusters. The model is a two-level generalized random energy model, whose classical free energy yields exact retrieval thresholds. Gaussian interpolation further shows that increasing positive correlation at fixed token count lowers the distractor free energy, unlike adding duplicates. Our main result identifies a sharp limitation of subtracting log cluster size from pre-softmax scores: this correction removes multiplicity but retains within-cluster extremes. Even a temperature chosen after observing all scores cannot lower the required signal below , where is the exponential rate of the number of clusters. Averaging scores before exponentiation instead suppresses these fluctuations and achieves , where is the within-cluster correlation. The gap persists after adding exponentially many singleton distractors, so group size alone does not identify the target, and extends to fixed finite hierarchies of light-tailed independent-increment scores. Finite-sample, stability, and participation results complement the asymptotic analysis. A controlled retrieval experiment with frozen sentence embeddings supports this distinction while delineating its scope: averaging helps when the relevant item is a singleton, but can discard useful evidence when a relevant group contains multiple matching items.
1. INTRODUCTION
Repeated passages, related keys, and duplicated records can change attention even when the quality of an individual query-key score stays fixed. Two interventions are easily conflated: correlating a fixed collection of scores, and adding more copies of existing scores. Their effects need not have the same sign. A theory that attributes every redundancy failure to positive correlation risks recommending the wrong intervention.
We analyze one softmax retrieval step with a planted relevant item and a hierarchical Gaussian distractor ensemble. Our objective is to characterize the signal strength needed for its attention mass to approach one. We treat the hierarchy as a supplied partition, as could arise from document or record identifiers. Inferring semantic groups from learned keys is a separate problem. We also include exponentially many singleton distractors so that group sizes alone need not identify the target. The model permits exact comparisons of ordinary attention, subtraction of log cluster size, and averaging scores before exponentiation.
Our main result identifies what count correction leaves behind: dividing a cluster's weight by its size does not suppress its largest individual scores. Count correction therefore has a sharp signal threshold that cannot be lowered even by choosing the temperature after observing all scores (Theorem 4.1). Averaging the scores first achieves a strictly smaller threshold (Theorem 5.1). The hidden-singleton result removes identification from group size alone, and the deeper and non-Gaussian results extend this same comparison. Finite-sample and stability bounds describe its scope. The free energy and concentration transitions themselves come from classical random energy model (REM) and generalized random energy model (GREM) calculations [4, 8, 9]; we provide self-contained proofs. Finally, a frozen-encoder experiment tests the two operations on natural sentences, including cases where averaging relevant scores hurts retrieval.
HEEHYUN PARK
Relation to prior work. The Gibbs interpretation of attention and its connection to associative memory are established [18]. REM methods already yield precise softmax and initialization analyses [10, 13]. Long-context scaling depends on the score geometry [6], and gap-counting unifies several concentration scales [14]. Training-driven transitions [16], correlated Hopfield equilibria [20], and clustered self-attention dynamics [12] concern different observables or dynamics. Our observable is the mass of an externally planted item after a single retrieval step. This distinction does not make the underlying GREM calculation new.
Likewise, correcting sampling density is an established idea, including in PointConv [22]. ToMe explicitly accounts for multiplicity through a +log m adjustment after merging [2]; Double-P uses size-weighted centroids to approximate token attention [17]. We study a different objective: equal prior mass for supplied groups. LUCID addresses correlated-key interference through preconditioning [11]. We do not introduce a general density correction or token-merging architecture. Our focus is their sharp retrieval limits in an explicit probabilistic model.
(2.1)
Thus is the exponential growth rate of the number of distinct clusters, is the exponential growth rate of the multiplicity within each cluster, and the total number of distractors is .
To represent similarity inside a cluster, assign to each cluster a shared Gaussian factor and to each token a token-specific Gaussian factor . All of these variables are mutually independent random variables, and the distractor score is
(2.2)
where . The term shifts every score in cluster together, whereas distinguishes individual tokens within that cluster. Hence each is marginally , two different tokens in the same cluster have covariance (and correlation ), and tokens in different clusters are independent. The endpoints give useful intuition: would make all distractor scores independent, while would make the tokens within a cluster exact score duplicates. Equation (2.2) is therefore a two-level Gaussian random-energy model for repeated or near-duplicate distractors.
Alongside these distractors, let denote the score of the single relevant, or planted, item. At inverse temperature , ordinary softmax attention assigns that item the mass
(2.3)
Here is the total unnormalized attention weight of the distractors and is its log weight per dimension. The exact normalized log-odds against the planted item are
(2.4)
Thus a negative limiting right-hand side gives retrieval, while a positive limit gives failure. We assume only : the constant is the planted item's asymptotic score advantage on the order-d scale. We do not require to be independent of the distractors. Retrieval means , and all probability statements refer to the score ensemble.
The score model can be realized as a query-key dot product . Here is a deterministic query vector with , and is the key of token in cluster . Let be the random vector shared by cluster , and let be the token-specific random vector; all vectors and are mutually independent. Setting gives the score distribution in (2.2). A planted key can be chosen so that . Under conventional scaled dot-product attention, the pre-softmax score is for a dimension-dependent sharpening factor , so our equals . Thus fixed corresponds to , and cannot be identified with fixed conventional scaling. A learned query depending on these keys need not satisfy the assumed law.
Define the one-level free energy for variance ,
(2.5)
We use inverse temperature: larger means sharper attention.
3. EXACT THRESHOLDS AND THE SIGN OF CORRELATION
Theorem 3.1 (Classical two-level free energy, specialized). For fixed , define
(3.1)
Then the normalized distractor log-partition function converges to in probability and in . Equivalently, with and ,
(3.2)
Consequently, if , and if .
In (3.2), is the order- deviation of the cluster-level parent shared by all tokens in a cluster, while is the token-specific child deviation. The first constraint requires that such a rare parent exist among the clusters; the second is the total entropy constraint requiring that a parent-child path with deviations exist among all tokens. Replacing the second constraint with for every parameter choice gives an incorrect answer in the merged regime.
To describe the freezing transitions, define
(3.3)
If , the parent constraint imposes no additional restriction on the optimizer and the free energy matches that of an i.i.d. REM with the same marginal variance, although the scores remain correlated. If , equivalently , parent and child freezing occur separately, and the three branches of are
(3.4)
The surface is deliberately excluded from the retrieval dichotomy. The first-order limit alone does not determine its behavior.
HEEHYUN PARK
Theorem 3.2 (Correlation comparison). At any finite , with fixed clusters and tokens per cluster, and for , define the distractor-only token weights and cluster weights . Then
(3.5)
In particular . For a common limiting signal , i.i.d. success implies success for every .
The finite-d derivative compares models with the same number of tokens and the same marginal distribution for every score; only the correlation between tokens in the same cluster changes. It says that the expected log distractor weight decreases as increases. It does not say that decreases for every realized score array, and an ordering of the mean alone does not order finite-sample retrieval probabilities. The asymptotic threshold comparison additionally uses concentration and convergence to the deterministic free energy . Adding a literal duplicate is a different operation: it adds another positive term to and therefore increases the softmax denominator.
What actually condenses? Let and . These are conditional probabilities that two independent draws from the same distractor attention distribution choose the same cluster or token. Their expectations have the following limits (proof in Section 10):
(3.6)
Here . In the intermediate phase , cluster participation is nonvanishing but maximum token mass tends to zero. Neither maximum cluster mass nor maximum token mass tends to one at any fixed finite : their respective participation expectations remain strictly below one. These are distractor phases, distinct from the external planted-item transition.
4. COUNT CORRECTION HAS A FINITE OPTIMAL TEMPERATURE
Ordinary softmax assigns one unnormalized weight to every token, so a cluster can receive more total mass simply because it contains more tokens. Count correction removes this multiplicity advantage using the supplied partition: a token with score X in a group of size m receives corrected weight , equivalently subtracting from its pre-softmax score .
We first consider the balanced model in which every distractor cluster has size and the planted item forms a singleton group. Each distractor weight is therefore divided by , while the planted weight is unchanged. Define the count-corrected planted mass and its fixed-temperature signal threshold by
(4.1)
Applying the log-odds identity (2.4) with the corrected distractor denominator gives
(4.2)
Thus count-corrected retrieval succeeds when and fails when . By Theorem 3.1, the ordinary-attention threshold is ; since , count correction lowers it by exactly .
The correction does not change relative weights within or between the equally sized distractor clusters. If every group, including the relevant group, had the same size, the same additive shift would be applied to every pre-softmax score and the softmax weights would not change. In the present basic model the planted item is the unique singleton, so group size alone reveals its location; Corollary 5.2 removes this shortcut by adding exponentially many singleton distractors.
Theorem 4.1 (Optimal correction and adaptive-temperature lower bound). For and , the fixed-temperature retrieval threshold is minimized uniquely at :
(4.3)
Thus, no fixed retrieves when , whereas the fixed choice retrieves when . Moreover, even if is selected after observing the realized distractor scores,
(4.4)
If , then , even when is chosen after observing all scores. If , the fixed choice in (4.3) gives .
Proof idea; complete proof in Section 11. Before the first freezing point, , whose derivative changes from negative to positive at . This value occurs before the first freezing point in both regimes of (3.1), and direct differentiation shows that every later formula for is increasing. For the data-dependent choice of , convergence is uniform when stays in a fixed bounded interval. Jensen's inequality rules out , while the maximum distractor score rules out ; hence a minimizing sequence cannot escape to either endpoint.
Increasing makes the softmax place more weight on the largest scores. For count-corrected weights , the required signal decreases until and then increases; choosing a larger therefore requires a stronger planted signal rather than improving retrieval. With independent distractor scores, the smallest permitting retrieval after optimizing is also , although the required at a particular fixed generally differs between the two models.
If one could instead use only the noise-free cluster components , the smallest required signal would be . Count correction does not attain this smaller value because it divides out cluster size but retains the token-specific noise ; the averaging method below suppresses that noise.
Proposition 4.2 (Upper bound on finite-sample failure probability). If = sd deterministically, then for any ,
(4.5)
For , the exponent is minimized at , giving . The bound needs only marginal distractor scores and does not assume their independence.
Let . The upper bound in (4.5) decreases exponentially with d when
(4.6)
This is possible exactly when , and then (4.6) is equivalent to
(4.7)
Thus this upper bound is useful only when is neither too small nor too large. A small leaves substantial total mass on the many distractors, while a large amplifies rare high distractor scores in the moment bound. The proposition gives no failure claim outside this interval; only this particular upper bound ceases to guarantee success there.
HEEHYUN PARK
5. AVERAGING REMOVES TOKEN-SPECIFIC SCORE NOISE
Count correction replaces each cluster’s total weight by the average of its exponentiated token scores, . This removes the factor caused by cluster size, but a single unusually large token-specific component can still dominate the average. Averaging scores first performs a different operation: for each cluster , compute
(5.1)
and then assign one attention weight to that cluster. The planted item remains a singleton with score . Define
(5.2)
Here is the total distractor weight after replacing every cluster by its mean score, is the resulting planted-item mass, and will be the required planted signal at fixed .
Under the Gaussian score model in (2.2), averaging gives
(5.3)
The second term is Gaussian with variance , so it becomes negligible on the order-d scale because grows exponentially. Thus the averaged cluster scores asymptotically behave like the independent shared components . This is the Gaussian model used for the asymptotic formulas in the theorem below; the finite-score comparison in its first sentence does not require Gaussian scores.
Theorem 5.1 (Count correction versus averaging). For every fixed collection of token scores, and . Under the Gaussian score model in (2.2),
(5.4)
Thus averaging retrieves when and fails when . Optimizing over gives
(5.5)
Consequently, if , averaging retrieves with any fixed , while count correction fails even if its is selected after observing all distractor scores.
The first two inequalities follow from Jensen's inequality. They mean that, for the same fixed token scores, averaging before exponentiation gives a distractor denominator no larger than count correction and therefore gives the planted item at least as much attention mass.
The asymptotic improvement is stronger: averaging suppresses the token-specific noise that count correction leaves inside . The interval of signals where averaging succeeds and count correction fails has width . This result assumes that the groups are supplied correctly and that the planted item is a singleton; it does not claim that arbitrary clustering or merging improves attention.
Hidden-singleton variant. In the basic model, the planted item is the only singleton group, so its group size reveals its identity before any scores are examined. To remove this shortcut, add independent distractor scores, each in its own singleton group, where . Place the planted item uniformly at random among these singleton groups and hide its location. Define the two critical signal levels
(5.6)
Corollary 5.2 (Hidden-singleton separation). In this augmented model, count correction fails for every data-dependent choice of when , while the fixed choice retrieves when . Averaging retrieves whenever using any fixed . Hence every is retrieved by averaging and missed by count correction for every choice of . If , then and the original separation interval is unchanged. A method that observes only the partition, and not the scores, identifies the target with probability at most .
Proof idea; complete proof in Section 12. The augmented distractor denominator is the sum of the original clustered contribution and the new singleton contribution. After taking , this sum has the larger of their two limiting values. Adding distractors can only decrease the planted mass, so the adaptive-temperature failure result for count correction remains valid. For averaging, the clustered representatives require signal and the singleton distractors require signal ; their maximum is . The partition-only bound follows because the hidden target is uniform among the singleton groups.
The hidden-singleton construction removes identification from group size alone, but it still assumes that the target is a singleton rather than a member of a mixed relevant–irrelevant group.
6. PRACTICAL MEANING AND SCOPE
The theory assumes that the groups are supplied; it does not infer them from the keys. Subject to that assumption, the conclusions are stable to small errors, but the two corrections have different computational and semantic consequences.
Imperfect group statistics. Only relative count errors matter for count correction. If positive estimates satisfy
(6.1)
then using the estimated counts changes , the log ratio of total distractor mass to planted mass, by at most . In other words, if is this log ratio under the true counts and is the same quantity under the estimated counts, then . Likewise, if every averaged score has error at most , the corresponding log ratio changes by at most . Thus errors smaller than order do not change the fixed- conclusions away from the success–failure boundary. These bounds assume the groups are already available; they do not justify any particular clustering procedure.
Cost and interpretation. Count correction still scores all tokens, so its per-query cost remains . Averaging can instead precompute centroids in time and then score only those centroids in time per query. If all values have norm at most , target mass guarantees output error at most . This makes successful mass retrieval sufficient for value recovery, but not necessary. It also explains an important limitation: averaging may erase the target when a supplied group mixes relevant and irrelevant items.
7. HOW BROADLY DOES THE RESULT APPLY?
The key result is a gap between the smallest planted signals required by the two methods: averaging succeeds above , whereas count correction requires , as shown in (5.5).
HEEHYUN PARK
A fixed finite score array. Before taking , consider one realized collection of distinct distractor scores as fixed numbers. Their softmax weights at temperature are , and their entropy measures how broadly the distractor attention is spread. Proposition 15.1 shows that the best count-correction temperature is exactly the point where , or equivalently where the effective number of attended distractors is . This optimization identity is known as entropic value-at-risk (EVaR); it is an existing result used here as an oracle benchmark, not a new contribution.
Deeper and non-Gaussian hierarchies. The two-level model has clusters and tokens, but the same comparison holds for any fixed number of Gaussian levels, such as source, document, passage, and token (Theorem 16.1). Gaussianity can also be relaxed when each level contributes independent light-tailed increments. For an increment , the cumulant generating function is ; it records the exponential-tail behavior that determines the retrieval threshold. For a Gaussian increment it is simply a quadratic function of , recovering the square-root formulas above. Theorem 17.1 proves the analogous count-versus-averaging gap for this non-Gaussian class. Full assumptions and proofs are in Sections 15–17; the results do not cover arbitrary learned score distributions or unknown groups.
8. EXPERIMENTS AND LIMITATIONS
The Gaussian simulations check the formulas within the stated model: finite-array temperature optimization approaches the predicted threshold, and cluster and token participation approach their respective limits. Separate constrained optimizations reproduce the free energy across 120 parameter settings and check the finite-array, deeper-hierarchy, and non-Gaussian extensions. Figure 1 and the full protocols are in Section 14. We next test the two operations on learned sentence scores. Frozen sentence retrieval. We use BANKING77, a collection of banking questions with 77 intent labels [5], and the frozen all-MiniLM-L6-v2 sentence encoder [21]. Training sentences supply the keys; disjoint subsets of the official test split supply 308 validation and 924 evaluation queries. Scores are cosine similarities. Each context contains all 77 intents, initially with one relevant key and 38 singleton distractors. The other 38 intents contribute four or eight same-intent keys, or eight exact copies. Labels supply the groups; same-intent sentences need not be paraphrases. Three seeded context draws are shared by all methods. These are controlled contexts, not the standard intent-classification benchmark.
Ordinary attention and count correction weight individual keys. Averaging uses one mean score and one mean value per group, without renormalizing the mean key. Each value indicates its key's intent, so the relevant coordinate of the output is the total relevant value mass, equal to when the target is a singleton. Each method independently selects a cosine-score multiplier from 81 values in [0.25, 1024] by minimizing validation negative log relevant value mass. Evaluation queries are not used for this choice. Full settings, uncertainty estimates, and additional metrics are in Appendix A. Multiplicity and score variation. Exact copies make count correction and averaging identical, as expected. With eight distinct keys per distractor group, their mean relevant masses are instead 0.342 and 0.440 after separate temperature selection (Table 1); the paired gain is 0.098 with 95% interval [0.088, 0.108]. Selecting one random representative per group gives 0.375, so retaining only one key does not explain the full gain. However, a label-aware oracle that chooses the best count-correction temperature separately for each evaluation query attains 0.511. Thus the learned-score experiment supports the distinction between the operations, but does not establish the theorem's all-temperature separation for these sentence scores.
When averaging loses relevant evidence. Giving the relevant intent four distinct keys reverses the comparison: count correction achieves 0.626 relevant mass and averaging 0.465. Variation within a relevant group can contain useful matches to the query. Moving three distractor keys into the singleton's group is more damaging: averaging reduces relevant mass to 0.005, versus 0.243 for count
TABLE 1. Mean relevant value mass on 924 evaluation queries. Each method uses its own validation-selected temperature. The last column gives the paired averaging-minus-count difference with a 95% intent-block bootstrap interval. Groups are supplied using dataset labels.
| Context | Ordinary | Count | Average | Difference [95% interval] |
|---|---|---|---|---|
| One key per intent | 0.379 | 0.379 | 0.379 | +0.000 [+0.000, +0.000] |
| Exact copies (8) | 0.288 | 0.379 | 0.379 | +0.000 [+0.000, +0.000] |
| Same intent (4) | 0.267 | 0.345 | 0.406 | +0.062 [+0.056, +0.067] |
| Same intent (8) | 0.234 | 0.342 | 0.440 | +0.098 [+0.088, +0.108] |
| Four relevant keys | 0.614 | 0.626 | 0.465 | -0.161 [-0.181, -0.142] |
| Mixed relevant group | 0.234 | 0.243 | 0.005 | -0.238 [-0.269, -0.208] |
correction. Here averaging also dilutes the relevant value to one quarter of the group's value. These cases are outside the singleton-target guarantee and show why group membership alone does not justify averaging.
What remains outside the theory. The model assumes exponentially many distractors, supplied groups, and a singleton target. Its exact phase diagram assumes Gaussian scores, while the non-Gaussian result still requires independent increments and strong tail conditions. The temperature scaling also differs from conventional fixed scaled-dot-product attention. Our sentence experiment uses bounded cosine scores and label-supplied groups; it does not validate these asymptotic assumptions or a grouping algorithm. Appendix B reports a causal intervention on pre-softmax self-attention logits in a frozen DistilBERT model. It confirms that averaging suppresses within-group score extremes in actual attention, but its downstream effects are small, metric-dependent, and position-sensitive in a task on which the model performs near chance; it therefore does not support a general performance advantage.
Count correction removes multiplicity while retaining variation within a group. Averaging removes that variation as well. The theory shows why this yields a strict retrieval advantage against grouped distractors; the experiment shows why the same operation can remove useful evidence from a relevant group.
9. FREE ENERGY AND GAUSSIAN COMPARISON: COMPLETE PROOFS
All limits below hold with the ceiling definitions in (2.1). More generally, only and are needed.
9.1. Counting states subject to prefix constraints.
Lemma 9.1 (Two-level counting principle). Let and be mutually independent, where . For , the limiting free energy is
(9.1)
Convergence holds in probability and in .
Proof. Write and . For a fixed interval of positive length,
(9.2)
This follows directly by integrating the density ; using interior subintervals establishes the lower bound. The identical statement holds for .
HEEHYUN PARK
Upper bound. Choose large enough that and . A union bound makes the probability that any or leaves tend to zero exponentially. Partition this compact interval into finitely many bins of width at most . For a pair of bins , put , , and let be the number of parents in , and the number of pairs in . By (9.2),
(9.3)
Fix . Markov's inequality, followed by a union bound over the finite bins, shows with probability tending to one that bins with or are empty, and all other bins satisfy
(9.4)
The number of bins contributes to . Bound the exponential weight of every state in by and sum these bounds. First let , then let . Compactness and continuity show that the resulting upper bound is the maximum in (9.1). On the limiting feasible set the entropy term is nonnegative, so the positive-part operation disappears. Relaxed feasible sets converge to the stated feasible set by compactness.
Lower bound. Fix satisfying both constraints strictly. Choose small intervals around these coordinates. Their costs satisfy and . The parent count is binomial with exponentially growing mean, so its relative error tends to zero; in particular . Conditional on all parent variables, the child indicators for are independent Bernoulli variables. Their conditional total mean has exponential rate . A binomial Chernoff bound therefore gives
(9.5)
Independence of child trials holds even when several share the same selected parent, since the selection used only the . No condition is required. Multiplying this count by the least weight in the bin and shrinking the intervals gives the variational lower bound at . Every feasible boundary point is approached by strictly feasible points via , , because both entropy budgets are positive. Continuity proves the lower bound for the maximum.
convergence. The elementary inequalities
(9.6)
and the union bound show uniform boundedness of the second moments of the right-hand side. Hence is uniformly integrable, and its convergence in probability to a constant implies convergence.
9.2. Evaluation of the variational formula
Proof of Theorem 3.1. Apply Lemma 9.1 with . It remains to solve its strictly concave optimization problem. Symmetry permits .
If , ignore the prefix constraint temporarily. On the total-cost disk, the maximizer is
(9.7)
Its prefix cost is , so it also solves the constrained problem. Substitution gives .
If , then . For , is feasible and unconstrained optimal. For , take
(9.8)
The prefix constraint is active and the total constraint is feasible because . With multipliers for the prefix cost and for the total cost, the stationarity equations are satisfied. For , choose
(9.9)
Both constraints are active. Multipliers and are nonnegative and satisfy stationarity. These are sufficient conditions because the objective is concave and the feasible set is convex. Substitution gives (3.4), with the formulas agreeing at all boundaries.
Finally, write . Then and . A strictly negative or positive limiting exponent proves the two retrieval conclusions without any independence requirement on .
9.3. Finite-size concentration and retrieval margins
Proposition 9.2 (Gaussian concentration). For every u > 0,
(9.10)
Let and . Except on an event of probability at most ,
(9.11)
Thus a positive margin implies on this event.
Proof. As a function of the independent standard Gaussian array ,
(9.12)
Consequently is -Lipschitz. The standard Gaussian Lipschitz concentration inequality [3] gives (9.10). Intersect this concentration event with and use the exact log-odds identity to get (9.11). No explicit rate is asserted for the deterministic bias ; this statement must not be read as a rate to the limiting threshold without that bias term.
9.4. Gaussian interpolation
Lemma 9.3 (Covariance differentiation). For a differentiable positive-definite covariance path and a centered Gaussian vector , the log-sum-exp satisfies
(9.13)
Proof. The Gaussian density has Fourier transform . Differentiating shows that its time derivative is of the density. Integrate twice by parts. The derivatives of log-sum-exp through order two are bounded and its value grows at most linearly, so Gaussian tails justify differentiation and remove boundary terms. Singular endpoints follow by continuity; the identity itself is only needed in the interior.
Proof of Theorem 3.2. At fixed , , for distinct tokens in the same cluster, and all other entries are zero. Since
(9.14)
HEEHYUN PARK
Lemma 9.3 gives
(9.15)
Integrate this nonpositive derivative. Continuity in extends the comparison to zero and one. Then pass to the limit using convergence (the endpoints also follow directly from one-level REMs). The claimed retrieval implication follows from Theorem 3.1.
10. PARTICIPATION WITHOUT AN INCORRECT WINNER-TAKE-ALL CLAIM
Proposition 10.1 (Expected participation). Equation (3.6) holds for every fixed and . A strictly positive limiting participation expectation does not assert a deterministic limiting participation value.
Proof. Temporarily replace by independent positive variances . Covariance differentiation gives the exact identities
(10.1)
For the first identity the differentiated covariance is d for all pairs in the same cluster, including equal indices; for the second it is d only on the diagonal.
We justify passing derivatives to the limit rather than exchanging them without an argument. Parameterize with . For each realized standard Gaussian array, the function
is convex, hence so is its expectation. Lemma 9.1 gives pointwise convergence at every positive . If a sequence of differentiable convex functions converges pointwise on an open interval to a function differentiable at , then its derivatives at converge: bound each derivative between the two secant slopes at , pass to the limit, and then send . Apply this separately in each amplitude coordinate and use .
For completeness the general-variance limiting free energy is
(10.2)
This follows from the same maximization as before. It is differentiable in both positive variances, including the boundaries: the unfrozen derivative is , and the frozen derivative of is . They agree at . At the hierarchy-merging boundary , the derivatives of the two displayed expressions also agree. Using these derivatives in (10.1) at , proves (3.6).
For a probability vector , . Thus vanishing expected token participation implies by Markov's inequality. If the maximum mass tended to one in probability, its participation would tend to one in probability and, being bounded, in expectation. Formula (3.6) rules that out for both tokens and clusters at finite . The positive cluster-participation limit in the intermediate regime implies a nonvanishing probability of a macroscopic cluster weight, not that one cluster absorbs all mass with probability tending to one. The richer random cascade description is classical [4] and is not needed for these statements.
11. COUNT CORRECTION AND OPTIMAL TEMPERATURE: COMPLETE PROOFS
The count-corrected log odds are exactly
(11.1)
Their normalized limit is , giving the fixed-temperature threshold in (4.1).
11.1. The unique limiting optimum
Lemma 11.1 (Shape of the corrected threshold). For , is strictly decreasing on and strictly increasing on .
Proof. In the merged regime, before ,
(11.2)
After , has positive derivative. Since , the unique optimum lies in the first branch.
In the split regime, the first branch ends at and has the identical expression. In the middle branch,
(11.3)
which is strictly increasing. In the last branch,
(11.4)
which is again strictly increasing. Continuity at the joins completes the claim. Evaluating the first branch at gives (4.3).
11.2. Uniform control over all temperatures
Lemma 11.2 (Maximum scores and compact uniform convergence). Let and . Then , , where
(11.5)
For each , .
Proof. The variance of is , so the first assertion follows. For any fixed ,
(11.6)
The limits of the two bounding expressions tend to the common value as the fixed number . This is a two-step squeeze: for any error tolerance choose a sufficiently large fixed first, then take . It proves without assuming a joint limit theorem.
The random Lipschitz constant of as a function of is at most , which is bounded in probability by the Gaussian union bound in Lemma 9.1. The deterministic function is uniformly continuous on . On an event where the random Lipschitz constant is bounded, use a finite fine grid, pointwise convergence at its points, and continuity between them. First refine the grid and then increase the Lipschitz bound. This gives the stated compact uniform convergence.
HEEHYUN PARK
Proof of Theorem 4.1. Lemma 11.1 proves the deterministic optimum. Let and
(11.7)
The upper bound for the infimum follows by evaluating at . For the lower bound we must exclude temperatures tending to zero or infinity. Jensen's inequality and the largest-term bound give, simultaneously for every ,
(11.8)
The limiting in (11.5) is strictly greater than . In the merged case this follows from ; in the split case it also follows from strict increase of after its minimum and .
Choose a small fixed with , and a large fixed with . By Lemma 11.2, (11.8) bounds above uniformly on and with probability tending to one, for any . On , compact uniform convergence gives with probability tending to one. Together with the upper bound, this proves (4.4).
To establish failure uniformly over temperatures when , fix . With probability tending to one, for every and . For , (11.1) is at least . For small temperatures use Jensen's inequality directly in the log odds, rather than divide by :
(11.9)
Choose additionally satisfying . On the events , , and , this last bound is at least for all . The minimum log odds over all temperatures therefore diverges to in probability. This proves . Above the floor, the fixed-temperature threshold at proves success.
Proof of Proposition 4.2. The event is equivalent to . Marginal Gaussian moment generating functions give
(11.10)
irrespective of dependence. Markov’s inequality proves (4.5). Completing the square gives the minimizing positive temperature when . This minimizes the upper bound for a given , whereas minimizes the asymptotic signal threshold; these are different optimization problems.
12. AVERAGING, ESTIMATION ERROR, AND VALUE RECOVERY
Proof of Theorem 5.1. For every cluster, Jensen's inequality gives . Summing proves the samplewise denominator and attention comparisons.
To identify the limiting free energy, write
(12.1)
The are independent of the parent array and independent across clusters. For every ,
(12.2)
Since log-sum-exp is Lipschitz in the sup norm,
(12.3)
The one-level version of the bin-counting proof in Lemma 9.1 gives free energy for the remaining sum. Its ratio to decreases to at and equals that constant thereafter. Equations (5.5) and the separation interval follow from Theorem 4.1 and the log-odds retrieval argument.
Proof of Corollary 5.2. Let be the partition function of the singleton distractors. Its normalized logarithm tends to . For positive , . Thus the augmented fixed-temperature thresholds are
(12.4)
At , the singleton REM is frozen since , so . Therefore the first threshold has minimum at the same unique temperature, because it is bounded below by and equals there. The empirical infimum has lower bound the original empirical infimum and upper bound its augmented value at , both tending to . Adding singleton distractors decreases planted mass for every realized array and temperature, so the original adaptive-temperature failure bound still applies uniformly. Fixed temperature retrieves above the floor.
Each component of decreases to its respective floor and reaches that floor at a finite temperature. Both have reached their floors at any fixed , proving (5.6) and the strict separation. Finally, conditional on the partition alone, the random target location is uniform over the singleton groups. Any possibly randomized guess based only on the partition therefore has success probability at most . This is an identification statement about partition information, not a lower bound on arbitrary score-based retrieval algorithms.
Proposition 12.1 (Deterministic relative-log-error bound). For any scores and positive group counts , define exact count-corrected weights proportional to . Let and be the log odds against the planted item using and , respectively. Under (6.1), . For averaging, if every representative score (including the singleton) has error at most , the corresponding log odds change by at most .
Proof. Put . The estimated odds sum is
(12.5)
Each positive summand is within a factor of its exact value, as is their sum. Taking logarithms proves the claim. In the averaging case, errors in each score difference lie in ; the same argument applies. Dividing by proves stability of strict fixed-temperature limiting margins when the bounds are . The adaptive-temperature theorem is not asserted under arbitrary error sequences on the strength of this fixed-temperature argument.
Proposition 12.2 (Value error). For weights , , and values with ,
(12.6)
The same conclusion holds after averaging values within supplied groups if the target is a singleton. Hence successful attention-mass retrieval implies vanishing bounded-value error in probability and in mean square.
Proof. Subtract , cancel the target term, and apply the triangle inequality and . Group-averaged values also lie in the radius-R ball. Squaring and bounded convergence (or uniform integrability plus convergence in probability) proves the mean-square assertion.
HEEHYUN PARK
13. EXTENSIONS AND BOUNDARY CASES
13.1. Partial correction and a second optimization boundary. Let and subtract . The retrieval threshold is .
Proposition 13.1 (Optimal partial correction). Set and assume . If , then
(13.1)
If , then
(13.2)
The formulas agree at equality. The minimizer is unique for .
Proof. In the merged regime the first branch is , whose optimum lies strictly before . The last branch is , strictly increasing. Also implies . In the split regime, the first branch has the same expression. Its optimum lies at or before precisely when . The middle branch is
(13.3)
Under the reverse strict inequality its optimum in (13.2) lies strictly between and . Otherwise its derivative is nonnegative from onward. The last branch is strictly increasing. The derivative signs and continuity prove the formulas and uniqueness. The case always satisfies (13.1).
13.2. Unequal multiplicities and a relevant group
Proposition 13.2 (Finitely many distractor types). Let there be a fixed number of distractor types. Type has rates , correlation , and scores , where follows (2.2) with those parameters and . Apply exponent- count correction to every cluster. Suppose the relevant group consists of exact copies, with , each score . Its total attention mass satisfies
(13.4)
A strictly negative limit implies success and a strictly positive limit implies failure. Cross-type independence is unnecessary if each type has the stated marginal model.
Proof. Each corrected type partition has the asserted exponent by Theorem 3.1. The logarithm of a sum of positive numbers differs from their maximum log by at most . A union bound gives simultaneous component convergence. The relevant numerator is . Subtract its logarithm and use the logistic identity.
Full correction removes the relevant group’s multiplicity advantage as well as distractor multiplicities. Individual relevant-token mass is , so semantic-group retrieval and retrieval of one specific token are different objectives.
13.3. Exact and approximate replication
Proposition 13.3 (Uniqueness within scalar count rules). Suppose a group of m identical scores x contributes , with depending only on integer size. Invariance of this contribution under every integer replication factor is equivalent to . For arbitrary scores, replicating the whole list leaves unchanged. Replicating selected nonidentical members need not preserve it.
Proof. Replicate a singleton m times to get ; the converse is immediate. Replication of a whole list multiplies its exponential sum and its size by the same factor. Selective replication changes the empirical distribution of scores.
If for all group members, Jensen's inequality and the termwise upper bound give
(13.5)
Thus uniformly score spread makes count correction and averaging equivalent at the exponential scale. With fixed and exponentially many children, that uniform spread need not be .
13.4. No universal effective context length
Corollary 13.4. If , no temperature-independent rate satisfies for every .
Proof. Sending forces . But , and on the nonempty interval between them,
(13.6)
This contradicts equality. The strict split condition is essential; in the merged regime the iid free energy holds.
13.5. Endpoint and scaling checks. At , all scores are iid and . Count correction still has unique optimum . Averaging has limiting free energy , hence threshold and infimum zero as . At ,
(13.7)
Count correction and averaging coincide exactly. Their minimum is , attained by every , so uniqueness in Theorem 4.1 excludes this endpoint.
At fixed , a correction with uniformly log weight cannot change an off-boundary threshold. Fixed or subexponential multiplicities therefore cannot generate the order-d correction studied here. The two-level model assumes rather than a fixed number of duplicates.
For conventional scaled dot-product pre-softmax scores , a finite-size plug-in choice is
(13.8)
Compact uniform convergence justifies this plug-in choice. The scale depends on marginal Gaussian variance and on supplied groups; it is not a universal scaling law for bounded or normalized attention models.
HEEHYUN PARK
A Count correction: common optimum

B Separation at
C Adaptive-temperature finite-size check
D Participation at d=64
FIGURE 1. Analytical retrieval thresholds and finite-size Gaussian checks. Dashed lines in the simulation panels are infinite-size predictions; markers are empirical means with 1.96 standard errors. These are synthetic model checks.
14. NUMERICAL VERIFICATION
Figure 1 retains the four Gaussian diagnostics. Panel A shows the common count-correction optimum as correlation changes. Panel B compares the required signals for ordinary attention, count correction, and averaging. Panel C optimizes the temperature for each finite array and compares the required signal to the asymptotic limit. Panel D distinguishes cluster participation from token participation.
The numerical checks use NumPy, SciPy, and Matplotlib on CPU. The theory-verification study uses seed 20260910 and 120 parameter configurations: , log-uniform on , uniform on , and log-uniform on . SLSQP optimizes the variational problem from two starting points, independently of its closed-form case distinction. Scalar optimization checks the count and partial-count optima. Additional checks cover covariance monotonicity, Jensen comparisons, replication, bounded count errors, and the finite-sample interpolation identity. The last check has Monte Carlo sampling error and is not symbolic verification.
The finite-array simulation uses seed 271828 with
and 64 independent arrays at each dimension. It evaluates on each shared array. The largest array has distractor scores. Each per-array optimum is searched on [0.025, 4]; this bounded search is not the all-temperature proof. Plot error bars are 1.96 times the sample standard error, interpreted as descriptive normal approximations.
A separate extension-verification study uses seed 314159 to compare entropy-root calibration with scalar optimization and a separately constrained 20-dimensional entropy optimization on 20 arrays. It also checks the high-temperature tangent bound by directly optimizing the prefix-constrained variational problem for 40 hierarchies of depths three through five. The maximum entropy-duality discrepancy was about ; solver success is not a proof.
The non-Gaussian verification uses seed 161803 and 30 hierarchies of depths two through five, with independent level-specific Poisson rates and jump sizes. It compares the cumulant optimum with direct prefix-constrained optimization and checks the averaged root floor through a separate rate-function inversion.
Agreement with a Gaussian simulator checks the stipulated model's implementation, not its validity for trained heads. The separate frozen-sentence experiment is described in Appendix A; no training experiment or implemented LUCID comparison is claimed.
15. A FINITE-ARRAY ENTROPY CHARACTERIZATION
Let be the empirical score law. In the tail-probability convention, define the classical entropic value-at-risk [1] by
(15.1)
Our optimized threshold is exactly . Its entropy dual below is the standard relative-entropy dual: is equivalent to . We give a direct finite-array proof for clarity and do not claim this identity as new. The empirical limit in Theorem 4.1 concerns dependent triangular arrays with an exponentially vanishing tail probability; replacing their empirical law by a Gaussian population law requires that theorem, not just the identity.
Proposition 15.1 (EVaR identity and exact temperature calibration). Fix real distractor scores , with and a unique largest score. Let and let . Then
(15.2)
has a unique minimum, attained at the unique solution of
(15.3)
Moreover, with the probability simplex,
(15.4)
For a given planted score , a temperature with exists if and only if exceeds this minimum.
Proof. Differentiation gives
(15.5)
Strict inequality follows because the scores are nonconstant and every Gibbs weight is positive. Entropy decreases continuously from to zero, the latter using uniqueness of the maximum. Since , there is exactly one root, and the derivative changes from negative to positive there.
HEEHYUN PARK
For any probability vector p, nonnegativity of relative entropy gives the Gibbs variational inequality
(15.6)
with equality at the Gibbs vector. If , it implies . At the optimizing Gibbs vector, the entropy constraint is an equality and so is the inequality, proving (15.4). The last assertion is the exact log-odds criterion .
This is a finite deterministic identity, independent of Gaussian assumptions or the correlation structure. It characterizes the strongest temperature-tuning baseline used in the lower bound. It uses the distractor subset, so it should not be presented as a deployable target-blind estimator without addressing how that subset is identified. Gaussian arrays with have a unique maximum almost surely. Compact convergence and the strict limiting minimizer imply in our model; tightness follows from the endpoint bounds in (11.8).
16. THE SAME SEPARATION FOR ANY FIXED FINITE HIERARCHY
Theorem 16.1 (Hierarchical universality of the count-correction floor). Fix , entropy rates , and variances summing to one. At level , each tree node has children. Give every level- edge an independent score; each leaf score is the sum along its path. Group leaves by their first edge. The number of groups has rate , and every group has size .
For count correction by , the limiting threshold has the unique minimum at inverse temperature . Its empirical infimum over all temperatures converges in probability to , and no adaptive temperature retrieves a singleton signal below this floor. Averaging all leaves of each first-level group has limiting threshold , with minimum .
Proof. Write , , and . The finite-hierarchy counting formula is
(16.1)
Here is an explicit extension of the proof of Lemma 9.1. On a compact coordinate box, use finitely many bins at each level. The expected count of paths in a specified sequence of the first bins has exponent , where is the infimum of the level- Gaussian rate in that bin. Markov's inequality eliminates any prefix with negative exponent bounded away from zero, and bounds the leaf count with its total entropy exponent. A union bound over levels and bins proves the upper bound. For strict prefix inequalities, induction over levels proves the lower bound: conditional on selected level-(j-1) paths, their independent outgoing edges supply a binomial number of extensions with exponentially positive mean of rate . Chernoff bounds and the induction give the desired leaf-count exponent. Shrinking bins and approximating boundary points by scalar contractions completes the argument. There are finitely many levels. Gaussian union bounds control coordinate tails, and the same second-moment bound as in Lemma 9.1 gives convergence. This proves (16.1) without invoking an unproved hierarchy limit.
The unconstrained optimizer is . It is feasible for
(16.2)
Every : for use , and for use and . Thus , and on a neighborhood of , . Since (16.1) is a supremum of affine functions of
, is convex. Its supporting line at c is
(16.3)
This proves , with equality at . Equality at a different point would force linearity on the segment to , contradicting strict quadratic convexity in a neighborhood of . The minimizer is therefore unique.
For the adaptive statement, the average score divided by has variance . The largest score divided by converges to by the same largest-term squeeze. This limiting slope is strictly larger than : choose , where , and use convexity to bound the asymptotic slope below by . Sup-norm score bounds give compact uniform convergence. The Jensen and maximum-term estimates (11.8), replacing with , now give convergence of the empirical infimum. The identical small-temperature log-odds argument in Theorem 4.1 establishes failure uniformly in temperature below the floor.
For averaging within one root group, the level- contribution for averages independent edge scores, with equal coefficients; each edge has the same number of descendant leaves. The total residual variance is , where
(16.4)
A Gaussian union bound over the root groups bounds the maximum residual divided by by , because its tail exponent is while the group count grows only as . The remaining independent root scores have variance , giving . This completes all assertions.
This extension shows that the optimized separation is not an artifact of choosing exactly two Gaussian levels. It still requires a fixed finite hierarchy, positive exponential branching rates, fixed Gaussian edge variances, supplied first-level groups, and a singleton relevant item.
17. BEYOND GAUSSIAN SCORES: A CUMULANT CHARACTERIZATION
The optimized separation extends to a class of non-Gaussian hierarchies. Non-Gaussian GREM free energies and level-dependent rate functions are classical [15]. This extension uses exponential tilting and large deviations [7]; it does not assert a new large-deviation principle or a new EVaR duality.
Theorem 17.1 (Count correction and averaging for light-tailed hierarchies). Use the fixed K-level tree and positive branching rates of Theorem 16.1. Replace every level- Gaussian edge score by . All increments are independent, with a common level-dependent distribution. Assume each increment is centered and nondegenerate, its cumulant generating function
(17.1)
is finite for every , and as . Put , , and . Let be the unique solutions
(17.2)
For inverse-count correction of each first-level group, the limiting threshold has the unique minimum
(17.3)
The empirical infimum over all positive temperatures converges in probability to . For , the supremum of the planted mass over all temperatures tends to zero; for , temperature retrieves.
Averaging the leaves of each first-level group has optimized threshold
(17.4)
HEEHYUN PARK
For every , averaging retrieves at each fixed , whereas no temperature for count correction retrieves. A supplied partition and a singleton target are still required.
Proof. Properties of the rate functions. Finiteness of the moment generating functions on justifies differentiation of every order on compact intervals, by domination using nearby exponential moments. Nondegeneracy implies : this derivative is the variance under exponential tilting. Centering implies and for . Define
(17.5)
The derivative-range assumption makes the optimizer in finite and unique for every real , and is continuous and strictly convex, with . It is superlinear: for any , . For , , and , since for its derivative is at least and . Thus both roots in (17.2) exist uniquely.
The hierarchical counting formula. For an edge average and any , choose with . Under the tilted product law with density , the law of large numbers gives . For the interval , change of measure therefore yields
(17.6)
An exponential Markov bound on each small interval gives the matching local upper bound as its width tends to zero. Compactness permits a finite cover, and exponential Markov bounds at arbitrary fixed positive and negative t control the tails. These are the usual exponential-tilting ingredients of Cramér's theorem, written here to specify the probabilities needed in the counting argument. They apply to lattice increments too; fixed nonempty open intervals around x have tilted probability tending to one.
Apply the prefix-bin counting proof of Theorem 16.1, replacing each quadratic cost by . The conditional extension counts are still binomial, since edge increments on different outgoing edges are independent. For strict prefix costs, all conditional means grow exponentially. For the upper bound, any prefix of cost exceeding its branching rate is eliminated by Markov's inequality, and surviving leaf counts obey the total cost bound. Boundary points are approached by , , since convexity and give and all . Tails of the exponentially many edges are negligible after taking a sufficiently large compact box: for level a union bound is bounded by
(17.7)
for the event that an edge magnitude exceeds dR. Consequently,
(17.8)
This feasible set is compact by superlinearity. The same tail bounds imply bounded second moments for the maximum absolute leaf score divided by d, giving convergence as well.
A strictly interior optimizer and its supporting line. The unconstrained optimizer in (17.8) is . Its level costs are . At , their sum is . For the first prefix, , because every other . For every , the prefix cost is at most . All constraints are therefore strict. They remain strict in a neighborhood of , where
(17.9)
The variational expression is convex in . Its supporting line at yields, for every ,
(17.10)
where (17.2) was used for the intercept. Equality holds at . Equality at another point would force an affine segment adjacent to , contradicting there. This proves the unique limiting optimum.
Temperatures chosen from the realized array. The average of all leaf scores divided by d has mean zero and variance
(17.11)
The maximum absolute score divided by is bounded in probability by the preceding exponential-moment bounds. Thus the same finite-grid argument as Lemma 11.2 gives uniform convergence of on compact temperature intervals. The maximum score divided by tends to by the largest-term squeeze. Moreover : choose in the strict-feasibility neighborhood, where , and use convexity. The two endpoint bounds (11.8), now with , exclude temperatures escaping to zero or infinity. They establish convergence of the empirical infimum. The proof of uniform failure in Theorem 4.1 only uses these bounds, compact convergence, the vanishing average, and ; each hypothesis has just been verified. Its separate Jensen bound on the log odds for small temperatures gives below the floor. The fixed-temperature log-odds limit proves success above it.
Averaging and the strict gap. Within a root group, put for . The residual mean is the sum, over levels, of the averages of independent edge scores. Hence, exactly,
(17.12)
for every fixed real , since at zero. For , choose a fixed . A union bound and exponential Markov inequalities at and give
(17.13)
Averaging therefore leaves the one-level root free energy
(17.14)
For positive , the optimizer is until and the rightmost feasible point thereafter. Thus the threshold decreases to and equals it for . In particular
(17.15)
At the count optimum,
(17.16)
because the second summand is strictly positive. This proves the gap and all retrieval assertions.
Concrete non-Gaussian example. Let for independent Poisson variables of mean , with . Then
(17.17)
These distributions meet every hypothesis and allow direct numerical optimization of (17.8). For Gaussian increments with , Theorem 17.1 recovers exactly and . The dependence on the leaf marginal cumulant, rather than its variance
HEEHYUN PARK
alone, matters beyond Gaussian scores. Heavy-tailed increments without exponential moments and bounded-support saturation regimes are not covered by this theorem.
DISCLOSURE OF AI-ASSISTED WORK
In this work, the author used generative AI tools to assist with writing mathematical proofs, proposing and refining hypotheses, designing and evaluating the research methodology and numerical experiments, implementing the methods and verification code. The author also used generative AI tools to improve the manuscript's clarity, structure, and formatting. The author takes full responsibility for the final content of the paper, including all text, claims, proofs, code, and artifacts produced with the assistance of generative AI.
APPENDIX A. FROZEN-ENCODER EXPERIMENT: PROTOCOL AND ADDITIONAL RESULTS
Data and representation. BANKING77 contains 10,003 training and 3,080 test sentences across 77 intents [5]. We process the official training split first and test split second, discarding repeated texts after lowercasing and collapsing whitespace, including test texts already encountered in training. This removes four training and eight test rows. With seed 20260913, we select 32 training sentences per intent as a key pool, then four validation and 12 evaluation queries per intent from the test split. Validation and evaluation share the intent vocabulary and key pool, but no normalized query text. We retain all selected queries regardless of retrieval outcome. The resulting scores are not an official BANKING77 benchmark result. Dataset labels construct the controlled contexts and evaluate outputs; the retrieval functions receive scores, groups, and values, without the query label.
We use the official float32 ONNX export of the all-MiniLM-L6-v2 sentence encoder on CPU. The pinned revision is 1110a243fdf4706b3f48f1d95db1a4f5529b4d41. Following the model card [21], we apply attention-mask mean pooling and normalize the resulting 384-dimensional sentence vectors. The maximum input length is 256 tokens. The 3,696 selected sentences are encoded in batches of 32; no parameters are trained. Cosine scores are computed from these vectors. A group score is the arithmetic mean of its member scores, equivalently the dot product with the mean of the normalized key vectors, without normalizing that mean again. BANKING77 is distributed under CC BY 4.0 and the encoder under Apache 2.0. Model pretraining overlap has not been audited. We recorded the model revision, download URLs, and SHA256 hashes during the experiment.
Paired contexts. For each seed in , we randomly order each intent's 32 keys. For each target intent, we choose 38 of the other 76 intents to form larger distractor groups; the remaining 38 are singleton distractors. Queries of the same intent share these draws. The six conditions use the same ordering: one key per intent; eight copies of the first key in the selected distractor groups; four distinct keys; eight distinct keys; eight distractor keys with four relevant keys; and a mixed relevant group. In the last condition, three keys are moved from the first selected distractor group into the relevant singleton's group. This preserves the token set and leaves five keys in the donor group. Context sizes are respectively 77, 343, 191, 343, 346, and 343 keys. This construction deliberately controls whether relevant keys are averaged; it does not estimate a partition or sample naturally occurring context frequencies.
Methods and values. With cosine score , multiplier , and supplied group size , ordinary and corrected token weights are proportional to and . Averaging assigns weight and value to group . Individual values are the 77-dimensional one-hot intent vectors. Thus the output's relevant coordinate sums the attention on relevant values; with several relevant keys it is not a single-token mass. A fourth baseline selects one member uniformly per group and applies softmax with equal group priors. Its selection uses the context seed, not query scores. In the mixed condition it may discard the sole relevant key, yielding zero relevant mass and infinite negative log mass. It therefore has no finite validation objective there; its deterministic smallest-grid fallback is archived but excluded from Table 2.
Temperature and uncertainty. Each method and condition selects one t from 81 logarithmically spaced values between 0.25 and 1024 by minimizing mean validation negative log relevant value mass over the 308 queries and three seeds. The same chosen value is applied to all evaluation queries and context seeds. All three primary methods choose an interior grid point. The multiplier t acts on cosine scores; we do not identify it with the Gaussian or fit the asymptotic square-root thresholds to these bounded scores. Table 2 reports top-1 accuracy of the output intent at the same selected multiplier. Figure 2 shows evaluation curves descriptively, without using them to select temperatures. Bootstrap intervals use 2,000 paired resamples of the 77 intent blocks (seed 8831), after averaging the three context seeds within each query. They describe variation across these intents conditional on this encoder, corpus, and key draws; the 2,772 query-context pairs are not treated as independent queries.
A Eight keys per distractor group

B Changing the relevant group
FIGURE 2. Frozen sentence scores. A: evaluation temperature curves for eight-key distractor groups; dots mark independently validation-selected temperatures. B: relevant value mass after changing the relevant group, with 95% intent-block bootstrap intervals. The reversal for four relevant keys occurs even though all four carry the correct intent label.
An all-temperature oracle. For singleton-target conditions we additionally give count correction the true relevant position and optimize its relevant mass separately for each evaluation query. With distractor scores and target score , minimize the convex log-odds function over . Its derivative is monotone, so bracketing and scalar root finding locate an interior minimum; the implementation also handles the limits at zero and infinity. This objective maximizes mass for a known target and differs from minimizing the signal threshold in Proposition 15.1. With eight-key distractor groups, oracle count correction has mean mass 0.511, above calibrated averaging's 0.440. Only seven of the 2,772 evaluation query-context pairs have averaging mass above 0.9 while the count oracle cannot reach 0.9. Moreover, the oracle optimum is at infinity for 40.7% of these pairs. Finite optimal calibration across queries must therefore not be confused with the theorem's unique finite threshold optimum. The experiment does not establish an asymptotic or uniform all-temperature lower bound on learned scores.
Failures and checks. With four relevant keys, averaging loses 0.161 mean relevant mass against count correction, with paired 95% interval . High-scoring individual matches can be useful on the relevant side even with correct intent groups. The mixed condition also changes the value: only one quarter of the averaged target-group value is relevant, so its relevant mass cannot exceed 1/4. The three contaminating keys share one other intent; its output coordinate is always at least three times the target's, making zero top-1 accuracy structural in this stress test. We do not interpret it as a separate empirical discovery. For singleton-target contexts, Jensen ordering holds
HEEHYUN PARK
at every evaluated temperature; exact-copy invariance and equality of all methods on all-singleton contexts hold to . Independent small-array tests compare mixed values with direct softmax sums and check interior and endpoint oracle solutions against dense temperature search.
TABLE 2. Temperature , mean relevant value mass , and top-1 output-intent accuracy (%) at that temperature. Temperatures minimize validation negative log relevant value mass, not top-1 error.
| Context | Method | Accuracy (%) | ||
|---|---|---|---|---|
| One key per intent | Ordinary | 14.42 | 0.379 | 51.8 |
| One key per intent | Count correction | 14.42 | 0.379 | 51.8 |
| One key per intent | Averaging | 14.42 | 0.379 | 51.8 |
| One key per intent | One representative | 14.42 | 0.379 | 51.8 |
| Exact copies (8) | Ordinary | 17.75 | 0.288 | 36.3 |
| Exact copies (8) | Count correction | 14.42 | 0.379 | 51.8 |
| Exact copies (8) | Averaging | 14.42 | 0.379 | 51.8 |
| Exact copies (8) | One representative | 14.42 | 0.379 | 51.8 |
| Same intent (4) | Ordinary | 14.42 | 0.267 | 39.4 |
| Same intent (4) | Count correction | 13.00 | 0.345 | 53.5 |
| Same intent (4) | Averaging | 14.42 | 0.406 | 56.7 |
| Same intent (4) | One representative | 14.42 | 0.381 | 53.3 |
| Same intent (8) | Ordinary | 16.00 | 0.234 | 33.1 |
| Same intent (8) | Count correction | 13.00 | 0.342 | 53.2 |
| Same intent (8) | Averaging | 16.00 | 0.440 | 57.6 |
| Same intent (8) | One representative | 14.42 | 0.375 | 51.6 |
| Four relevant keys | Ordinary | 21.86 | 0.614 | 72.1 |
| Four relevant keys | Count correction | 21.86 | 0.626 | 72.8 |
| Four relevant keys | Averaging | 19.70 | 0.465 | 59.1 |
| Four relevant keys | One representative | 14.42 | 0.366 | 50.3 |
| Mixed relevant group | Ordinary | 16.00 | 0.234 | 33.1 |
| Mixed relevant group | Count correction | 16.00 | 0.243 | 34.2 |
| Mixed relevant group | Averaging | 4.59 | 0.005 | 0.0 |
Implementation details. The evaluation pipeline first loads the pinned public assets, then computes frozen sentence scores, constructs the seeded contexts, selects temperatures on the validation queries, and reports the evaluation metrics. During the experiment we recorded the exact row IDs and texts, frozen scores, every context, all temperature curves, per-query values, selected temperatures, uncertainty intervals, and package versions. Downloaded model weights and raw source data remained in a local cache. The protocol was written before inspecting retrieval results; the oracle rescue fraction is an additional descriptive analysis. This single-encoder, single-dataset study neither isolates correlation at fixed marginal score distributions nor tests internal attention heads, context-length scaling, or unknown-group recovery.
APPENDIX B. FROZEN-TRANSFORMER INTERNAL-ATTENTION DIAGNOSTIC
This diagnostic asks whether count correction and averaging remain mechanically distinct inside an actual pretrained transformer. It is deliberately secondary to the frozen sentence-retrieval study in Section 8: the intervention is causal, but the model is weak on the controlled task and the downstream results do not support a general advantage for averaging.
Model and task. We freeze the masked-language model distilbert-base-uncased [19] at revision 12040accade4e8a0f71eabdb258fecc2e7e948be. Synthetic prompts define an eight-color associative retrieval task. Marked answer positions form the supplied groups and every other active token
TABLE 3. Frozen DistilBERT layer-6 attention intervention. Means average three context seeds and two reversed orders within 80 queries; brackets are paired 95% bootstrap intervals. is averaging minus count correction.
| Condition | relevant mass | candidate prob. | |
|---|---|---|---|
| All singleton | 1/1 | .00000 | .00000 |
| Repeated facts (4) | 1/1 | .00032 [.00030,.00035] | -.00215 [-.00253,-.00181] |
| Related (4), selected | 2/1 | -.00139 [-.00291,.00001] | -.02042 [-.03285,-.00946] |
| Related (4), native | 1/1 | .00018 [.00017,.00020] | -.00159 [-.00186,-.00133] |
| Four relevant | 1/1 | -.00083 [-.00093,-.00074] | .00054 [.00014,.00098] |
is a singleton. The locked evaluation contains 80 query specifications, three context seeds, and paired forward and reversed group orders, giving 1,920 prompt instances. The all-singleton control, four repeated exact facts, four distinct related facts, and four relevant answer positions test identity, singleton, and multiple-relevant regimes.
Internal intervention. At the masked-token query row, we replace the actual softmax computation in all 12 heads of validation-selected layer 5, the final DistilBERT layer. Ordinary attention applies softmax to the token logits. Count correction subtracts the log supplied group size from each member logit. Averaging applies softmax to group-mean logits and combines group-mean projected values. Every other model operation and parameter remains unchanged. Layer and temperature choices were fixed from 24 validation query specifications before the 80 evaluation specifications were generated and hash-locked. Intervals below use 5,000 paired bootstrap resamples of query specifications after averaging context seeds and the two orders.
Mechanistic result. At the native temperature, averaging raises singleton relevant attention mass above count correction for every prompt in both repeated and related groups. The mean gains are small but resolved: for repeated facts and for related facts. Related groups also have larger within-group extremes: the mean maximum-minus-mean logit is 0.443, compared with 0.391 for repeated facts, while the corresponding log-mean-exp-minus-mean gaps are 0.0811 and 0.0676. Thus the score variation targeted by averaging is present in actual self-attention logits.
Repeated textual facts are not identical score-value copies inside the transformer. Absolute positions and prior contextualization give their marked tokens different logits and projected values. Consequently, the exact-copy equality from the abstract finite-array model applies only to an artificial control with identical logits and values; that control passes to floating-point tolerance, but repetition in a transformer need not satisfy it.
Downstream result and scope. Increased relevant attention mass does not improve the frozen model's masked-token prediction. At the common native temperature, averaging lowers the correct candidate probability relative to count correction for both repeated and related singleton conditions. After validation-only calibration, related-group count correction selects temperature 2 while averaging selects 1, and averaging is lower by 0.0204 with paired interval . Candidate top-1 accuracy is inconclusive, and secondary full-vocabulary probability and rank change direction under separate calibration. Target position also changes the selected-temperature mass comparison. With four relevant positions, averaging lowers total relevant mass, while its candidate-probability increase is only ; ordinary attention has the highest candidate probability in that condition.
The model is barely above the eight-way random baseline: its all-singleton candidate accuracy is 0.131, versus 0.125 at chance. Only one small English masked-language model, one synthetic task, the final layer, and oracle-supplied groups are tested, with all heads intervened together. These facts limit what either the downstream nulls or reversals imply about capable retrieval heads. Finite bounded logits on these prompts do not verify the Gaussian phase transition, the all-temperature
HEEHYUN PARK
separation, or the hierarchical extension. The diagnostic establishes only that the two operations are internally distinct and that their downstream effects here are small, metric-dependent, and often adverse.
Implementation and audit. The locked evaluation used 6,240 forward passes in 165 seconds on a GTX 1080 and produced 11,520 metric rows. During the experiment we recorded model and asset hashes, exact prompts, the protocol lock, temperatures, per-prompt outputs, and audit results. The audit checks source and protocol hashes, row uniqueness, probability bounds, temperature locks, singleton equality, native Jensen inequalities, and deterministic reanalysis. Model weights remained in a local cache.
REFERENCES
-
Amir Ahmadi-Javid, Entropic value-at-risk: A new coherent risk measure, Journal of Optimization Theory and Applications 155 (2012), no. 3, 1105–1123.
-
Daniel Bolya, Cheng-Yang Fu, Xiaoliang Dai, Peizhao Zhang, Christoph Feichtenhofer, and Judy Hoffman, Token merging: Your ViT but faster, International Conference on Learning Representations, 2023.
-
Stéphane Boucheron, Gábor Lugosi, and Pascal Massart, Concentration inequalities: A nonasymptotic theory of independence, Oxford University Press, 2013.
-
Anton Bovier and Irina Kurkova, Derrida’s generalised random energy models 1: Models with finitely many hierarchies, Annales de l’Institut Henri Poincaré, Probabilités et Statistiques 40 (2004), no. 4, 439–480.
-
Iñigo Casanueva, Tadas Temcinas, Daniela Gerz, Matthew Henderson, and Ivan Vulić, Efficient intent detection with dual sentence encoders, Proceedings of the 2nd Workshop on Natural Language Processing for Conversational AI, 2020, pp. 38–45.
-
Shi Chen, Zhengjiang Lin, Yury Polyanskiy, and Philippe Rigollet, Critical attention scaling in long-context transformers, 2025.
-
Amir Dembo and Ofer Zeitouni, Large deviations techniques and applications, 2 ed., Springer, 2010, Corrected printing of the 1998 edition.
-
Bernard Derrida, Random-energy model: Limit of a family of disordered models, Physical Review Letters 45 (1980), no. 2, 79–82.
-
___, A generalization of the random energy model which includes correlations between energies, Journal de Physique Lettres 46 (1985), no. 9, L401–L407.
-
Elvis Dohmatob, Understanding softmax attention layers: Exact mean-field analysis on a toy problem, Advances in Neural Information Processing Systems, vol. 38, 2025.
-
Sai Surya Duvvuri, Nirmal Patel, Nilesh Gupta, and Inderjit S. Dhillon, LUCID: Attention with preconditioned representations, 2026.
-
Qucheng Gao, Zuyi Yang, and Xiao Chen, Clustered attractor manifolds and dynamical condensation in self-attention, 2026.
-
Alessio Giorlandino and Sebastian Goldt, Two failure modes of deep transformers and how to avoid them: A unified theory of signal propagation at initialisation, 2025.
-
Tomohiro Hayase and Ryo Karakida, A unified framework for critical scaling of inverse temperature in self-attention, 2026.
-
N. K. Jana and B. V. Rao, Generalized random energy model II, Journal of Statistical Physics 127 (2007), 841–850.
-
Itay Lavie, Kirsten Fischer, Andrey Lekov, Frederic Van Maele, Zohar Ringel, and Moritz Helias, Phase transitions in attention: A bayesian theory of copy head emergence, 2026.
-
Wentao Ni, Kangqi Zhang, Zhongming Yu, Oren Nelson, Mingu Lee, Hong Cai, Fatih Porikli, Jongryool Kim, Zhijian Liu, and Jishen Zhao, Double-P: Hierarchical top-p sparse attention for long-context LLMs, 2026.
-
Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, Philipp Seidl, Michael Widrich, Thomas Adler, Lukas Gruber, Markus Holzleitner, Milena Pavlović, Geir Kjetil Sandve, Victor Greiff, David Kreil, Michael Kopp, Günter Klambauer, Johannes Brandstetter, and Sepp Hochreiter, Hopfield networks is all you need, International Conference on Learning Representations, 2021.
-
Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf, DistilBERT, a distilled version of BERT: Smaller, faster, cheaper and lighter, 2019.
-
Vincenzo Maria Schimmenti and Matteo Ciarchi, A bifurcation theory for the equilibria of modern hopfield networks, 2026.
-
Sentence Transformers, all-MiniLM-L6-v2: Model card, 2021, Frozen revision and export hashes recorded with the experiments.
-
Wenxuan Wu, Zhongang Qi, and Fuxin Li, PointConv: Deep convolutional networks on 3d point clouds, Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2019.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, PENNSYLVANIA STATE UNIVERSITY
Email address: hbp5148@psu.edu