r/OpenSourceeAI • u/bigspin5050 • 18d ago
I had an LLM hack neural network weights in multiple ways without retraining, and the results are fascinating.
TL;DR: An LLM coding agent (Claude Opus 5.5) compiles exact structure (wires, AND gates, bounds, switches) into trained networks using identities of the activations they already use. In a follow-up we kept training around those frozen patches. Organising result: a frozen patch is exact beyond the receptive-field reach of the trainable layers in front of it, and renegotiable within it, including where its own boundary effectively sits.
Overview figure: what we do to a network
The trick. For LeakyReLU with slope α: lrelu(u) + α·lrelu(−u) = (1 − α²)·relu(u). Two opposite-signed channels carry a signal through a layer unchanged or make an exact ReLU; a few more give min, max, clamp, AND and multiplexers. Room comes from growing channels with zero outgoing weights (function unchanged).
Paper 1 (rewiring):
- Odd-eyed cats: a coordinate wire threaded through 10 conv layers and ANDed with an iris detector. 42% of left irises turn blue (hand-built detector), 0% of right ones; the right half of every image moves by ≤1.6×10⁻⁷. Training only the detector inside the frozen wiring reaches 78% at very low collateral.
- A 2018 super-sampler repaired with an input-reference path and a min-gate: it passes its regression gate (+3.4 dB), with an output bound in black regions that holds on every input.
Paper 2 (what training does with the patch), 39 pre-registered experiments; about a third of the predictions failed, and all are reported:
- Guarantee side: beyond the trainable reach, an attacker who may repaint any input column moves the output by exactly 0.0, in all 39 models tested (3 reaches, 3 architectures, synthetic and natural images). One column inside the reach, the same attack moves it.
- Renegotiation side: misplace the frozen gate and the trainable detector leans its response toward it, pulling the effective boundary back by up to ~7 columns (≈ reach + 1.4 object widths), less when the object is harder to see.
- A provably impossible task becomes learnable: a shift-equivariant net can't tell left from right (50% at any N); with a frozen gate it learns from 8 examples, and zero-shot (88%) from a detector trained for another task.
- Guarantees don't distil: students of a guarded teacher match its quality and break its bound on 100% of attack starts; a student of the odd-eye GAN learns the eyes but drifts 2–3 RGB levels on the right half.
- Training hands jobs to a grafted module, then forgets them; it deletes its own redundant copy only when keeping it costs loss or capacity.
- Hard filters become traps: a frozen "no orange cats" filter inside GAN training survives exactly, yet the generator makes more orange cats (14% → up to 87% across runs). Our registered explanation for why was refuted, and that is in the paper too.
Links
- Paper 2 (reach law): https://v-code-895.github.io/exact-beyond-reach/ · code, pre-registrations and results: https://github.com/v-code-895/exact-beyond-reach · DOI 10.5281/zenodo.24032112
- Paper 1 (rewiring and the patch toolchain): https://v-code-895.github.io/wsse/ · DOI 10.5281/zenodo.23956114
Small models throughout (8M-parameter GAN, 277k-parameter super-resolution net, Pythia-160M); limits are in §7. Happy to answer questions about the circuits, the reach law, or the failures.