When a location tag becomes a causal assumption

Thought experiment 1

The shuffled telegram

Place the four tokens dogs chase small cats on separate cards. Ask a position-free attention layer to process them, then permute the cards to cats chase small dogs. Each query still compares with the same collection of keys and values. The outputs move with the cards, but the layer has no independent fact that one ordering was the original. What changed in the world? Syntax changed. What changed in the layer’s inputs? Only a permutation.

This is the hidden gap that positional methods fill. They do more than improve a score. They alter which transformations the architecture can distinguish.

Order as a path through a permutation field
A field of token permutations and one ordered path On the left, identical token sets form a cloud of possible permutations. On the right, a positional rule selects a directed path through those tokens, showing that order is extra structure rather than a property of the token multiset. Same token multiset One sequence path dogs chase small cats cats small dogs dogsposition 1 chaseposition 2 smallposition 3 catsposition 4 Permutation changes arrangement, not membership. Position adds a directed relation among tokens.
The token multiset does not contain its own route. A positional mechanism selects which path through the same elements counts as the sequence. Illustrative conceptual figure.

For a full self-attention layer without positional information, permuting the rows of the input permutes the output rows in the same way. In compact notation, if P is a permutation matrix and A is the attention operation, then:

A(PX) = P A(X) X is the matrix of token representations. P reorders the tokens. The equation says that attention follows the reordering rather than judging it wrong. A causal mask adds an asymmetry because earlier positions can be seen by more later positions, but that is a particular source of order, not a general proof that explicit position is unnecessary.

Vaswani and colleagues introduced fixed sinusoidal encodings because the Transformer removed recurrence and convolution, both of which had carried order through their computation. They also tested learned absolute embeddings and reported similar translation results in their setting.[1] Shaw, Uszkoreit and Vaswani then moved positional information into pairwise attention relations, improving the studied translation tasks over the absolute baseline.[2] These are more than two implementations of one label. They preserve different relations.

Mechanism

The right unit of analysis is a three-layer positional contract. The coordinate carrier says which positions can be represented. The pairwise comparator says how those positions alter attention. The horizon policy says what happens when deployment presents positions or distances not encountered during training.

The three-layer positional contract
Separating carrier, comparator and horizon prevents a common category error: a formula can represent a new index while the trained model still fails to use it. Practitioner synthesis introduced in this paper.

Preservation is a commuting test

There is a compact way to express the issue without turning the paper into abstract algebra. Let Tc shift every sequence index by the same integer c. Let S(i, j) be the positional contribution to the score between two tokens. A shift-invariant comparator satisfies S(i + c, j + c) = S(i, j). The intervention can be performed before or after computing the relation and the result agrees. This is the practical meaning of a commuting test.

Do not confuse invariance with equivariance. If the output is a sequence of labels, shifting the input may be expected to shift the labels to corresponding positions. That is equivariance. If the output is a single answer such as “Alice trusts Bob”, shifting the sentence may be expected to leave the answer unchanged. That is invariance. The same positional mechanism can support both, depending on the downstream readout. What matters is whether the internal relation transforms predictably.

RoPE obtains its relative law because its rotations form a representation of integer translation: applying position i and then an offset c is equivalent to applying position i + c. Relative biases satisfy the same shift test by using j − i directly. Learned absolute tables do not generally satisfy it because the row at i + c has no enforced relation to the row at i. Fixed sinusoids do possess a structured shift operation at the carrier level, yet addition to content and learned projection can prevent that structure from surviving into the score.

The preservation test must be applied where the claim is made. Carrier algebra does not automatically survive the comparator. Comparator algebra does not automatically survive nonlinear layers and task heads. This is why the three-layer contract is more informative than naming an encoding family.

Worked example 1

“Only Alice trusts Bob”

Move the sentence from positions 1–4 to positions 101–104. A task that asks who trusts whom should preserve the answer. Swap Alice and Bob, and the answer should change. A useful positional contract must therefore ignore the change of origin while detecting the change of relative order. Yet a document-layout task may care that the sentence appears in the first four slots because those slots form the title. The same words require a different contract because the task’s invariance changed.

Thought experiment 2

The moving theatre

