← GeoAFT overview

GeoAFT · Geometric Attention Fine-Tuning · How it works

The idea, the experiments, and the maths

Start with the intuition and the pictures. The precise definitions, controls and full tables are collected at the end.

Lead: Yuhe Sui

Part 1 · The idea

1Why adapt relations?

Inside every attention head, tokens become queries and keys, and a compatibility rule, usually a scaled dot product, decides how strongly each query attends to each key. So a pretrained model has learned two things: representations, and a rule for comparing them.

Parameter-efficient fine-tuning such as LoRA adapts the maps that produce queries and keys. The rule that compares them is inherited unchanged. GeoAFT asks what happens if we adapt that rule instead.

Explainer (draft). About two and a half minutes, silent for now: narration is still to be recorded.

Our working hypothesis is that relations matter most when representations are constrained: frozen or compressed features, small adaptation budgets, or similarity-critical tasks. Where representations are flexible, ordinary fine-tuning may absorb the same change. Either outcome is informative.

Diagram: attention computes token states, projections, representations q and k, a compatibility score s(q,k), and a softmax. Conventional PEFT edits the projections, which changes scores indirectly. GeoAFT adds a trainable term to the compatibility score itself and leaves q and k unchanged. Token states x Projections WQ, WK Representations q, k Compatibility s(q, k) Attention softmax over keys Conventional PEFT W + ΔW (e.g. LoRA: ΔW = BA) changes how q and k are produced GeoAFT s(q, k) + α gφ(q, k) changes how q and k are compared scores change indirectly
Diagram: attention computes token states, projections, representations q and k, a compatibility score s(q,k), and a softmax. Conventional PEFT edits the projections, which changes scores indirectly. GeoAFT adds a trainable term to the compatibility score itself and leaves q and k unchanged. Token states x Projections WQ, WK Representations q, k Compatibility s(q, k) Attention softmax over keys Conventional PEFT W + ΔW changes how q, k are produced GeoAFT s + α gφ(q, k) changes how q, k are compared Q/K edits still move the scores — indirectly, through q and k.
Figure 1. Two places to adapt attention. Conventional PEFT edits the projections that produce q and k. GeoAFT adds a trainable term to the compatibility function and leaves q and k as they are.

2Same points, different relations

Changing the geometry changes what counts as similar. Hold one query and seven keys fixed. The dot product prefers the key furthest along the query’s direction. Euclidean distance prefers the nearest key. Taxicab (L1) distance prefers neighbours along the axes. An anisotropic Mahalanobis metric prefers neighbours along a direction it treats as cheap. The winner changes every time, and no point has moved.

Illustration: one query q and seven fixed keys A–G under four compatibility rules. Dot product favours B, the key furthest along q; Euclidean distance favours the nearest key A; the L1 rule favours the axis-aligned neighbour D; an anisotropic Mahalanobis metric favours F along its cheap direction. Bars show the softmax attention weights. Only the rule changes. Dot product s(q, k) = q · k A B 69% C D E F G q A B C D E F G Euclidean distance s(q, k) = −‖q − k‖2 A 51% B C D 29% E F 16% G q A B C D E F G L1 (taxicab) distance s(q, k) = −‖q − k‖1 A 33% B C D 57% E F G q A B C D E F G Anisotropic (Mahalanobis) s(q, k) = −‖q − k‖M A 36% B C D E F 49% G q A B C D E F G
Illustration: one query q and seven fixed keys A–G under four compatibility rules. Dot product favours B, the key furthest along q; Euclidean distance favours the nearest key A; the L1 rule favours the axis-aligned neighbour D; an anisotropic Mahalanobis metric favours F along its cheap direction. Bars show the softmax attention weights. Only the rule changes. Dot product s(q, k) = q · k A B 69% C D E F G q A B C D E F G Euclidean distance s(q, k) = −‖q − k‖2 A 51% B C D 29% E F 16% G q A B C D E F G L1 (taxicab) distance s(q, k) = −‖q − k‖1 A 33% B C D 57% E F G q A B C D E F G Anisotropic (Mahalanobis) s(q, k) = −‖q − k‖M A 36% B C D E F 49% G q A B C D E F G
Figure 2. Try it. Each panel scores the same query q against the same keys A–G with a different rule. Drag the query, press Animate query, or focus the figure and use the arrow keys. Illustrative toy example, not trained-model behaviour.

