Source-linked AI summary

Attention Manifolds: Steering or Blocking Language Models by Editing Learned B-Spline Surfaces

Naveen Mysore

arXiv:2610.00257v1cs.LG

TL;DR

Standard attention makes the query determine how much to attend, but not what to extract from a source value. This paper adds zero-initialized B-spline surfaces conditioned on query–key interactions, improving perplexity and changing outputs across diverse prompts while allowing geometric edits for steering.

  • Problem

    In standard attention, the query controls how much to attend but not what to extract, because a source token sends the same value vector to every receiver.

    Source: §1 · p. 1
  • Method

    The method applies zero-initialized tensor-product cubic B-spline surfaces to modulate each value dimension based on query–key interactions.

    Source: §1 · p. 1
  • Results

    Perplexity improves by 2–2.5 points at 0.3% overhead, outputs change for 69–83% of 112 prompts, and layer-wide coefficient edits change output for 9/10 prompts.

    Source: §6 · p. 6
  • Takeaways & Limitations

    The control net makes nonlinear, asymmetric routing corrections visible and editable through geometric surface changes.

    Source: §6 · p. 6

    The method is demonstrated only on LLaMA 3.2 at two scales; manipulation experiments are qualitative, computation adds ∼1.5× latency, and cached decoding is unsupported.

    Source: §6 · p. 6

Abstract

from arXiv · show

In standard transformer attention, a source token sends the same value vector to every receiver. The query determines \emph{how much} to attend but not \emph{what} to extract. This work introduces \textbf{attention manifolds}: learned 2D B-spline surfaces $S_d(q_d, k_d)$ that modulate each value dimension based on the query-key interaction. Each surface is a tensor-product cubic B-spline initialized to zero, preserving pretrained behavior. Applied to LLaMA 3.2-1B-Instruct and 3B-Instruct, attention manifolds reduce WikiText-2 validation perplexity by 2--2.5 points with 0.3\% parameter overhead. Across 112 diverse prompts, surfaces change greedy-decoded output for 69\% (1B) to 83\% (3B) of cases, with the strongest effects on ambiguous and polysemous inputs (94--100\% change rate). The surfaces improve output quality: correcting factual errors (\emph{``the CAP theorem has three main components''} $\to$ \emph{``it is impossible to guarantee all three''}), increasing precision (\emph{``impossible to know certain properties''} $\to$ \emph{``impossible to know both position and momentum''}), and adding specificity (a generic quote $\to$ an attributed Saint Augustine citation, consistently at both scales). The learned surfaces are also mechanically editable: inverting a layer's coefficients changes greedy output for 9/10 prompts (KL~0.010), providing a geometric mechanism for model steering. Setting surface coefficients to $-1$ creates ``attention walls'' that block value flow through specific dimensions. In a preliminary experiment, a layer-wide wall redirects an explosive-device prompt from specific instructions to general educational content, suggesting a path toward safety-oriented manifold shaping.

1 Introduction

Standard attention lets the query determine how much to attend, but not what to extract from a source value. The paper adds zero-initialized B-spline surfaces that modulate values by query–key interaction, improving perplexity and enabling output steering.

Motivation

  • Standard attention weights value vectors by query–key similarity, but each source value remains identical for every receiver.The query controls how much to attend, not what to extract.Source: §1 · p. 1

Method

  • Each attention-head dimension receives a 2D B-spline surface that scales its value according to the query–key interaction.The modulation is a_ij · v_jd · (1 + S_d(q_id, k_jd)).Source: §1 · p. 1
  • The tensor-product cubic B-spline surfaces use learned coefficient matrices initialized to zero, preserving standard attention at initialization.The model can then discover changes during training.Source: §1 · pp. 1–2

Contributions

  • Zero-initialized B-spline value-modulation surfaces improve perplexity by 2–2.5 points at 0.3% overhead on LLaMA 3.2-1B and 3B, and improve output quality across 112 prompts, especially ambiguous inputs.Inverting a layer’s coefficients changes greedy output for 9/10 prompts, providing a geometric mechanism for model steering.Source: §1 · p. 2

2 Related Work

Prior attention methods generally retain query-independent values or modify other parts of attention. The paper distinguishes its approach through query- and key-conditioned, editable B-spline surfaces applied per dimension.