A four-person scene is performed on marks 2, 3, 4 and 5. Move every actor ten metres right while preserving their separations. Is it the same scene? For dialogue, probably yes. For a safety system whose emergency exit is at mark 5, no. An encoding that is invariant to global shifts has discarded the origin deliberately. An encoding that preserves absolute slots has retained it deliberately. Invariance is not automatically a virtue; it is a task claim.

The argument in one pass
Chart · flow
flowchart LR
  A["When a location tag becomes a<br/>causal assumption"] --> B["Three ways of keeping order"]
  B --> C["Why the clocks fail beyond the<br/>horizon"]
  C --> D["Build and test the positional<br/>contract"]
  D -. "re-test" .-> A
  classDef first fill:#0a1424,stroke:#007D68,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 Position, rotation and relative order: from When a location tag becomes a causal… to Match positional invariance to causal…. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

Three ways of keeping order

Absolute position: name the slot

The most direct method gives each index i a vector pi and adds it to the token representation xi. The layer receives zi = xi + pi. A learned table can assign a distinctive address to each trained slot. This is useful when position 0, position 1 or a fixed grid cell has a stable role.

But addition mixes what and where before queries and keys are projected. Expanding a dot product produces content-content, content-position, position-content and position-position terms. Unless the learned projections acquire a special structure, shifting every token changes more than an address. It changes the cross-terms through which content is compared. Absolute addition offers positional identity, not guaranteed translation equivariance.

(xᵢ + pᵢ)ᵀ Wqᵀ Wk (xⱼ + pⱼ) The four resulting interactions can depend on i and j separately. The assumption behind a pure relative interpretation would be that the learned matrices cancel every origin-dependent term. The architecture does not enforce that assumption.

Fixed sinusoidal encodings replace a finite table with paired sine and cosine functions at geometrically spaced wavelengths. Each position is read on several clocks, from fast-turning to slow-turning. For a fixed offset k, the code at i + k can be obtained by a linear transformation of the code at i.[1] This gives the model a useful algebraic route to relative offsets. It does not force the full attention comparator to use that route, because content and position remain added before arbitrary projections.

Relative position: name the displacement

A relative method asks a different question. Instead of “where is token j?”, it asks “how far and in which direction is j from i?” Shaw and colleagues inserted learned relative representations into the attention compatibility and value computations.[2] Later designs used scalar biases, buckets or disentangled content-position terms. Transformer-XL combined a relative scheme with segment recurrence.[3] T5 used learned relative position biases with distance buckets.[4] DeBERTa separated content and position vectors inside attention.[5]

sᵢⱼ = qᵢᵀkⱼ + b(j − i) qi and kj carry content. The function b contributes a score based on signed displacement. Replacing both indices with i + c and j + c leaves j − i unchanged. Exact shift invariance holds for this positional term. Clipping or bucketing may deliberately make several long distances indistinguishable.

A relative comparator therefore preserves a relation while discarding an origin. That can be exactly right for syntax, music intervals and local causal dependencies. It can also be wrong for sequence headers, absolute time or tasks where the first occurrence has a special status. Distance buckets introduce another contract: retain fine distinctions nearby, then compress distant positions. This is not a defect if the task only needs “far away”. It is a failure if 513 and 4,096 tokens apart must remain different.

Several clocks project the same token path
Absolute, relative and rotary views of the same token sequence The top row shows tokens on absolute numbered slots. The middle row shows arrows labelled by relative displacement. The bottom row shows paired circular clocks whose angular differences encode the same displacement at different frequencies. Absolute slots Relative displacement Rotary phase differences A12 B13 C15 D18 j − i = +3 j − i = +5 fast clock at i fast clock at j slow clock at i slow clock at j same displacement, different angular resolutions
Absolute slots retain the origin. Relative arrows retain displacement. Rotary clocks encode the same displacement as a collection of phase differences, giving the comparator several resolutions at once. Illustrative synthesis based on absolute, relative and rotary formulations.

What each representation chooses to forget

A useful encoding is selective. Learned absolute position can remember that an item occupied slot 7 even when its neighbours move, but it does not supply a principled relation between slot 7 and an unseen slot 70,000. A relative bias remembers that one token is three places before another, but discards whether the pair began at slot 7 or slot 700. A clipped relative bias forgets the difference between every distance beyond its threshold. ALiBi retains a monotone ordering of distances in its bias but reduces position to one scalar preference for nearness. RoPE retains directional phase differences across several scales while discarding the common origin.