3The method in one picture

GeoAFT keeps the pretrained score and adds a small, trainable geometry term on top of it:

Sij=sbase(qi,kj)+αhg¯ϕ(Pqqi,Pkkj),Aij=softmaxj∈𝒱(i)(Sij)
Diagram of the GeoAFT score: the pretrained score of query q_i and key k_j is kept. In parallel, low-dimensional projections feed a structured geometry g_phi, whose output is centred over each row’s valid keys and scaled by a per-head gate alpha_h that starts at zero. The two are added, masked, and passed through one softmax, so at initialization the attention equals the pretrained attention. Query, key qi, kj Pretrained score sbase(qi, kj) Projections Pq q, Pk k Structured geometry gφ (Lp, Mahalanobis, …) Centre over valid keys + Mask, softmax Aij × αh αh = 0 at initialization ⇒ exactly the pretrained attention kept as is
Diagram of the GeoAFT score: the pretrained score of query q_i and key k_j is kept. In parallel, low-dimensional projections feed a structured geometry g_phi, whose output is centred over each row’s valid keys and scaled by a per-head gate alpha_h that starts at zero. The two are added, masked, and passed through one softmax, so at initialization the attention equals the pretrained attention. Query, key qi, kj Pretrained score sbase(q, k) Projections Pq q, Pk k Geometry gφ (Lp, Mahal., …) Centre over valid keys × αh + Mask, softmax Aij αh = 0 at init ⇒ exactly the pretrained attention
Figure 3. The GeoAFT score. A structured geometry branch is centred over valid keys, scaled by a gate that starts at zero, and added before a single softmax.
  • Starts from the pretrained model. Each gate αh is initialized at zero, so training begins from exactly the pretrained attention.
  • Small and structured. What is trained is the geometry itself, a metric, an exponent or a projection, not a generic learned scorer.
  • Leaves representations alone. q and k are not modified, so GeoAFT can be compared directly with matched Q/K adaptation.

Part 2 · The evidence

Tested so far synthetic

  • Recovery of three known target relations: learned Lp, Mahalanobis and a structured nonlinear compatibility
  • Head-to-head against Q/K-LoRA, a fixed geometry bank, generic pair-MLP scorers, projected-dot and exact structural controls
  • The fixed geometry bank on its own: it nearly closes the Lp gap
  • The Mahalanobis equivalence, shown analytically and consistent with the exact control
  • Implementation checks: zero gate reproduces the pretrained attention; masked keys stay out of centring

In progress Not yet reported

  • Real benchmarks: the current method on natural tasks
  • How strongly a score difference is transmitted to the task
  • Compatible measurements of time, throughput and memory
  • Whether geometry offers adaptation capacity that restricted Q/K updates lack

4Synthetic experiments controlled

We first test GeoAFT where the right answer is known. A synthetic teacher generates attention from a known compatibility function over fixed representations, and every method adapts the same frozen dot-product base toward it. The score is oracle-gap recovery R: 0% means no improvement over the base, 100% means matching the oracle. It is not classification accuracy.

Learned Lp

Target: an Lp distance

99.983%

Result. Near-oracle recovery.

Caveat. A fixed Lp geometry bank nearly closed the gap on its own, which left little room to show superiority.

Mahalanobis

Target: a Mahalanobis metric

99.991%

Result. Near-oracle recovery.

Caveat. An exact quadratic control did better. This geometry rewrites a known score family rather than adding capacity.

Structured nonlinear

Target: a nonlinear compatibility

99.934%

Result. 46 trainable parameters fit about as well as a 8,705-parameter PairMLP (99.539%).

Caveat. 15/15 paired wins, but the difference is below the preregistered materiality threshold: economy, not superiority.