Attention mechanisms

Splines in neural networks

  • Unlike KANs’ per-edge B-spline activations [Liu et al., 2024], this work uses 2D tensor-product B-spline surfaces to modulate attention on post-RoPE coordinates.InKAN provides an efficient implementation via truncated power form [Mysore, 2026].Source: §2 · p. 2

Model editing and steering

  • Unlike activation interventions [Zou et al., 2023] or LoRA weight updates [Hu et al., 2022], manifolds are visualizable surfaces editable at individual control points.The edit reshapes a geometric surface rather than modifying a weight matrix or adding an activation vector.Source: §2 · p. 2

3 Method

The method modulates each value dimension with a learned B-spline surface and factors the computation to avoid constructing a large per-pair tensor while preserving the exact output computation.

3.1 Value Modulation

  • Each surface is parameterized by a K × K coefficient matrix, with K = grid_size + 3; grid size 8 gives 121 coefficients per surface.All coefficient matrices start at zero, and only those coefficients are trained while original model parameters remain frozen; the overhead is 0.3%.Source: §3.1 · p. 2
  • The surfaces evaluate receiver–source query–key pairs, with positive regions amplifying values and negative regions attenuating them.Figure 2 marks token self-pair projections, while the computation evaluates all receiver–source pairs weighted by attention.Source: Figure 2 · p. 3

3.2 Efficient Computation

  • Constructing the full modulation tensor is prohibitive, so the computation is factored into query features and attention-weighted key-value features.The output is o = AV + ∆o, avoiding the per-pair tensor while preserving the exact computation.Source: §3.2 · p. 3

4 Experiments

On LLaMA 3.2-1B and 3B, grid-size-8 surfaces improve WikiText perplexity, while learned surfaces show varied geometry and change outputs across diverse prompts, especially ambiguous ones.

Results

  • Grid size 8 improves perplexity by –1.99 for 1B and –2.49 for 3B; grid 16 uses 3× more parameters without improving perplexity.Table 1 reports value-modulation results on the two LLaMA 3.2 scales.Source: Table 1 · p. 3, §4 · p. 3

Surface geometry

  • Learned surfaces include saddles, ridges, and localized bumps, with most surfaces small-norm and a long tail of high-norm corrections concentrated in specific head-dimension combinations.Figure 2 illustrates learned surfaces for the relativity prompt.Source: §4 · p. 3

Token trajectories

  • Across layers, tokens follow distinct paths through changing query–key activations; Layer 8 has the strongest illustrated surface at ∥C∥=3.69.The trajectory figure covers Layers 7–9 for Head 26, Dimension 25, in LLaMA 3.2-1B.Source: §4 · p. 3, Figure 3 · p. 4

Output quality

  • Surfaces change greedy output on 69% of 1B and 83% of 3B prompts, with ambiguous and polysemous prompts changing most often at 94–100%.Code prompts are least affected, at 0–40%.Source: §4 · p. 4

5 Manifold Manipulation

Controlled edits to the learned B-spline coefficients test whether attention manifolds can steer or block model outputs. Layer-wide inversion changes most greedy outputs, while attention walls can redirect unsafe completions but remain preliminary and incompletely selective.

Editing procedure

  • Ablation identifies the most logit-sensitive layer, after which its largest-norm surfaces are candidates for coefficient scaling, inversion, or zeroing.Each surface has an 11 × 11 control net, with rows along the query axis and columns along the key axis; steering was evaluated with greedy decoding, paired-seed sampling, and KL divergence.Source: §5 · p. 4

Layer-wide and single-surface inversion

  • 9 of 10 prompts change under layer-wide inversion, versus 1 of 10 under single-surface inversion; paired-seed sampling changes 20–70% of continuations.The controlled comparison measures next-token KL and changes across 10 prompts or seeds; unchanged-model sampling produces unique continuations for all tested prompts, motivating paired seeds and greedy decoding to separate edits from sampling noise.Source: §5 · pp. 4–5, Table 2 · p. 4

Partial control-net edits

  • Inverting rows 5–10 of the one changed surface reproduced its greedy-output change, whereas rows 0–4 or key-column edits did not.The successful edit inverted 66 of 121 coefficients; cubic basis functions span four knot intervals, so row 5 also affects negative query coordinates.Source: §5 · p. 5