This gives a sharper design vocabulary than “has position” or “does not have position”. Ask whether the model must distinguish direction from magnitude, exact distance from distance class, or local order from absolute calendar time. A relative function based only on |j − i| cannot distinguish before from after. A signed bias can. A periodic phase can distinguish many offsets but may assign similar scores again later. A learned address can distinguish every trained slot while offering no compositional rule for shifting them.

The distinction also explains hybrid designs. DeBERTa uses relative interactions through its layers while reintroducing absolute position for masked-token decoding.[5] The architecture is saying that relational context should dominate representation building, while absolute location can still help a particular prediction interface. Hybridisation is justified when separate computations genuinely need separate invariants. It is not justified merely by concatenating every available positional signal.

Rotary position: compare phase

Rotary Position Embedding, or RoPE, takes an elegant middle route. It assigns an absolute rotation to each query and key, but their dot product depends on the difference between the two rotations. In each two-dimensional subspace, position i rotates a vector by iθ. Across the model dimension, different pairs use different frequencies.[6]

qᵢ = RᵢWq xᵢ,   kⱼ = RⱼWk xⱼ
qᵢᵀkⱼ = (Wq xᵢ)ᵀ RᵢᵀRⱼ (Wk xⱼ) = (Wq xᵢ)ᵀ Rⱼ₋ᵢ (Wk xⱼ) Ri is an orthogonal rotation. Orthogonality preserves vector norm, and the group law makes the positional contribution depend on j − i. A global shift cancels exactly in the position algebra.
Worked example 2

Two vectors, one relative angle

Let both unrotated vectors be (1, 0). Use one rotary plane with θ = 30°. At positions 2 and 5, the vectors rotate to 60° and 150°. Their dot product is cos(90°) = 0. Shift both positions by ten. They now rotate to 360° and 450°, but the angular difference remains 90°, so the dot product remains 0. Change only the second position from 5 to 6, and the difference becomes 120°, giving cos(120°) = −0.5. The comparator detects displacement without retaining the original origin.

The relative law inside a rotary plane
Two pairs of rotated vectors with identical relative angle The left pair is at absolute angles 60 and 150 degrees. The right pair is shifted to 360 and 450 degrees. Both pairs have a 90 degree separation and the same dot product. Positions 2 and 5 Positions 12 and 15 Δ = 90° Δ = 90° qᵢᵀkⱼ = cos(Δ) = 0 in both coordinate frames
RoPE changes each vector with absolute position, yet the query-key score keeps only the relative rotation. Shifting the origin changes both angles and leaves their difference intact. Illustrative numerical example derived from the RoPE identity.
Thought experiment 3

The clock that returns to noon

A single 12-hour clock cannot distinguish noon today from noon tomorrow. Add a slower day hand and the pair remains unique for longer. RoPE does something analogous with many frequencies. Yet each frequency is periodic, and the combined attention kernel can oscillate with distance. Multiple clocks postpone simple aliasing and provide several resolutions; they do not make distance itself monotone or prove that every unseen phase combination will be used correctly.

This matters because “relative” is often heard as “safe at any length”. The algebra preserves relative displacement under an origin shift. It does not promise that learned query and key features, numerical precision, frequency resolution and the downstream algorithm remain stable at arbitrary displacement.

Multi-frequency phase postpones ambiguity but creates changing resolution
Fast, medium and slow positional phase waves across distance Three waves of different frequency run across increasing token distance. A highlighted training interval ends before a deployment interval where new phase combinations appear. Seen displacement range New phase combinations fast planemedium planeslow plane relative distance → Ltrain
Every rotary plane continues mathematically beyond the training horizon. What changes is the mixture of phases, effective resolution and attention-score distribution encountered by the learned model. Illustrative mechanism figure; not an empirical performance curve.

Why the clocks fail beyond the horizon

Length extrapolation sounds like one question: can the model accept more tokens? It is at least four. Can the positional mechanism produce representations for new indices? Do attention scores remain numerically and statistically stable? Can the model retrieve relevant content from the larger field? Can it execute the required computation over a longer structure? A “yes” to the first does not entail the others.