On the Lp and Mahalanobis targets, Q/K-LoRA stays 39.9–41.7 points behind GeoAFT at the tested budgets, and the tested pair-MLP scorers 6.4–12.2 points; each range spans both targets.

Chart: for each of the three synthetic targets, every tested method is plotted by trainable parameters and oracle-gap recovery. GeoAFT variants reach the highest recovery on each target with tens of parameters or fewer; on the L_p target a fixed geometry bank is close behind, and on the nonlinear target generic learned scorers come close only with hundreds to thousands of parameters. Learned Lp target 0% 90% 99% 99.9% 99.99% 1 10 100 1k 10k Trainable parameters (log scale) Oracle-gap recovery R DiscreteFixedBank — 1 trainable parameters, R = 99.779% DiscreteFixedBank · fixed_lp_2p5 — 1 trainable parameters, R = 95.324% FixedL2 — 1 trainable parameters, R = 95.320% DiscreteFixedBank · fixed_lp_3 — 1 trainable parameters, R = 93.763% FixedSquaredL2 — 1 trainable parameters, R = 92.064% DiscreteFixedBank · fixed_lp_1p5 — 1 trainable parameters, R = 91.829% DiscreteFixedBank · fixed_lp_3p5 — 1 trainable parameters, R = 91.694% DiscreteFixedBank · fixed_lp_4 — 1 trainable parameters, R = 89.607% FixedL1 — 1 trainable parameters, R = 82.185% FixedCosine — 1 trainable parameters, R = 63.508% ExtraQK — 32 trainable parameters, R = 14.473% GenericPairMLP · pair_mlp_h1 — 35 trainable parameters, R = 85.136% QK_LoRA_rank_sweep · lora_r2 — 64 trainable parameters, R = 29.009% BilinearKeyQuadratic — 65 trainable parameters, R = 92.060% ProjectedDot — 65 trainable parameters, R = 58.405% FullQK — 128 trainable parameters, R = 58.418% QK_LoRA_rank_sweep — 128 trainable parameters, R = 58.326% GenericPairMLP — 137 trainable parameters, R = 87.798% GeoAFT · geo_dot — 1 trainable parameters, R = 58.435% GeoAFT · geo_cosine — 2 trainable parameters, R = 63.508% GeoAFT — 3 trainable parameters, R = 99.983% GeoAFT · geo_rq — 3 trainable parameters, R = 95.250% GeoAFT · geo_mahalanobis_r1 — 18 trainable parameters, R = 92.063% GeoAFT · geo_mahalanobis_r2 — 26 trainable parameters, R = 92.063% GeoAFT · geo_mahalanobis_r4 — 42 trainable parameters, R = 92.063% GeoAFT: 99.983% with 3 parameters Best other: DiscreteFixedBank, 99.779% with 1 Mahalanobis target 0% 90% 99% 99.9% 99.99% 1 10 100 1k 10k Trainable parameters (log scale) DiscreteFixedBank — 1 trainable parameters, R = 81.838% FixedL2 — 1 trainable parameters, R = 79.932% DiscreteFixedBank · fixed_lp_1p5 — 1 trainable parameters, R = 78.945% DiscreteFixedBank · fixed_lp_2p5 — 1 trainable parameters, R = 78.324% DiscreteFixedBank · fixed_lp_3 — 1 trainable parameters, R = 75.821% DiscreteFixedBank · fixed_lp_3p5 — 1 trainable parameters, R = 73.229% FixedL1 — 1 trainable parameters, R = 72.544% DiscreteFixedBank · fixed_lp_4 — 1 trainable parameters, R = 70.862% FixedCosine — 1 trainable parameters, R = 55.259% ExtraQK — 32 trainable parameters, R = 30.702% GenericPairMLP · pair_mlp_h1 — 35 trainable parameters, R = 89.728% QK_LoRA_rank_sweep · lora_r2 — 64 trainable parameters, R = 46.668% ProjectedDot — 65 trainable parameters, R = 60.126% FullQK — 128 trainable parameters, R = 60.129% QK_LoRA_rank_sweep — 128 trainable parameters, R = 60.109% GenericPairMLP — 137 trainable parameters, R = 93.564% GenericPairMLP · pair_mlp_h4 — 137 trainable parameters, R = 93.544% GeoAFT · geo_dot — 1 trainable parameters, R = 51.093% GeoAFT · geo_cosine — 2 trainable parameters, R = 55.259% GeoAFT · geo_rq — 3 trainable parameters, R = 81.450% GeoAFT · geo_lp — 3 trainable parameters, R = 80.066% GeoAFT · geo_mahalanobis_r1 — 18 trainable parameters, R = 99.770% GeoAFT · geo_mahalanobis_r2 — 26 trainable parameters, R = 99.875% GeoAFT — 42 trainable parameters, R = 99.991% GeoAFT · geo_mahalanobis_r4 — 42 trainable parameters, R = 99.991% GeoAFT: 99.991% with 42 parameters Best other: GenericPairMLP, 93.564% with 137 Structured nonlinear target 0% 90% 99% 99.9% 99.99% 1 10 100 1k 10k Trainable parameters (log scale) CanonicalLp — 3 trainable parameters, R = 43.212% AxisWarp — 18 trainable parameters, R = 52.019% KernelMixture — 28 trainable parameters, R = 43.768% Mahalanobis — 42 trainable parameters, R = 87.402% BilinearKeyQuadratic — 65 trainable parameters, R = 87.710% FullQK — 128 trainable parameters, R = 61.171% QKLoRA — 128 trainable parameters, R = 61.131% PairMLP · pair_mlp_h16 — 545 trainable parameters, R = 98.248% NonlinearFeatureLp · feature_lp32 — 554 trainable parameters, R = 98.889% NonlinearFeatureLp — 1,062 trainable parameters, R = 99.323% NonlinearFeatureLp · feature_lp64 — 1,098 trainable parameters, R = 99.323% PairMLP · pair_mlp_h64 — 2,177 trainable parameters, R = 99.284% PairMLP — 8,705 trainable parameters, R = 99.539% GeoAFT — 46 trainable parameters, R = 99.934% GeoAFT · warped_open — 46 trainable parameters, R = 99.934% GeoAFT · warped_zero — 46 trainable parameters, R = 99.932% GeoAFT: 99.934% with 46 parameters Best other: PairMLP, 99.539% with 8,705 GeoAFT Generic learned scorer Structured control Fixed geometry or bank Q/K adaptation
Chart: for each of the three synthetic targets, every tested method is plotted by trainable parameters and oracle-gap recovery. GeoAFT variants reach the highest recovery on each target with tens of parameters or fewer; on the L_p target a fixed geometry bank is close behind, and on the nonlinear target generic learned scorers come close only with hundreds to thousands of parameters. Learned Lp target 0% 90% 99% 99.9% 99.99% 1 10 100 1k 10k Trainable parameters (log scale) Oracle-gap recovery R DiscreteFixedBank — 1 trainable parameters, R = 99.779% DiscreteFixedBank · fixed_lp_2p5 — 1 trainable parameters, R = 95.324% FixedL2 — 1 trainable parameters, R = 95.320% DiscreteFixedBank · fixed_lp_3 — 1 trainable parameters, R = 93.763% FixedSquaredL2 — 1 trainable parameters, R = 92.064% DiscreteFixedBank · fixed_lp_1p5 — 1 trainable parameters, R = 91.829% DiscreteFixedBank · fixed_lp_3p5 — 1 trainable parameters, R = 91.694% DiscreteFixedBank · fixed_lp_4 — 1 trainable parameters, R = 89.607% FixedL1 — 1 trainable parameters, R = 82.185% FixedCosine — 1 trainable parameters, R = 63.508% ExtraQK — 32 trainable parameters, R = 14.473% GenericPairMLP · pair_mlp_h1 — 35 trainable parameters, R = 85.136% QK_LoRA_rank_sweep · lora_r2 — 64 trainable parameters, R = 29.009% BilinearKeyQuadratic — 65 trainable parameters, R = 92.060% ProjectedDot — 65 trainable parameters, R = 58.405% FullQK — 128 trainable parameters, R = 58.418% QK_LoRA_rank_sweep — 128 trainable parameters, R = 58.326% GenericPairMLP — 137 trainable parameters, R = 87.798% GeoAFT · geo_dot — 1 trainable parameters, R = 58.435% GeoAFT · geo_cosine — 2 trainable parameters, R = 63.508% GeoAFT — 3 trainable parameters, R = 99.983% GeoAFT · geo_rq — 3 trainable parameters, R = 95.250% GeoAFT · geo_mahalanobis_r1 — 18 trainable parameters, R = 92.063% GeoAFT · geo_mahalanobis_r2 — 26 trainable parameters, R = 92.063% GeoAFT · geo_mahalanobis_r4 — 42 trainable parameters, R = 92.063% GeoAFT: 99.983% with 3 parameters Best other: DiscreteFixedBank, 99.779% with 1 Mahalanobis target 0% 90% 99% 99.9% 99.99% 1 10 100 1k 10k Trainable parameters (log scale) Oracle-gap recovery R DiscreteFixedBank — 1 trainable parameters, R = 81.838% FixedL2 — 1 trainable parameters, R = 79.932% DiscreteFixedBank · fixed_lp_1p5 — 1 trainable parameters, R = 78.945% DiscreteFixedBank · fixed_lp_2p5 — 1 trainable parameters, R = 78.324% DiscreteFixedBank · fixed_lp_3 — 1 trainable parameters, R = 75.821% DiscreteFixedBank · fixed_lp_3p5 — 1 trainable parameters, R = 73.229% FixedL1 — 1 trainable parameters, R = 72.544% DiscreteFixedBank · fixed_lp_4 — 1 trainable parameters, R = 70.862% FixedCosine — 1 trainable parameters, R = 55.259% ExtraQK — 32 trainable parameters, R = 30.702% GenericPairMLP · pair_mlp_h1 — 35 trainable parameters, R = 89.728% QK_LoRA_rank_sweep · lora_r2 — 64 trainable parameters, R = 46.668% ProjectedDot — 65 trainable parameters, R = 60.126% FullQK — 128 trainable parameters, R = 60.129% QK_LoRA_rank_sweep — 128 trainable parameters, R = 60.109% GenericPairMLP — 137 trainable parameters, R = 93.564% GenericPairMLP · pair_mlp_h4 — 137 trainable parameters, R = 93.544% GeoAFT · geo_dot — 1 trainable parameters, R = 51.093% GeoAFT · geo_cosine — 2 trainable parameters, R = 55.259% GeoAFT · geo_rq — 3 trainable parameters, R = 81.450% GeoAFT · geo_lp — 3 trainable parameters, R = 80.066% GeoAFT · geo_mahalanobis_r1 — 18 trainable parameters, R = 99.770% GeoAFT · geo_mahalanobis_r2 — 26 trainable parameters, R = 99.875% GeoAFT — 42 trainable parameters, R = 99.991% GeoAFT · geo_mahalanobis_r4 — 42 trainable parameters, R = 99.991% GeoAFT: 99.991% with 42 parameters Best other: GenericPairMLP, 93.564% with 137 Structured nonlinear target 0% 90% 99% 99.9% 99.99% 1 10 100 1k 10k Trainable parameters (log scale) Oracle-gap recovery R CanonicalLp — 3 trainable parameters, R = 43.212% AxisWarp — 18 trainable parameters, R = 52.019% KernelMixture — 28 trainable parameters, R = 43.768% Mahalanobis — 42 trainable parameters, R = 87.402% BilinearKeyQuadratic — 65 trainable parameters, R = 87.710% FullQK — 128 trainable parameters, R = 61.171% QKLoRA — 128 trainable parameters, R = 61.131% PairMLP · pair_mlp_h16 — 545 trainable parameters, R = 98.248% NonlinearFeatureLp · feature_lp32 — 554 trainable parameters, R = 98.889% NonlinearFeatureLp — 1,062 trainable parameters, R = 99.323% NonlinearFeatureLp · feature_lp64 — 1,098 trainable parameters, R = 99.323% PairMLP · pair_mlp_h64 — 2,177 trainable parameters, R = 99.284% PairMLP — 8,705 trainable parameters, R = 99.539% GeoAFT — 46 trainable parameters, R = 99.934% GeoAFT · warped_open — 46 trainable parameters, R = 99.934% GeoAFT · warped_zero — 46 trainable parameters, R = 99.932% GeoAFT: 99.934% with 46 parameters Best other: PairMLP, 99.539% with 8,705 GeoAFT Generic learned scorer Structured control Fixed geometry or bank Q/K adaptation
Figure 4. Every tested method on the three synthetic targets. Each point is one method: its trainable parameters against its oracle-gap recovery R. The vertical axis is logarithmic in the remaining gap, so 99%, 99.9% and 99.99% are evenly spaced. Diamonds are GeoAFT variants; the solid ring marks the selected one and the dotted ring the best other method. The dashed line is the Pareto frontier. Hover a point for its details, or a legend entry to isolate that family. Counts are trainable parameters, not inference cost.

