Published December 9, 2025 | Version v1
Publication Open

An O(1) Modular Fingerprint of Input Norm Predicts Spectral Concentration in Transformer Hidden States — and the Correlation Sign Flips with Rotary Embeddings

Authors/Creators

Description

We introduce an O(1)-time, dimension-independent diagnostic computed solely from raw token IDs that predicts spectral concentration in transformer final-layer hidden states. The diagnostic exhibits a reproducible sign flip from positive correlation under absolute positional embeddings to negative correlation under rotary embeddings (RoPE), with the negative correlation strengthening with model scale. Partial regression controlling for sequence length shows the signal is an independent geometric feature in large (>2B) RoPE models, while acting as a high-speed length proxy in smaller ones. A proof-of-concept routing gate using the diagnostic yields 57.2% fewer tokens processed and 53.0% lower energy consumption on Apple Silicon. Isolated tests confirm the inference bottleneck is memory-bound. 

# Modular LLM Diagnostic Reproducibility Package Paper: An O(1) Modular Fingerprint... (Lynch, 2025)

## Setup pip install torch transformers scipy numpy pandas statsmodels tqdm

## Reproduce Key Results - env_test.py: Verify Torch/MPS. - ROPEmodelTest.py: TinyLlama correlation (r=-0.287). - ROPEmodelTest2.py: Mistral-7B (r=-0.420). - test_models.py: GPT2/Phi-2. - extractor.py: Extract CSVs from logs. - CSV.py: Generate Table 1 + confounders. - measure_mac_01.py: Gated routing (57% savings; sudo needed for powermetrics). - measure_mac_isolated_test.py: Latency/energy tests. - proof3.py: Standalone λ₂ calc.

prompts.txt/simple_prompts.txt: Test datasets.

Raw logs/JSONs: Gating outputs.

Files

aaaa_Brendan_lynch_2025_modular_fingerprint.pdf

Files (1.6 MB)

Name Size Download all
md5:67c5bbdbf4702589d111fb52667a4dd8
731.2 kB Preview Download
md5:5c7e4b9122d64aabd75dcc095fa31aeb
4.6 kB Download
md5:c2b467c385d7e8a151f9492a96e29962
269 Bytes Download
md5:897ea6731c740b952073f951f6975644
33.7 kB Download
md5:d68a0bbcf6428fcd4e525572fc3e4ea8
738 Bytes Preview Download
md5:220abe1b27b40bf938119f9f35e75e9f
11.0 kB Preview Download
md5:3b43f96923c164ba87e4c03b2d9ba314
17.2 kB Preview Download
md5:6fb74fbe69bab0636346bc2b76e3f2f5
1.2 kB Preview Download
md5:8d2d77d3f9e459765ed397581021cf74
45.4 kB Download
md5:76e2ea930c4fd09eeeeeea433004c3fa
66.5 kB Download
md5:fb7e01b9f75fd328625097f5f1d423db
440.6 kB Preview Download
md5:123a931a913b6eff56f52adda2295553
143.1 kB Download
md5:25d99f988181b328b111521b6d2b2f70
4.4 kB Preview Download
md5:e91e84d493867a410bca88b7466f4e74
54.4 kB Download
md5:555fd96e4fa23f6d140f1268a2c36bae
32.5 kB Download
md5:ea23372bddd7f5156a90fb970d5a5b53
1.8 kB Preview Download
md5:e33d71aaf418c02930c8f2951a58fa03
10.5 kB Download