Published evidence

ALiBi adds a head-specific linear distance penalty to attention logits and reported language-model extrapolation from 1,024-token training to 2,048-token evaluation with favourable speed and memory comparisons in that setup.[7] Position Interpolation compressed extended RoPE indices into the original angular range and, after short fine-tuning, extended studied LLaMA models from 2,048 to as much as 32,768 tokens while largely retaining short-context performance.[9] These results establish useful methods under specified evaluations, not a universal theorem of long-range reasoning.

Defined is not familiar

A learned absolute table has an obvious boundary. Row 4,097 does not exist if training allocated 4,096 rows. A sinusoidal or rotary formula can generate position 4,097, but that only solves addressability. The trained projections may see angles, cross-terms or score magnitudes outside their experience. A clipped relative bias continues to run but may map every sufficiently distant token to the same bucket. ALiBi continues its line, but the penalty grows with distance and therefore encodes a stronger recency prior as the window expands.

Extrapolation is not the ability to calculate a coordinate; it is the ability to preserve a task-relevant relation under a distribution shift in geometry. That distinction explains why methods can look excellent on language-model perplexity yet fail on algorithmic tasks, or retrieve a passkey while mishandling dependencies among several distant items.

Thought experiment 4

Stretching the ruler

A model was trained with a ruler marked 0 to 2,048. Deployment demands 0 to 32,768. Direct extrapolation keeps each old unit the same size and extends the ruler sixteen times. Position Interpolation instead prints all 32,768 deployment positions onto the old physical ruler. New index i is shown to the model as i/16. Nothing lies beyond the familiar range, but neighbouring deployment tokens are now separated by one sixteenth of the old angular step.

Which is safer? Interpolation avoids unfamiliar angles but compresses local resolution. Extrapolation preserves old spacing but introduces new phases. The answer depends on whether the task needs exact nearby distinctions, long-range reach or both. No scalar “context length” resolves that trade.

Three horizon policies for a 16× extension
Learned absolute, direct extrapolation and position interpolation across training and deployment horizons Three timelines show a learned table ending at the training horizon, direct extrapolation continuing with new phases, and interpolation compressing the longer deployment sequence into the old range. Learned absolute table Direct phase extrapolation Position interpolation 0…2,048 rows undefined without resizing or retraining familiar phase range formula defined, phase distribution unfamiliar 32,768 deployment indices compressed into the trained angular span The same target length creates a different geometric shift under each policy.
A context extension method chooses what to sacrifice: table completeness, familiarity of phase, or positional resolution. Fine-tuning can help the model adapt, but the trade remains part of the contract. Illustrative synthesis informed by Position Interpolation, YaRN and LongRoPE.

YaRN adjusted frequency scaling and attention magnitude to extend RoPE-based models more efficiently than earlier approaches in its reported settings.[10] LongRoPE searched non-uniform interpolation factors and used progressive extension to report contexts up to two million tokens on selected models and tasks.[11] These methods show that the frequency spectrum is an engineering surface, not sacred geometry. They also reinforce a boundary: extending the positional substrate is one component of long-context capability, alongside data, optimisation, attention computation and evaluation.

A numerical view of compressed resolution

Take a RoPE model pretrained to length 4,096 and extend it to 32,768 by linear interpolation. The scale factor is eight. Deployment positions 8,000 and 8,008 are presented to the positional mechanism as 1,000 and 1,001. Their old-scale separation is one. Deployment positions 8,000 and 8,001 are presented as 1,000 and 1,000.125. They remain distinct in continuous arithmetic, but the angular difference in every rotary plane is one eighth of what the pretrained model associated with neighbouring tokens.

That compression has two opposed effects. It keeps all angles inside the range experienced during pretraining, reducing the shock of novel phase magnitudes. It also changes the scale at which local relations appear. High-frequency planes now turn more slowly per deployment token. A model adapted on long sequences may relearn how to interpret the compressed steps; a model used without adaptation may not. Non-uniform methods such as YaRN and LongRoPE treat frequencies differently precisely because a single scale factor need not preserve both local resolution and long-range stability.[10][11]

