Can AI Mature a Model's Geometry? Training-Free Weight Baking in LLMs
Authors: Amin Golnari, Saeid Sanei
Organizations: College of Engineering & Computer Science, VinUniversity, Hanoi, Vietnam. · College of Health Science, VinUniversity, Hanoi, Vietnam · Institute of Psychiatry, Psychology & Neuroscience, King’s College London, UK.
Can an AI make a trained language model more mature, in the sense of a better organized latent space, by looking only at the geometry of that space? An analyst model reads a fixed-size digest of topological descriptors of the layers of a frozen target and proposes a transformation, which closed-form ridge regression writes into the feed-forward weights without gradient training. Using lightweight models, 126 runs show that category purity rose on unseen words and sentences, benchmark accuracy stayed within sampling error, and the analyst matched a category-aware heuristic with gentler edits. In a five-model round robin approach, 16 pairs raised purity and four left the target unchanged. The results provide a baseline for future work on LLM-guided, training-free model editing without using raw weights.
Figures & tables
Figure 1: Conceptual illustration of the proposed approach. (a) Before the edit, the probe representations of block ℓ lie on a folded sheet: the three categories are intermixed, the directions fall in a narrow cone (high anisotropy κ ), and a spurious loop ( H1 ) is present. The analyst answers with an affine map Tℓ , which closed-form ridge regression writes into the feed-forward weights (shaded cells: changed entries). (b) For the same inputs, the baked block gives separated categories on a flatter sheet and a wider cone, without any temporary intervention. Bottom: blocks are edited in order, each described after all upstream edits are baked. ID: intrinsic dimension.
Descriptor
Plain-language meaning
How it is computed
Purity P
How many of a word’s nearest neighbors belong to its own category; high means clean groups.
Mean, over words, of the share of the K nearest neighbors with the same label.
Silhouette S
How much closer a word is to its own category than to the other categories.
Mean silhouette under cosine distance.
Anisotropy κ
How narrow a cone the vectors fill; high means a few directions dominate.
Mean pairwise cosine similarity of the word vectors.
Category-pair conflation
How often words of two categories are each other’s neighbors; high means the two are mixed.
cross(a,b)=21(ρab+ρba) , where ρab is the mean share of the neighbors of words in a that belong to b .
Intrinsic dimension
How many independent directions the point cloud actually uses.
Two-NN estimate N/∑iln(ri(2)/ri(1)) from first- and second-neighbor distances.
Betti number β0
How many separate pieces the point cloud falls into.
Connected components in the persistent homology of the cosine-distance filtration, at the 25th percentile of pairwise distances.
Table 1: Descriptors in the digest. K=8 nearest neighbors under cosine distance; full definitions in Appendix B.6 .
Quantity
Per edit
Cumulative
KL to the original model
≤0.05
≤0.30
Guard-set perplexity
≤+2%
≤+5%
CKA to the original model
≥0.95
–
Mean relative feature change
≤0.20
–
Relative weight change
≤0.10
–
Table 2: Main acceptance limits, checked in the intervention test and on the baked model (the weight budget on the baked update only). KL: Kullback–Leibler divergence to the original model, in nats per token.
Qwen
SmolLM2
Digest
ΔP
KL
ΔP
KL
(i) P , S
.010–.021
.09–.11
− .003–.000
.07–.14
(ii) + κ
.004–.016
.08–.09
.001–.007
.09–.17
(iii) + ID, Betti
.020–.027
.08–.10
.001–.009
.07–.14
(iv) Full
.020–.029
.09–.10
.010–.012
.08–.10
Table 4: Descriptor ablation, LLM arm: range over three seeds of the purity change under [D] and of the cumulative KL (nats per token). Each level adds descriptors to the level above it. ID: intrinsic dimension.
Arm
Mode
ΔP
CKA t
KL
ΔPPLh
ΔHS
LLM
Seq.
.010–.029
.96–.99
.08–.10
6–9
− .01–.01
LLM
Par.
.004–.029
.90–.92
.70–1.23
104–185
− .09–.01
Heur.
Seq.
.009–.029
.94–.98
.11–.12
5–9
− .04–.01
Heur.
Par.
− .107– − .037
.48–.58
3.97–5.56
> 4,000
− .26– − .20
Table 5: Sequential versus parallel mode: range over six runs per arm. ΔP : purity change under [D] ; CKA t : guard-token CKA; KL: cumulative KL (nats per token); ΔPPLh : held-out perplexity change (%); ΔHS : HellaSwag change.
Target
Analyst
Gemma
Llama
Phi
Qwen
SmolLM2
Mean
Gemma
–
.016 (20)
.022 (21)
.029 (13)
.011 (13)
.019
Llama
.010 (6)
–
.010 (20)
.022 (18)
.014 (13)
.014
Phi
0 (0)
.005 (27)
–
.007 (21)
.007 (9)
.005
Qwen
0 (0)
.033 (1)
.003 (1)
–
.006 (1)
.010
SmolLM2
0 (0)
.002 (10)
.018 (7)
.000 (2)
–
.005
Table 6: Round robin (default configuration, seed 0): purity change under [D] over the edited layers for every analyst (rows) and target (columns), with accepted edits in parentheses. “0 (0)”: no accepted edit (the two SmolLM2 edits on Qwen were neutral). Means count an unchanged target as zero.
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 2: The sequential regeneration cycle of topology-aware weight baking. For block ℓ , the current target is probed, and the descriptors of its feature space are summarized as a fixed-size digest (steps 1–5). The proposer supplies a list of operations, which the system simulates at six strengths and tests through a temporary intervention on the layer output (stage one, steps 6–8). In the LLM arm, a proposal that fails stage one is sent back to the analyst with the simulated numbers of the proposal as written ( α=1 ) and, if an intervention test ran, the measurements of the last strength tested; at most three analyst proposals are made per layer. In the heuristic arm, the next attempt uses fewer category pairs, and in the hybrid arm, the heuristic follows the analyst. If no proposal passes, the two best stored weak proposals of each origin are re-tested at a relaxed gain threshold without a new analyst query. A proposal that passes stage one is baked by closed-form ridge regression and re-tested on the baked model (stage two, steps 9–10); if a limit fails, the weights are reverted and the edit is baked again at half and at a quarter of its strength. If all limits pass (solid green arrow), the baked weights are kept and the cycle restarts at block ℓ+1 on the regenerated model. ID: intrinsic dimension; β0/β1 : Betti numbers.
Model
Main study
Hugging Face repository
L
d
dk
Params (M)
Gemma-2-2B
Analyst
unsloth/gemma-2-2b-it
26
2304
9216
2,614
Qwen2.5-1.5B
Target
Qwen/Qwen2.5-1.5B-Instruct
28
1536
8960
1,544
SmolLM2-1.7B
Target
HuggingFaceTB/SmolLM2-1.7B-Instruct
24
2048
8192
1,711
Llama-3.2-3B
–
unsloth/Llama-3.2-3B-Instruct
28
3072
8192
3,213
Phi-3-mini
–
microsoft/Phi-3-mini-4k-instruct
32
3072
8192
3,821
Appendix
Table 7: Models of the round-robin pool. Main study: role in the 126 runs of the main study; in the round-robin study, every model is the analyst of the four others and a target of each of them. L : number of transformer blocks; d : residual width; dk : input width of the feed-forward output projection. Parameter counts include embeddings. A model is loaded in bfloat16 as analyst and in 32-bit floating point as target.
Figure 3: Propagation of upstream edits, shown for the Qwen target edited in the LLM arm (seed 0). Purity on probe words for each layer of the original target (dashed) and of the final edited target (solid). Diamonds mark the 13 layers with an accepted edit (1–8, 12, 19–21, and 27). The 15 layers without an accepted edit (shaded) end 0.016 to 0.056 above the original value, because the edits of earlier blocks change the input of every later block.
Quantity
Limit
Operations per edit
≤4
Mean relative feature change
≤0.20
Gain ΔP+ΔS
≥0.01 ( 10−6 relaxed)
KL per edit; cumulative (nats per token, guard set)
≤0.05 ; ≤0.30
Guard-set perplexity, per edit; cumulative
≤+2% ; ≤+5%
Per-edit layer CKA (probe words, guard tokens)
≥0.95
Appendix
Table 13: Acceptance limits. All limits are checked in the intervention test and on the baked model, except the weight budget and the HellaSwag monitor, which apply to the baked update only. KL: Kullback–Leibler divergence to the original model.
Arm
Target
Proposer and stage
Seed
Edits
Tsep
Tpcs
LLM arm
Qwen
analyst, strict
0
3
1
2
1
7
0
7
2
8
0
8
analyst, relaxed
0
10
10
0
1
13
13
0
2
15
13
2
Appendix
Table 15: Operations in the accepted edits of the sequential default runs of the LLM and hybrid arms, by proposer and stage of acceptance, for every seed. Strict: gain ≥0.01 ; relaxed: gain ≥10−6 . Tsep , Tpcs : numbers of accepted centroid-axis scalings and principal-component rescalings.
Target
Threshold
Seed
Ed.
ΔP[A]
ΔP[D]
ΔS[D]
CKA w
KL
ΔPPL
Qwen
≥0.005
0
11
0.0334
0.0328
0.0120
0.900
0.100
7.03
1
10
0.0373
0.0304
0.0142
0.872
0.107
7.95
2
10
0.0332
0.0184
0.0087
0.868
0.076
5.67
≥0.01
0
10
0.0342
0.0344
0.0131
0.917
0.091
6.27
1
8
0.0358
0.0296
0.0126
0.889
0.089
6.17
2
8
0.0333
0.0228
0.0108
0.892
0.062
4.64
Appendix
Table 23: Gain-threshold ablation, heuristic arm, every run (sequential; 18 runs of the gain-threshold study). The relaxed stage is switched off so that the threshold binds. Columns as in Table 21 .
Target
Categories
Seed
Ed.
ΔP[A]
ΔP[D]
ΔS[D]
CKA w
KL
ΔPPL
Qwen
4
0
19
0.0159
0.0200
0.0339
0.773
0.067
8.21
1
16
0.0376
0.0325
0.0228
0.795
0.076
6.46
2
15
0.0310
0.0349
0.0463
0.857
0.084
6.14
8
0
13
0.0239
0.0287
0.0235
0.897
0.089
6.45
1
20
0.0269
0.0196
0.0484
0.935
0.086
6.96
2
23
0.0156
0.0264
0.0453
0.919
0.104
8.72
Appendix
Table 24: Category-count ablation, LLM arm, every run (sequential; 18 runs of the category study). The first 4, 8, or 16 categories of the probe vocabulary are used (700, 1,359, and 2,369 probe words; 175, 341, and 595 unseen words). Columns as in Table 21 .
Target
Categories
Seed
Ed.
ΔP[A]
ΔP[D]
ΔS[D]
CKA w
KL
ΔPPL
Qwen
4
0
21
0.0551
0.0821
0.0696
0.798
0.112
13.81
1
19
0.0520
0.0454
0.0584
0.796
0.119
14.15
2
19
0.0563
0.0535
0.0649
0.781
0.115
13.59
8
0
23
0.0344
0.0285
0.0158
0.837
0.115
8.14
1
21
0.0315
0.0235
0.0153
0.849
0.110
8.05
2
20
0.0360
0.0162
0.0110
0.812
0.108
8.26
Appendix
Table 25: Category-count ablation, heuristic, every run (sequential; 18 runs of the category study). Columns as in Table 21 .
β0↓
β1↓
ID
Target
Arm
Seed
orig.
edited
orig.
edited
orig.
edited
Qwen
LLM arm
0
6.6
4.2
2.6
2.5
21.3
21.3
1
8.1
4.2
4.2
3.2
19.1
18.7
2
6.6
3.1
4.0
2.6
20.6
21.0
Heuristic
0
9.5
5.4
2.8
2.4
21.0
21.2
1
7.7
4.4
4.3
3.0
19.1
18.8
Appendix
Table 29: Topological descriptors under condition [D] for every default sequential run, in the original and in the edited model (mean over the edited layers and over the three unseen templates; class-balanced subsample of 279 unseen words). β0 , β1 : Betti numbers at the 25th percentile of the pairwise cosine distances of the respective model; ID: Two-NN intrinsic dimension.
Work
Input to the editor
Edit target
Fitted component
Weight-Space Programming [ 6 ]
Raw weights as text (with tools at 0.8B parameters)
Weights, for a behavioral goal
None (no gradient training)
ROME [ 4 ]
One factual association
One feed-forward weight, rank one
Closed-form update
LEACE [ 5 ]
Concept labels
Linear map that erases one concept
Closed-form map
Activation steering [ 24 , 3 , 25 ]
Contrast activations or probes
Hidden states at inference
Probes in [ 24 ] ; none (mean difference) in [ 3 , 25 ]
Curveball steering [ 30 ]
Activation geometry
Hidden states, nonlinear
Kernel PCA on activations
Riemannian-manifold steering [ 31 ]
Output distances
Hidden states along geodesics
Learned encoder
Appendix
Table 36: Attributes of the closest reviewed works, as stated in their abstracts or main text. “Fitted component” indicates what, if anything, the method fits.
Language models are trained once, frozen and deployed: improving one again takes another training run, and a prompt, a scaffold or extra computation at inference is gone once the task ends. A frontier model has been shown to edit the weights of a much smaller one. We ask whether a model can rewrite its own weights to make itself better, and find that it can, by its own reasoning, with no gradients and no training; we call this self-rewriting. Given its weights, graded answers and the ability to run itself, a 27B model diagnoses its failure and edits the weights behind it. It surpasses itself: its own edit makes it 6.6 points more accurate on 490 problems it never saw, in a test fixed in advance, and another session's edit also makes it significantly better. It keeps getting better: it submits an edit only when its own tests support it, each edit replacing the last, and over its first eight such sessions its accuracy only rises. Unlike test-time scaling, the gain persists in its weights and adds no cost per answer; unlike training, it needs no pre- or post-training infrastructure, only an open model and hours on one GPU. It repairs a damaged copy of itself: it locates the corrupted matrix and rewrites it with values of its own, never reading the undamaged weights; found on text math problems alone, the repair lifts the copy on six image benchmarks it never saw from 7% to 70% accuracy, 83% of the undamaged model's. And the ability emerges with scale: across four sizes of one family, the 2B model makes no edit and the 4B and 9B models break themselves; only the 27B model works on itself as a human would, comparing its hidden states on answers that finish and on answers that run out of tokens, weakening the direction that separates them. Like a human, a model need not separate training from inference; improving a language model may come to take a conversation rather than a training run.
Given a large language model (LLM), can whoever holds the weights name a semantic target (e.g., the model's identity), locate the model components that produce it, and edit them so that the target no longer appears while other capability is preserved? We call such an edit on a trained model a post-edit. We present L2W (latents to wires), a framework that performs surgical post-edits for named semantic targets. For localization, L2W uses Jacobian lens (J-lens) attribution to score components against the semantic target. For surgical removal, because LLM mechanisms are redundant (i.e., a semantic target may have multiple components producing it), L2W runs Counterexample-Guided Causal Cut (CGCC) until the target no longer appears. CGCC first cumulatively closes model components, treating each surviving expression of the target as a counterexample that exposes the next components to close, and then reopens some of them to preserve capability. In a controlled experiment with an implanted behavioural watermark, L2W removes the watermark, and its localization lands on the model region the implant changed. Across three model configurations, L2W removes model-metadata (e.g., identity) self-claims in all nine runs, and adult-content refusal in all three, with no held-out target residual. L2W further composes two post-edits on a text-to-image model: one removes the refusal of requested nudity, and a second removes the nude rendering the first exposes. The results support post-editing as a complement to post-training: post-training installs preferred behaviours, and post-editing removes named unwanted ones.
Standard neural architectures such as the Transformer were chosen because they train well with gradient descent and run fast on GPUs. In weight-space programming, a large language model (LLM) writes target weights by hand without gradient-based training, so those reasons no longer apply. Should we keep the Transformer? Given minimal guidance, ten labeled examples, and a sandbox, mainly on multiple-choice questions, we task three frontier LLMs with either generating the weights of a fixed architecture or designing the architecture themselves. When free to design, all three compile plain-text facts into a sparse table queried by a fixed procedure, reaching up to 54.4% test accuracy. An LLM-designed model achieves higher test accuracy than the most accurate released Transformer that the same LLM wrote while using about 1,800x fewer parameters. Without gradients, they choose a table, in which the LLM can state what each weight means and can find and rewrite a wrong one. Each wrong answer points to one row, and removing a row changes about one other answer. From this, we propose an associative-memory-based model up to 17x faster on GPUs than a same-sized Transformer. We also test pretrained weights, other benchmarks, and tasks where models generate answers. Pretrained LLMs remain more accurate; the claim concerns which structure to build when writing weights.
Hyunjong Ok, Jaeho Lee
Pohang University of Science and Technology (POSTECH)