Scope. These are controlled synthetic results. Not every registered superiority comparison passed, and recovering a target is not the same as adding capacity. Protocol, controls and full table →

5What the results mean

A geometry update can look different from a weight update and still compute the same function. So before asking whether geometry adaptation helps, we ask which kind of change it is.

  1. Schematic: two different score formulas produce identical attention after softmax. −(q−k)ᵀM(q−k) 2qᵀMk − kᵀMk same attention

    Exact reparameterization

    Established analytically

    The geometry describes a function a conventional scorer already represents. Mahalanobis is the example.

  2. Schematic: a 46-parameter structured geometry and an 8,705-parameter generic scorer fit the same target almost equally well. 46 8,705 near-identical fit

    Economical parameterization

    Supported in controlled experiments

    The same useful interaction, or a close approximation, with far fewer trained parameters.

  3. Schematic: a compatibility pattern produced by a structured geometry that a restricted low-rank Q/K family may not reach. geometry ≠ rank-r Q/K out of reach?

    Distinct adaptation capacity

    Under investigation

    Changes a restricted conventional family cannot reach. Whether this survives downstream is the open question.

6In progress and future directions

Real benchmarks are in progress. Evaluation of the current method on natural tasks is ongoing, and no results from it are reported here. The programme ahead is organised around three research questions.

  1. When is geometry adaptation actually different?

    The aim is not a larger metric menu. Each geometry family will be paired with a containment control that asks whether it can be compiled into an ordinary representation or score update. Theory will separate exact reparameterization, lower-complexity parameterization of an equivalent class, and genuinely distinct capacity.

    Now dotcosineL1 / L2learned LpMahalanobisrational-quadratic

    Next sphericalhyperbolicmixed curvaturelocal metriclearned kerneldynamic geometry

  2. Can geometry become conditional?

    A single global metric will be generalized so that the geometry can depend on the input, layer, head or local statistics, through low-rank coordinate maps, kernel mixtures, local metrics, learned curvature and small selectors. Projected-dot and generic learned-score controls will isolate geometry from added projection capacity or search breadth.

  3. Does it survive beyond attention and under compression?

    In JEPA-style latent prediction, a fixed distance between predicted and target latents will be replaced by a structured, trainable one. The same framework will be studied on encoder, vision and decoder-only models, with model size, token budget, latent dimension, adaptation budget and BF16 → INT8 → INT4 precision as probes. Stronger representations may give geometry more to exploit, or make it redundant because conventional PEFT absorbs the mismatch.