Now reverse the intervention. Keep the old angular step and directly extrapolate to 32,768. Local resolution remains familiar, but the fastest planes complete many additional cycles and the slowest planes enter regions not represented in training. Neither policy is free. Interpolation changes the meaning of a unit; extrapolation changes the range of phases. A configured benchmark should test both consequences rather than treating scale as a tuning constant.

Worked example 3

A code assistant crosses a repository

Consider a code assistant trained on 4,096-token files and deployed on a 32,768-token repository slice. A function call occurs near token 30,000; its definition is near token 2,000. A passkey test asks only whether the assistant can copy the definition’s name. A real maintenance task asks whether the call violates a scope rule introduced at token 12,000 and amended at token 24,000.

Learned absolute positions require new rows. Direct RoPE extrapolation can address every token but presents new phase ranges. Interpolation keeps phases familiar but compresses nearby distinctions. ALiBi supplies a strong, extrapolatable recency bias that may suppress the remote definition. A bucketed relative scheme may collapse several long distances while preserving direction. Retrieval can bring the definition nearby, but then the system is no longer testing positional encoding alone. The configured system must state whether it solves long range by representation, sparse attention, retrieval, recurrence or explicit state.

The useful disagreement around NoPE

A decoder-only Transformer with a causal mask has an asymmetry even without explicit position vectors. Token i can attend to a prefix of length i, so depth and attention patterns can reveal order indirectly. Kazemnejad and colleagues found NoPE outperforming several explicit schemes on their battery of length-generalisation tasks and argued that it often learned T5-like relative patterns.[8] Later arithmetic work showed that positional descriptions and data formatting can radically alter extrapolation, and that strong results are not robust across task formulations.[12][13]

Strong boundary

NoPE is evidence against treating explicit positional vectors as universally necessary, not evidence that sequence position is irrelevant. The causal mask, architecture, training distribution and task can create positional cues. Encoder-only and encoder-decoder systems do not inherit the same argument automatically.

Thought experiment 5

The corridor with one-way doors

Remove every room number from a corridor, but let each room open only to rooms on its left. A visitor may infer that rooms with access to more predecessors lie farther right. That is positional information produced by the access rule, not by a numbered sign. Now replace the corridor with a hall where every room sees every other room. The inference disappears. NoPE succeeds or fails partly because the mask and architecture are themselves positional instruments.

The adversarial path from “accepts 128k” to “reasons over 128k”
Four gates between accepting long input and correct long-range reasoning A path passes through addressability, stable attention, retrieval and task computation. Red side paths show failure at each gate, demonstrating that a nominal context length does not establish full use. 1. Addressnew positions 2. Stabiliseattention scores 3. Retrievethe right evidence 4. Computethe long task missing rows orunseen phases overflow, saturationor score drift lost-in-contextor recency bias retrieves facts butfails the algorithm A nominal window is only the entrance gate Each later gate needs its own measurement and failure condition.
Long-context claims should report the deepest gate passed. Accepting tokens is weaker than stable attention, which is weaker than retrieval, which is weaker than correct long-range computation. Practitioner synthesis; failure modes are illustrative.
Worked example 4

The edge case that fools a passkey test

Build a sequence containing the key 73142 once, followed by thousands of distractors. A model retrieves it perfectly from 64,000 tokens. Now insert three policy amendments after the key and ask for the currently valid number. Retrieval of the first key remains easy, but the answer requires ordered update semantics. A positional method can pass a distant-copy benchmark while failing to compose changes over time. The counterexample separates “can attend far away” from “can compute over ordered history”.

How the claim changes under pressure
Chart · state
stateDiagram-v2
  [*] --> Claim
  state "The shuffled telegram" as Claim
  state "Preservation is a commuting test" as Test
  state "“Only Alice trusts Bob”" 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 The shuffled telegram and keeps counterexamples inside the reasoning path. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

Build and test the positional contract

The engineering question is usually phrased as “Which positional encoding is best?” That question has no task-independent answer. A better process begins by writing the transformations that should preserve the output, the distinctions that must remain visible and the deployment horizon over which both claims must hold.

Open research hypothesis