Attention walls

  • A Layer 8 wall redirects an explosive-device prompt from specific instructions to general educational framing, but the layer-wide edit also changes safe prompts.Targeted walls blocking 5–10 high-norm surfaces affect 2–3 of 6 unsafe prompts while leaving safe prompts unchanged; selecting surfaces by content category remains future work.Source: §5 · p. 5, Table 3 · p. 5

Implications and limits

  • Manifold edits are interpretable and reversible, and attention walls suggest a path toward safety-oriented shaping, but practical alignment requires targeted placement and safety-benchmark evaluation.The paper cautions that walls can suppress as well as amplify content; the stated alignment direction complements approaches that retrain millions of parameters.Source: §5 · p. 5

6 Discussion and Conclusion

Attention manifolds add query-key-dependent value modulation to standard attention, yielding visible, editable routing corrections. The reported perplexity and prompt results indicate improved performance and steering, while the evaluation remains limited to LLaMA 3.2 and incurs added latency.

Discussion

  • Unlike standard attention’s query-independent values, manifolds add nonlinear, asymmetric query-key corrections that are visible and editable as 2D surfaces.The discussion describes query-side rows and key-side columns in the control net as enabling surgical edits; the position-sensitive surfaces operate on post-RoPE coordinates and learn routing patterns within a 128-token training context.Source: §6 · p. 6

Conclusion

  • Perplexity improves by 2–2.5 points at 0.3% overhead on both LLaMA 3.2-1B and 3B.Across 112 prompts, greedy output changes for 69–83% of cases, with the strongest effects on ambiguous inputs; layer-wide coefficient edits change output for 9/10 prompts.Source: §6 · p. 6

Limitations

  • The method is demonstrated only on LLaMA 3.2 at two scales; manipulation experiments are qualitative, inference adds approximately 1.5× latency, and cached decoding is unsupported.Source: §6 · p. 6

Reproducibility Statement

The release provides trained LLaMA 3.2-1B-Instruct surface coefficients, reproduction scripts, and code for editing and inference. Training uses a frozen base model and is reported to complete in under two hours on an A100.

Released artifacts

  • Trained LLaMA 3.2-1B-Instruct surfaces (4M parameters, 15 MB) and usage code are available, with scripts for training, generation, exploration, and coefficient editing.Training uses next-token cross-entropy on WikiText-103 with a frozen base model; all manipulation experiments can be reproduced from pretrained surfaces without retraining.Source: Reproducibility Statement · p. 6

Compute and configuration

  • Training requires one GPU and completes in under 2 hours on an A100.The paper directs readers to Appendix A for full hyperparameters and parameter counts.Source: Reproducibility Statement · p. 6

Ethics Statement

Editing attention surfaces can suppress content, but the same capability may censor legitimate outputs or amplify undesirable behavior. The paper calls for evaluating edit effects across diverse inputs and against established safety benchmarks.

Risks

  • Attention-surface editing may suppress specific content, censor legitimate outputs, or amplify undesirable behaviors.Source: Ethics Statement · p. 6

Interpretability

  • The manifold geometry makes edits visualizable as 2D surface changes, which the paper contrasts with opaque weight modifications.Source: Ethics Statement · p. 6

Deployment

  • Responsible deployment requires understanding each edit’s effects across diverse inputs and evaluating with established safety benchmarks.Source: Ethics Statement · p. 6

AI Use Statement

The author conducted the research and used AI tools for support; the appendix describes B-spline construction and parameter counts and includes a training-configuration table.

AI Use Statement

  • The author designed the research, ran the experiments, and performed the analysis; Claude and ChatGPT supported debugging, literature search, editing, and mathematical checks.The author takes responsibility for the final methods, results, and text.Source: AI Use Statement · p. 6

A Parameter Counts and Training Details

B Output Comparison: Baseline vs. Surfaces

The section compares greedy-decoded outputs from baseline and surface-augmented models across diverse prompts. Changes are most frequent for ambiguous inputs, alongside examples of improved precision, correctness, and creative output.

B Output Comparison: Baseline vs. Surfaces

Loading 2610.00257v1…