How it will be judged

  1. Tested, syntheticIdentifiability Can the geometry recover a known relation?
  2. PlannedFunctional necessity Does changing the relation improve prediction when features are frozen or constrained?
  3. PlannedComplementarity Do gains survive equal-budget conventional PEFT, projected-dot, fixed-geometry, exact-containment and generic-score controls?
  4. PlannedRegime dependence How do the answers change with architecture, scale and compression?

Experiments will move from controlled targets to geometry-critical frozen-feature, prototype and retrieval tasks, and then to pretrained Transformer, vision and JEPA systems. Model, split, comparator family, search budget, seeds and success margins will be frozen before final testing, and task quality will be reported with trainable and stored state, wall time, throughput and peak memory.

Geometry is unlikely to help uniformly. Similarity-critical, frozen or compressed regimes may benefit, while flexible networks may absorb the same change through ordinary PEFT. Both outcomes are useful: the intended result is a regime map of where adaptation capacity should be allocated.

Part 3 · Technical details

7Notation and definition

For token states xi, one attention head forms queries qi=WQxi and keys kj=WKxj, and scores each pair with the scaled dot product

sbase(qi,kj)=qi⊤kjd,Aij=softmaxj∈𝒱(i)sbase(qi,kj),

where 𝒱(i) is the set of keys that query i may attend to (its causal or padding mask). Most PEFT changes (WQ,WK)→(WQ+ΔWQ, WK+ΔWK) and leaves s unchanged. GeoAFT adds a structured, trainable residual to the score:

Sij=sbase(qi,kj)+αhc(gϕ(Pqqi,Pkkj)−1|𝒱(i)|∑j′∈𝒱(i)gϕ(Pqqi,Pkkj′)),j∈𝒱(i),

with Sij=−∞ for j∉𝒱(i) and Aij=softmaxjSij. Here:

  • Pq,Pk∈ℝm×d are low-dimensional projections into the space where the geometry acts;
  • gϕ is a structured geometry family with parameters ϕ, such as a metric or an exponent;
  • c>0 is a fixed calibration scale, estimated once without labels in the implementation, so the branch starts on a logit scale comparable to the base score;
  • αh is a per-head gate, initialized at 0.

GeoAFT can be used on its own, with WQ and WK frozen, or alongside a conventional Q/K adapter. Comparing those configurations under matched budgets is the point of the experiments.

Development note. The earliest prototype mixed a bank of fixed operators per head through a router initialized at the dot product, then compiled the selection into a static model. Later versions use the gated residual above, which adds a trainable geometry instead of selecting among fixed ones.

8Families, centring and masks

With u=Pqq and v=Pkk, the families used in the controlled experiments are:

Familygϕ(u,v)Trainable ϕRelation to dot-product scoring
Learned Lp−‖u−v‖pexponent p (bounded); optionally projectionsNot a bilinear form in general. With p=1 it can produce centred patterns of maximal rank (§9).
Mahalanobis−(u−v)⊤LL⊤(u−v)factor LSoftmax-equivalent to bilinear plus key-quadratic (§9)
Structured nonlinearcompact nonlinear compatibilitya few dozen parameters (46 in the reported run)Compared against a generic PairMLP scorer