Models chosen by a matched positional invariance contract will transfer more reliably under shifts and length extension than models chosen by in-range perplexity alone. Evidence would strengthen this proposal if contract scores predicted out-of-range task accuracy across controlled architectures and datasets. It would weaken it if the scores added no predictive value after controlling for optimisation and data. A rival explanation is that observed gains come from easier training rather than preserved structure.

The five tests

The smallest useful assessment can be synthetic. It need not claim to reproduce a large language model. It should expose the positional logic that prose tends to hide.

TestInterventionPositive result permitsNegative result means
Origin shiftAdd the same constant to every position while preserving content and displacement.Claiming positional shift equivariance for the tested comparator.The method treats the origin as causal, intentionally or accidentally.
Distance fidelityVary signed displacement while holding content fixed.Identifying which distances or directions remain distinguishable.Clipping, periodic collision or position blindness has erased a required relation.
Horizon stressEvaluate indices and displacements beyond the training maximum.Showing that the representation and score remain defined and numerically stable.The deployment geometry is unsupported, even before task learning is considered.
Resolution stressCompress or extend the same path and test nearby distinctions.Quantifying the local detail retained after interpolation or scaling.Long reach was purchased by collapsing distinctions the task needs.
Task transferTrain on short instances, then test shifted and longer instances of the same causal rule.Evidence that the full learned system uses the preserved relation.The positional mechanism may be sound while the learned algorithm or data distribution fails.

A controlled experiment that can lower the thesis

The proposed contract becomes scientifically useful only if it can fail. Build four synthetic task families with the same vocabulary and model size. In the absolute-anchor task, the label depends on the token at a named slot. In the offset-copy task, the label depends on a token exactly k positions back. In the ordered-update task, several amendments must be applied in sequence. In the periodic-marker task, the correct output depends on phase within a repeating structure. These tasks require different preserved relations by construction.

Train each positional scheme on lengths 8 to 32 using identical architectures, parameter budgets, batches and random seeds. Evaluate ordinary held-out examples, globally shifted examples within length 32, and length extensions at 64, 96 and 128. Record task accuracy, shift consistency, attention-logit range, distance-confusion matrices and failure by relative offset. Then repeat with position interpolation and with a retrieval system that moves relevant evidence into a short window. Retrieval is a separate configured-system condition, not an invisible rescue.

The contract hypothesis predicts an interaction, not a universal ranking. Absolute position should have an advantage when named slots are causal. Relative or rotary methods should resist origin shifts on offset tasks. A monotone distance bias may help local copying and hurt remote ordered updates. Rotary methods may handle moderate displacement richly while showing periodic confusions at selected ranges. If one method wins every task and intervention consistently, the task-contract account is weakened. If in-range perplexity predicts all out-of-range outcomes as well as the contract measures do, the proposed decision instrument adds little.

The smallest publishable result is therefore a matrix of task requirement by intervention, with confidence intervals over seeds and a declared null policy. This design also exposes the rival explanation. If a scheme wins only because it optimises faster, matching training loss or compute should reduce the difference. If the advantage remains specifically under the transformation it preserves, the symmetry account gains support.

Where to intervene in a configured Transformer
System boundary for testing positional carrier, comparator and task behaviour A sequence enters separate content and position paths. Position feeds a carrier, then the query-key comparator, then attention, residual computation and a task head. Test probes intervene at the carrier, score and output levels. Tokencontent xᵢ Positionindex i Carriertable, phase, none Q/K projectioncontent features Pairwise comparatorabsolute mix, biasor rotation Attention andtask computationlearned behaviour Probe A: carrier coveragenew indices and collisions Probe B: score invarianceshift, distance, resolution Probe C: task transferretrieval and computation
Mechanism tests belong at different boundaries. A carrier probe cannot establish task competence, while a task score alone cannot reveal whether failure came from position, attention or the learned algorithm. Practitioner synthesis and test architecture.

Executable lab: positional comparator microscope

Choose a scheme and vary the training horizon, test horizon and global shift. The lab computes exact properties of a small synthetic comparator. It does not train a language model and does not claim downstream accuracy.

Origin-shift error0.000Lower means the tested score preserves a global shift.
Out-of-table share0%Only a carrier-coverage check.
Distance collisions0Distinct offsets with nearly equal positional score.
Monotonicity breaks0Increases in score as absolute distance grows.
Positional score against relative distance An interactive line chart showing how the selected positional method changes a synthetic attention score as relative distance increases.

