How Language Models Compress and Compare: Understanding Selection with Token Covariance Maps
Abstract
Many language-model tasks reduce to selecting among structured alternatives, yet we still lack a simple picture of how a decoder-only transformer organizes an entire selection prompt across depth. We introduce token covariance maps, a prompt-level geometric view that tracks how token positions co-vary in hidden-state space at each layer. This turns a structured prompt into a depth-indexed sequence of maps whose spectral and block structure can be aligned with instructions, context, and candidate answers. Across 14 decoder-only models from 4 families and 12 structured-selection benchmarks, token covariance maps reveal a robust compress-then-compare organization. Early layers represent prompts diffusely, middle layers compress them into a shared low-rank bottleneck, and late layers re-expand into context-option and option-option geometry. This organization is stable under larger fixed-template samples, deterministic prompt rewrites, pairwise reranking reformulations, and controlled answer-set manipulations, while also emerging during training from an initially flat depth profile. Its timing aligns with behavior: useful answer discrimination appears well after the bottleneck, and low-rank intervention around the bottleneck preferentially disrupts late comparison geometry. Together, these results identify a compact layerwise account of structured selection in decoder-only language models: prompts are first compressed into a shared mid-layer representation and then re-expanded into late answer-comparison geometry. Token covariance maps provide a reusable diagnostic for comparing prompts, checkpoints, and model families, and reveal a reproducible geometric organization underlying compare-and-select behavior.