Spanner: a Weights-Only Lineage Distance for LLMs Across Architectures and Tokenizers

Matthew RitcharXiv 2026

TL;DR

Open-source LLMs are constantly fine-tuned, merged, pruned, and remixed, making their family trees messy and hard to verify. This paper introduces Spanner ($D$), a fast, weights-only distance metric that can compare any two LLMs—even if they have different widths, depths, or tokenizers—while ignoring mathematical symmetries that don't change model behavior. It is cheap enough to map the lineage of 1,000 8B-parameter models for $30, and it already caught several misattributed parent models on Hugging Face.

What Problem Does This Paper Address?

Most open LLMs are not trained from scratch; they are built by remixing existing models through fine-tuning, merging, splicing, quantization, or Mixture-of-Experts (MoE) upcycling. Because documentation is often incomplete or unverified, tracing a model's true ancestry is difficult.

Existing lineage-tracing methods fall into two camps, each with major blind spots:

  • Output-based methods (like PhyloLM) compare how models respond to probe prompts. They work across different architectures and tokenizers, but they cannot distinguish weight descent (actually modifying a parent's weights) from distillation or behavioral convergence (two unrelated models trained to act alike).
  • Weight-based methods inspect the weights directly, but most require models to share the same dimensions or tokenizers. Worse, they can be fooled by model symmetries—such as rotating the residual stream or permuting attention heads—which alter the raw numbers in the weights without changing the model's outputs at all.

Methods

Spanner computes a pseudometric $D(A, B)$ between any two models in five steps:

  1. Fold linear maps: Normalization scales (such as RMSNorm or LayerNorm) are folded into adjacent weight matrices to eliminate rescaling ambiguity.
  2. Token coordinates: The authors find the shared vocabulary $S$ present in every model being compared, and extract centered embedding ($E$) and unembedding ($U$) matrices on $S$.
  3. Compute invariants & project: For each attention and MLP sublayer, Spanner computes weight invariants (e.g., QK and OV circuits for attention; neuron read, write, and key-value matrices for MLPs) that sum over heads or neurons, making them invariant to permutations. These are then projected onto the shared token space $S$.
  4. TensorSketch: Because $|S| \times |S|$ matrices can be huge, Spanner uses TensorSketch ($k = 16,384$) to compress each projected invariant into a compact fingerprint vector, which is $\ell_2$-normalized and concatenated per sublayer.
  5. Yanai's Generalized Coefficient of Determination (GCD): Finally, Spanner compares the spans of the two models' sublayer fingerprints. This yields $D = \arccos(\cos\theta)$, the angle between their subspaces, which is invariant to layer ordering or duplication.

Datasets

The authors evaluate Spanner across several model collections:

  • Symmetries & remixes: Qwen3-1.7B (Base/Instruct) and Llama-3.2-1B(-Instruct), along with synthetic edits (rotations, permutations, layer duplication/dropping, quantization, SLERP/TIES/DARE merges, and MoEs).
  • Training trajectories: Public checkpoints from Pythia-410M (both standard and deduplicated runs).
  • Published benchmarks: AWM's 150-pair benchmark (60 related, 90 unrelated) and LLM Biometrics' S1/S2/S3 evaluation sets.
  • Lineage recovery & auditing: A newly curated set of 117 models from 34 documented lineages (including Qwen, SmolLM2, Gemma-2/3, Llama-3.1/3.2, and DataDecide), plus 231 models—including 101 community models from the Hugging Face Hub—for "in the wild" auditing.

Key Insights and Ideas

  • Genotype vs. Phenotype: Weight-based ($D$) and behavior-based (PhyloLM) methods complement each other. PhyloLM rates independent models from the same lab as closer than models from different labs (0.779 vs. 1.159), whereas $D$ measures both as equally unrelated (1.568). Conversely, $D$ detects shared weights in merges and splices even when behavior shifts.
  • A "Molecular Clock" for training: On Pythia-410M, $D^2(t, \text{final})$ tracks the remaining cumulative learning rate almost linearly ($R^2 = 0.98$), acting like a molecular clock for how much training has occurred.
  • True symmetry invariance: $D$ stays near zero ($\sim 10^{-6}$) under exact symmetries and layer duplications, while $D^2$ scales linearly with KL divergence under Gaussian weight noise.
Figure 1. D2 vs. training step, cumulative learning rate, and cross-run divergence.

Key Results

  • Benchmarks: Spanner achieves 0.991 AUROC on AWM's benchmark (close to AWM's 1.000, and outperforming HuRef, Trace, PCS, and REEF) and 0.889 AUROC on LLM Biometrics' S1 vs. S2 task (beating Trace's 0.770).
  • Lineage recovery: On the 117-model set, Spanner reaches 0.9994 AUROC (strict) and 0.9955 AUROC (lenient) for parent-child detection, and recovers 40 of 49 ground-truth families using NeighborNet (compared to PhyloLM's 19 of 49).
  • Hugging Face audit: Auditing 101 community models uncovered 2 models with completely unrelated listed parents ($D = 1.5706$) and several others (such as FRPO runs and pruned models) that were much closer to a different parent than the one listed.
  • Speed & cost: Excluding download time, computing a full distance matrix for 1,000 8B models takes about 16.7 hours and $30 on a single NVIDIA L40S, because each model is sketched once and pairwise comparisons take milliseconds.

Limitations and Future Work

  • Shared vocabulary: $D$ requires a shared token set $S$, which shrinks as more tokenizers are added (though ablations show $|S| = 64$ still performs well).
  • Saturation & edge cases: $D$ saturates near $\pi/2$ for unrelated models, and aggressive pruning or embedding swaps can inflate $D$ despite shared weights.
  • Scope: Spanner cannot detect distillation on its own, does not determine descent direction, was not tested against adversaries trying to hide lineage, and currently only covers attention and MLP sublayers.

Summary updated

BibTeX
@misc{ritch2026spanner,
  author = {Matthew Ritch},
  title = {{Spanner: a Weights-Only Lineage Distance for LLMs Across Architectures and Tokenizers}},
  year = {2026},
  eprint = {2611.41556},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.41556},
}
Figure