RoPE preserves the tested origin shift exactly, but its distance score oscillates. This is expected phase behaviour, not a direct measure of model quality.

The lab tests a fixed pair of content vectors. Learned absolute position adds deterministic synthetic table rows within the training horizon and becomes undefined beyond it. Sinusoidal absolute position adds position vectors before comparison, exposing origin-dependent cross-terms. Relative bias clips distance at sixteen. RoPE rotates query and key pairs at several frequencies. ALiBi applies a monotone distance penalty. NoPE leaves every distance identical in this comparator.

How to use the result

A low origin-shift error permits a narrow claim about the tested score, not the whole network. Few collisions permit finer displacement discrimination under this synthetic probe. Zero monotonicity breaks matters only if the task requires a monotone recency prior. A negative result can reject a scheme whose built-in geometry contradicts a task invariant. No positive result establishes language understanding, long-range reasoning or deployment safety.

Python version of the comparator lab

The script uses NumPy and reproduces the mechanism-level tests. Run it with python positional_contract_lab.py --scheme rope --train 32 --test 96 --shift 17. Use --scheme learned|sinusoidal|relative|rope|alibi|nope to compare methods.

Python · positional_contract_lab.py
import argparse
import math
import numpy as np

Q = np.array([0.8, -0.3, 0.5, 0.1, -0.4, 0.7, 0.2, -0.6])
K = np.array([-0.2, 0.9, 0.4, -0.5, 0.3, 0.1, -0.8, 0.6])


def deterministic_row(position: int, dim: int = 8) -> np.ndarray:
    """Synthetic learned table row. Defined only where the caller permits it."""
    return np.array([
        math.sin((position + 1) * (j + 2) * 1.713)
        + 0.5 * math.cos((position + 3) * (j + 1) * 0.917)
        for j in range(dim)
    ]) * 0.35


