## Diagram: MTLA Architecture and Training Process
### Overview
The image illustrates three stages of the MTLA (Memory-efficient Transformer with Latent Approximation) architecture: inference, simple KV downsampling, and training with stride-aware causal masking. It combines block diagrams, matrices, and attention score visualizations to demonstrate parameter efficiency and causal attention mechanisms.
### Components/Axes
1. **Input Elements**:
- **x₁–x₆**: Input tokens (blue boxes)
- **q₁–q₆**: Queries (pink boxes)
- **ĉ₁–ĉ₃**: Latent chunk representations (blue boxes with hats)
2. **Hypernetwork Output Weights**:
- Matrix labeled "Hypernetwork Output Weights" with entries w₁–w₄
- Chunk masking replaces some weights with zeros (grayed out)
3. **Low-rank Latent Vectors**:
- Column vector labeled "Low-rank Latent Vectors" with entries c₁–c₄
4. **Attention Scores**:
- Matrices labeled "Attention Scores before Softmax" with values like q₁•ĉ₁, q₂•ĉ₂, etc.
- Stride-aware causal masking introduces -∞ values in upper triangle
### Detailed Analysis
#### (a) MTLA Inference
- **Flow**: Input tokens (x₁–x₆) are processed through hypernetwork weights (w₁–w₄) to produce latent vectors (ĉ₁–ĉ₃).
- **Chunk Masking**: 50% of weights are zeroed (e.g., w₃ and w₄ columns in ĉ₂ row).
- **Low-rank Approximation**: ĉ₁ = w₁•c₁ + w₂•c₂, ĉ₂ = w₃•c₃ + w₄•c₄
#### (b) Simple KV Downsample
- **Simplified Flow**: Only ĉ₁ and ĉ₂ are used for queries q₁–q₄
- **Attention Scores**: 4x4 matrix with values like q₁•ĉ₁ = 0.8, q₁•ĉ₂ = 0.3
- **Masking**: No causal masking applied
#### (c) MTLA Training with Stride-aware Causal Mask
- **Causal Masking**: Upper triangle of attention scores matrix filled with -∞
- **Example Scores**:
- q₁•ĉ₁ = 0.9 (valid)
- q₁•ĉ₂ = -∞ (masked)
- q₃•ĉ₂ = 0.7 (valid)
- **Masking Pattern**: Strict lower-triangular structure prevents future token leakage
### Key Observations
1. **Parameter Efficiency**: Chunk masking reduces hypernetwork weights by 50% while maintaining representational capacity through low-rank approximation.
2. **Causal Attention**: Training phase enforces strict causal masking (-∞ values) to prevent future token leakage, critical for autoregressive generation.
3. **Dimensionality Reduction**: Queries (q₁–q₄) project onto a 2-dimensional latent space (ĉ₁–ĉ₂) despite 6 input tokens.
### Interpretation
The MTLA architecture demonstrates how transformer models can achieve efficiency through:
1. **Chunk-wise Processing**: Input tokens are grouped into chunks (ĉ₁–ĉ₃) with shared hypernetwork weights, reducing parameter count.
2. **Low-rank Approximation**: Latent vectors (c₁–c₄) enable efficient computation while preserving semantic information.
3. **Causal Attention**: Stride-aware masking ensures temporal consistency during training, preventing the model from "seeing" future tokens.
The architecture balances memory efficiency (via chunk masking) with computational efficiency (via low-rank vectors), while maintaining the causal attention properties essential for sequence modeling tasks. The -∞ masking values in attention scores represent infinite negative penalties that effectively zero out invalid connections during softmax computation.