The implementation also includes dot, cosine, L1, squared-L2 and rational-quadratic scores, several of them as reducibility controls rather than candidate contributions. The size of the menu is not the contribution.

Identity at initialization. With αh=0, Sij=sbase(qi,kj) for every pair, so the adapted model computes the pretrained attention exactly, up to floating-point round-off. The research implementation verifies this with tests. This is a property of the implementation, not evidence that geometry adaptation improves prediction.

Support centring. Row-wise softmax ignores a constant added to all valid logits in a row, softmaxj∈𝒱(i)(Sij+bi)=softmaxj∈𝒱(i)(Sij). Centring the geometry branch over 𝒱(i) removes exactly this unidentifiable component. Masked positions are excluded from the mean, so centring never mixes valid and invalid keys.

9Q/K versus score adaptation

Q/K adaptation does change attention scores, through the bilinear form WQ⊤WK. With low-rank updates of rank rQ and rK,

(WQ+ΔWQ)⊤(WK+ΔWK)−WQ⊤WK=WQ⊤ΔWK+ΔWQ⊤WK+ΔWQ⊤ΔWK,

which has rank at most rQ+rK. A structured geometry is not restricted in this way: for N distinct points on a line, the row-centred L1 score matrix [−|xi−xj|] has rank N−1, the maximum possible after centring.