def sinusoid(position: int, dim: int = 8) -> np.ndarray:
    out = np.zeros(dim)
    for pair in range(dim // 2):
        theta = 10000 ** (-2 * pair / dim)
        out[2 * pair] = math.sin(position * theta)
        out[2 * pair + 1] = math.cos(position * theta)
    return out


def rotate(vector: np.ndarray, position: int) -> np.ndarray:
    out = vector.copy()
    dim = len(vector)
    for pair in range(dim // 2):
        theta = 10000 ** (-2 * pair / dim)
        angle = position * theta
        c, s = math.cos(angle), math.sin(angle)
        a, b = vector[2 * pair], vector[2 * pair + 1]
        out[2 * pair] = a * c - b * s
        out[2 * pair + 1] = a * s + b * c
    return out


def score(scheme: str, i: int, j: int, train: int) -> float | None:
    delta = j - i
    if scheme == "learned":
        if i >= train or j >= train:
            return None
        return float((Q + deterministic_row(i)) @ (K + deterministic_row(j)))
    if scheme == "sinusoidal":
        return float((Q + sinusoid(i)) @ (K + sinusoid(j)))
    if scheme == "relative":
        return float(Q @ K - 0.12 * min(abs(delta), 16))
    if scheme == "rope":
        return float(rotate(Q, i) @ rotate(K, j))
    if scheme == "alibi":
        return float(Q @ K - 0.07 * abs(delta))
    if scheme == "nope":
        return float(Q @ K)
    raise ValueError(f"Unknown scheme: {scheme}")


def analyse(scheme: str, train: int, test: int, shift: int) -> dict:
    base = score(scheme, 2, 7, train)
    moved = score(scheme, 2 + shift, 7 + shift, train)
    shift_error = None if base is None or moved is None else abs(base - moved)

    values = [score(scheme, 0, d, train) for d in range(1, test)]
    out_of_table = sum(v is None for v in values) / len(values)
    finite = [(d + 1, v) for d, v in enumerate(values) if v is not None]

    collisions = 0
    for a in range(len(finite)):
        for b in range(a + 1, len(finite)):
            if abs(finite[a][1] - finite[b][1]) < 1e-3:
                collisions += 1

    monotonic_breaks = sum(
        finite[n + 1][1] > finite[n][1] + 1e-9
        for n in range(len(finite) - 1)
    )
    return {
        "shift_error": shift_error,
        "out_of_table": out_of_table,
        "collisions": collisions,
        "monotonic_breaks": monotonic_breaks,
    }


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--scheme", default="rope",
                        choices=["learned", "sinusoidal", "relative", "rope", "alibi", "nope"])
    parser.add_argument("--train", type=int, default=32)
    parser.add_argument("--test", type=int, default=96)
    parser.add_argument("--shift", type=int, default=17)
    args = parser.parse_args()
    print(analyse(args.scheme, args.train, args.test, args.shift))

Assumptions encoded: fixed synthetic content vectors, an eight-dimensional carrier, a clipped relative bias at distance sixteen, and no learning. A positive result permits only a mechanism-level statement. A negative result identifies a representational mismatch before expensive training. The script cannot establish empirical accuracy, optimisation ease or behaviour of a specific pretrained model.

Decision matrix for positional contracts
The matrix is not a leaderboard. It exposes break conditions. A method becomes suitable only when its preserved relations match the task and its horizon policy passes configured tests. Decision instrument developed in this paper.

A configured selection protocol

Suppose a team is building a legal-document system. Clauses retain meaning when the document is preceded by a cover sheet, so global shift should usually be irrelevant. Signed order matters because an amendment follows the clause it changes. Exact absolute page location matters only for citations shown to a reviewer, not for semantic matching. The longest expected document is 80,000 tokens, and the system retrieves candidate sections before a bounded reasoning pass.

The contract suggests relative or rotary comparison inside the model, explicit document coordinates in a separate evidence record, and retrieval for horizon control. It also requires an amendment-chain task, not only passkey retrieval. A monotone recency bias may help local drafting but could suppress foundational definitions, so ALiBi would need a long-distance counterexample test. Learned absolute embeddings are unnecessary for semantics but may remain useful in a layout encoder. The answer is a configured architecture, not a universal winning encoding.

Where this proposal should not be applied

The contract does not replace end-to-end evaluation, long-context data, numerical analysis, sparse-attention design, recurrence, retrieval or state management. It is also insufficient for modalities whose position is two-dimensional, graph-structured or continuous unless the transformation group is specified accordingly. Recent group-theoretic work unifies rotary and additive families under broader actions,[14] but algebraic unification still does not choose the task invariant for you.

The evidence conversation
Chart · sequence
sequenceDiagram
  participant Q as Question
  participant M as Mechanism
  participant E as Evidence
  participant D as Decision
  Q->>M: When a location tag becomes a causal assumption
  M->>E: The shuffled telegram
  E-->>M: compare rival explanations
  E->>D: Match positional invariance to causal order
  D-->>Q: revise scope or act
Question, mechanism, evidence and decision exchange the burdens developed in Position, rotation and relative order. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

Match positional invariance to causal order

Do not begin a design review by asking whether the architecture uses absolute embeddings, RoPE, ALiBi or the current long-context extension recipe. Begin with a counterfactual: if every relevant token moves by the same offset, should the result change? Then ask which distances must remain distinct, whether the origin has meaning, how local resolution may be traded for range, and what happens beyond the trained horizon.

From there, inspect the three layers. The carrier must represent the required coordinates. The comparator must preserve the required transformations. The horizon policy must keep those properties useful under deployment lengths. Finally, run a task that requires ordered computation, rather than only distant copying.

Choose the positional method whose tested invariances match the task’s causal structure, then treat every context extension as a change to that contract.

This changes procurement, architecture and evaluation. A model advertising 128,000 tokens no longer receives a single check mark. It receives separate evidence for addressability, score stability, retrieval and computation. A position-scaling patch is no longer a harmless configuration value. It is a resolution decision. A relative method is no longer “better” because it generalises; it is better only when the origin should disappear. An absolute method is no longer “primitive”; it is appropriate when named slots carry meaning.

The durable question is not where the token is. It is which changes of place should leave the model’s judgement unchanged. Once that question is explicit, positional encoding stops looking like a small implementation detail. It becomes what it has always been: the geometry through which a Transformer is allowed to recognise order.