Subscribe
Topic / page 2

Transformers

Articles, page 2

21-40
  1. Mixture-of-Depths: Mathematical Foundations, Dynamic Compute Routing, Capacity-Constrained Tensors, and IsoFLOP Scaling

    Mixture-of-Depths (MoD): Mathematical Foundations, Dynamic Compute Routing, Capacity-Constrained Tensors, and IsoFLOP Scaling In standard autoregressive Transformer architectures, computational effort is distributed uniformly across all tokens in a sequence. Every token position $i \in \{1, \dots, S\}$ passes through every layer $l \in \{1, \dots, L\}$, executing identical matrix multiplications across multi-head self-attention and feed-forward networks (FFN). This architectural constraint igno

    AI
    11 min read
  2. Induction Heads: Mathematical Foundations, Two-Layer Circuit Composition, and the Emergence of In-Context Learning in Transformers

    Induction Heads: Mathematical Foundations, Two-Layer Circuit Composition, and the Emergence of In-Context Learning in Transformers One of the defining capabilities of modern autoregressive large language models is in-context learning: the ability to infer rules, adapt to task formats, and execute complex few-shot instructions purely from prompt context without updating neural network weights. For years, in-context learning was treated as an enigmatic, emergent property of large-scale autoregres

    AI
    13 min read
  3. Integrated Gradients: How Axiomatic Attribution Solves the Gradients-at-Saturation Problem in Deep Neural Networks

    Integrated Gradients: How Axiomatic Attribution Solves the Gradients-at-Saturation Problem in Deep Neural Networks Feature attribution methods in deep learning aim to answer a fundamental interpretability question: given an input vector and a trained neural network, how much did each input dimension contribute to the model's final output score? In natural language processing and computer vision, practitioners routinely need to identify which input tokens, pixels, or tabular variables drove a sp

    AI
    10 min read
  4. Relative Positional Encodings in Transformers: How Shaw's Attention, Transformer-XL, and T5 Relative Biases Preserve Translation Invariance

    Relative Positional Encodings in Transformers: How Shaw's Attention, Transformer-XL, and T5 Relative Biases Preserve Translation Invariance Standard self-attention operations in transformer architectures possess no inherent awareness of sequence order. Because scaled dot-product attention computes interactions across sets of tokens without regard to index ordering, early models relied on absolute positional encodings to inject sequential structure. While absolute encodings assign rigid coordina

    AI
    9 min read
  5. RWKV Architecture: How Receptance Weighted Key Value Decay Combines RNN Efficiency with Transformer Parallelizability

    The dominant paradigm in natural language processing relies on the Transformer architecture, which calculates scaled dot-product self-attention across all token pairs in a sequence. While self-attention provides strong in-context retrieval and representation capacity, it imposes quadratic computational and memory complexity, scaling as O(N^2) with sequence length N during training and generating a continuously expanding Key-Value (KV) cache during autoregressive inference. Traditional Recurrent

    AI
    7 min read
  6. The Platonic Representation Hypothesis: How Foundation Models Across Modalities Converge on a Shared Geometry of Reality

    In 375 BC, Plato introduced the Allegory of the Cave, describing prisoners who could only perceive reality through shadows projected onto a stone wall. In modern machine learning, deep neural networks ingest distinct sensory shadows of the physical world: vision models process pixel arrays, large language models ingest tokenized text, and speech models parse raw acoustic waveforms. Historically, the machine learning literature assumed that models trained on different modalities, objectives, and

    AI
    6 min read
  7. The QK and OV Circuits in Transformers: How Bilinear Attention Routing and Subspace Projections Move Information

    The QK and OV Circuits in Transformers: How Bilinear Attention Routing and Subspace Projections Move Information The standard mathematical presentation of multi-head self-attention, introduced in Vaswani et al. (2017), describes the layer as a sequence of matrix projections followed by scaled dot-product operations, concatenation, and an output projection. While computationally efficient for parallel GPU hardware, this formulation obscures the fundamental linear mechanics governing how transfor

    AI
    9 min read
  8. Hybrid SSM-Transformer Architectures: How Interleaving Attention and Recurrence Solves the State-Retrieval Trade-Off

    Hybrid SSM-Transformer Architectures: How Interleaving Attention and Recurrence Solves the State-Retrieval Trade-Off Autoregressive language models face a fundamental tension between inference efficiency and long-context retrieval capacity. Pure Transformer architectures scale quadratic computational complexity during sequence prefill and linear key-value (KV) cache memory consumption during autoregressive token generation. Conversely, pure State Space Models (SSMs) and linear recurrent neural

    AI
    8 min read
  9. Performers and FAVOR+: How Positive Orthogonal Random Features Linearize Transformer Attention

    The quadratic complexity of standard self-attention has remained a central computational ceiling in Transformer architectures. Because standard attention computes pairwise similarity across all token pairs in a sequence of length $L$, memory consumption and compute scale as $O(L^2)$. For long contexts, high-resolution visual tokens, and biological sequence modeling, this quadratic bottleneck forces strict sequence truncation or aggressive hardware partitioning. In Rethinking Attention with Perf

    AI
    9 min read
  10. Sharpness-Aware Minimization in Large Language Models: How Adversarial Weight Perturbations and Flat Minima Boost Generalization

    In overparameterized deep neural networks, minimizing empirical training loss is insufficient to guarantee optimal generalization on unseen distributions. Modern deep architectures, including vision models and autoregressive Large Language Models (LLMs), operate in regimes where parameter counts far exceed training token counts, producing highly non-convex loss surfaces populated by infinite global minima. Standard optimization via Stochastic Gradient Descent (SGD) or AdamW often converges to sh

    AI
    6 min read
  11. Linear Mode Connectivity in Deep Neural Networks: How Permutation Symmetries, Git Re-Basin, and the Single-Basin Hypothesis Unify Model Checkpoints

    The classical intuition for high-dimensional optimization assumes that deep neural network loss landscapes are rugged, non-convex terrains populated by isolated local minima. Under this view, two models trained independently from distinct random initializations settle into distant, incompatible basins separated by insurmountable loss barriers. Direct parameter averaging between two such models typically degrades accuracy to random chance. Research over the past several years has overturned this

    Deep Learning
    9 min read
  12. Feed-Forward Networks as Key-Value Memories: How Transformers Store, Retrieve, and Edit Parametric Knowledge

    In transformer language models, multi-head self-attention and feed-forward networks (FFNs) perform distinct computational roles. While self-attention mechanisms route contextual information dynamically across sequence positions, feed-forward layers account for roughly two-thirds of total model parameters in standard architectures. Despite early interpretations characterizing FFNs simply as generic non-linear projections, mechanistic analysis shows that feed-forward layers operate as unnormalized

    AI
    6 min read
  13. LayerSkip and Self-Speculative Decoding: How Layer Dropout and Shared Early Exits Accelerate LLM Generation

    LayerSkip and Self-Speculative Decoding: How Layer Dropout and Shared Early Exits Accelerate LLM Generation Standard autoregressive large language model (LLM) inference is severely bottlenecked by memory bandwidth. In transformer decoders, generating a sequence of $N$ tokens requires loading all model parameters from High Bandwidth Memory (HBM) to on-chip SRAM $N$ separate times. While speculative decoding mitigates this bandwidth tax by using a smaller draft model to propose candidate tokens v

    AI
    8 min read
  14. The Curse of Multilinguality in Large Language Models: Capacity Dilution, Tokenizer Fertility, and Representation Interference

    The Curse of Multilinguality in Large Language Models: Capacity Dilution, Tokenizer Fertility, and Representation Interference Training a single transformer foundation model to process dozens or hundreds of languages is one of the central goals of modern natural language processing. In theory, massive multilingual pre-training unlocks positive cross-lingual transfer: low-resource languages gain syntactic, factual, and reasoning capabilities from the rich supervision available in high-resource l

    AI
    7 min read
  15. Logit Soft-Capping in Large Language Models: How Tanh-Based Bounds Prevent Attention Saturation and Numerical Instability

    In modern autoregressive Transformer training, maintaining numerical stability across trillions of tokens requires strict control over intermediate activation magnitudes. As models grow deeper and wider, pre-softmax logits in self-attention mechanisms and final vocabulary projection layers frequently drift toward extreme values. When logit values grow unconstrained, standard softmax normalization enters a saturation regime where output probabilities collapse into near one-hot distributions, caus

    AI
    7 min read
  16. Reversible Transformers: How Invertible Residual Blocks Eliminate Activation Memory in Deep Networks

    Training deep transformer models is primarily bounded by activation memory rather than parameter storage. During the forward pass of standard backpropagation, automatic differentiation engines cache intermediate activations across every attention head, layer normalization, and feed-forward sublayer so they can be referenced during the backward pass to evaluate gradients. For a transformer with N layers, sequence length L, batch size B, and hidden dimension d_model, storing these activations requ

    AI
    6 min read
  17. Rank Collapse in Deep Transformers: Why Pure Attention Degenerates Doubly Exponentially and How Skip Connections Preserve Capacity

    When the Transformer architecture was introduced in 2017 with the seminal paper "Attention Is All You Need", the central thesis was that recurrence and convolution could be completely discarded in favor of stacked self-attention mechanisms. However, theoretical analysis has shown that the title's premise is mathematically incomplete. Stacking pure self-attention layers in isolation does not produce an expressive deep model: it triggers a catastrophic failure mode known as rank collapse. In a fo

    AI
    7 min read
  18. No Positional Embeddings (NoPE): How Causal Masking and Attention Geometry Encode Sequence Order

    A foundational tenet of the Transformer architecture established by Vaswani et al. (2017) is permutation equivariance. Because standard self-attention calculates token interactions purely through pairwise dot products across sets of vectors, shuffling the order of input tokens yields identical outputs up to the corresponding permutation. To establish word order, standard transformer models inject explicit positional information, ranging from learned absolute position embeddings (APE) to sinusoid

    AI
    6 min read
  19. The Softmax Bottleneck in Large Language Models: Matrix Factorization Bounds, High-Rank Token Distributions, and Mixture of Softmaxes

    Autoregressive language models predict probability distributions over vocabulary tokens conditioned on preceding text. In standard Transformer architectures, the model computes a hidden state vector $h_c \in \mathbb{R}^d$ for a given context $c$, projects it into vocabulary space using a linear unembedding matrix $W \in \mathbb{R}^{V \times d}$, and applies the softmax function to normalize the resulting logits into probabilities. While computationally convenient, this formulation imposes a fun

    AI
    8 min read
  20. Rank Collapse in Transformer Architectures: Why Pure Attention Decays Doubly Exponentially and How Residuals Restore Expressivity

    Rank Collapse in Transformer Architectures: Why Pure Attention Decays Doubly Exponentially and How Residuals Restore Expressivity The foundational premise of the Transformer architecture is that self-attention acts as a dynamic routing engine, computing pairwise affinities across sequence positions to contextualize representations. However, theoretical analysis reveals an underlying instability: stripped of its auxiliary components, a pure self-attention network rapidly destroys its own express

    AI
    8 min read