An exact equivalence. Not every geometry is new capacity. Squared Mahalanobis expands as

−(q−k)⊤M(q−k)=2q⊤Mk−k⊤Mk−q⊤Mq,

and the last term is constant within a softmax row, so it cancels. The overlay is softmax-equivalent to a bilinear score plus a key-quadratic bias, a known score family. Squared L2 is the case M=I, and cosine is a dot product of normalized vectors.

These are local statements about one head’s score matrix on fixed representations, not whole-Transformer impossibility results. A score that Q/K cannot reach is not necessarily useful for the task.

10Protocol, controls and full results

The controlled experiments test identifiability: can a method recover a known relation? Each fixes a set of representations and a target compatibility function. Methods are compared in paired cells on held-out synthetic queries and keys, and trainable parameter counts are recorded for every method.

R=Lbase−LmethodLbase−Loracle,L=𝔼iKL(Ai·target‖Ai·method).

Lbase is the loss of the unadapted model and Loracle is the oracle reference loss. Normalizing by the gap makes results comparable across targets whose raw KL scales differ.

ComparatorQuestion it answers
Q/K adaptation (LoRA ranks; full Q/K)Can conventional representation adaptation reach the same relation by moving q and k?
Fixed geometry / geometry bankIs adaptation needed, or does choosing the right fixed geometry already suffice?
Generic learned scorer (pair-MLP)Is the gain due to structure, or just to added nonlinear capacity?
Projected-dotIs the gain due to the extra projections Pq,Pk rather than to the geometry acting on them?
Exact structural controlsDoes the family add anything beyond its known equivalent score family (§9)?
TargetComparisonResultQualifier
Learned Lp and MahalanobisGeoAFTR = 99.983% (Lp); 99.991% (Mahalanobis)Near-oracle recovery on both targets
vs Q/K-LoRAGeoAFT ahead by 39.9–41.7 percentage points of RRange across the two targets; at the tested budgets
vs tested pair-MLPsGeoAFT ahead by 6.4–12.2 percentage pointsPositive in all 25 paired cells on each target
vs fixed geometry and exact controlssee qualifiersThe fixed Lp bank nearly exhausted the Lp oracle gap. The exact quadratic control outperformed the Mahalanobis overlay.
NonlinearGeoAFT (46 trainable parameters)R = 0.999342915/15 paired wins for GeoAFT. The 0.40-percentage-point difference in R is below the preregistered materiality threshold. About 189× fewer trainable parameters than the tested PairMLP.
PairMLP (8,705 trainable parameters)R = 0.9953917

Comparison rules and success margins were fixed before final testing. Not all registered superiority gates passed: the three caveats in §4 are the gates that did not.

11Limitations

  • Synthetic scope. The results recover known relations on fixed representations. They are not natural-task results, and they say nothing about state-of-the-art performance.
  • Natural tasks. Earlier natural-task experiments with previous versions of the method were negative. On hierarchical text classification and a GLUE MRPC replication, tuned Q/K-LoRA and full Q/K adaptation outperformed GeoAFT. Later coordinate-based variants did not exceed matched continued-training controls. This is why the project now asks when geometry adaptation helps rather than whether it helps in general.
  • From score to task. A score change that Q/K cannot represent can still be erased by the value and output path, so non-absorbability in the score matrix does not imply task usefulness.
  • Efficiency. Trainable-parameter counts are not inference cost. No accuracy–compute frontier is claimed until compatible measurements of time, throughput and memory are complete.

12Sources

Accepted Research

Related projects

AI Native Workflow, GeoAttention

The numbers on this page and in the figures come from the project’s current evidence summary. Each quantity is stored once in the figure-generation data, so the page and the figures cannot drift apart.

Back to top ↑