{"slug": "drop-the-ffn-a-column-attention-transformer-for-tinystories", "title": "Drop the FFN – A Column Attention Transformer for TinyStories", "summary": "A 107,279,872-parameter causal language model that replaces the feed-forward network in each of its eight Transformer blocks with column attention reached a validation perplexity of 4.13828 versus 4.77366 for the official TinyStories-2Layers-33M checkpoint, according to results published by developer jiaminres in the drop-the-ffn repository. Both scores were computed on the same 215,176 held-out next-token targets from the pinned TinyStories validation file, with the column-attention model evaluated at step 59,000 of a 20-epoch run on an RTX 5090 and the official checkpoint on CPU. The column-attention model carries 36.2% more parameters (107,279,872 versus 78,748,672), and the author states the long-term goal is running capable models locally on memory-limited devices such as consumer GPUs and robot onboard computers.", "body_md": "[简体中文](https://github.com/jiaminres/drop-the-ffn/blob/main/README.zh-CN.md) · [Checkpoint and checksum](https://github.com/jiaminres/drop-the-ffn/releases/tag/column-attention-256-step-59000) · [Evaluation results (JSON)](https://github.com/jiaminres/drop-the-ffn/blob/main/results/comparison.json)\n\nThis 107M-parameter causal language model replaces the feed-forward network in each of its eight Transformer blocks with **column attention**. After attention over token positions, each token uses its own activations to generate eight 256 × 256 matrices that mix channels.\n\n**The long-term goal is to run capable models locally on devices with limited memory.** We are testing whether extra computation on the device can buy a smaller set of resident weights, bringing more inference workloads within reach of consumer GPUs and onboard computers in robots.\n\n**Interim checkpoint at step 59,000 of an ongoing 20-epoch run.** The model had seen 762,772,121 next-token targets (about 1.64 epochs). The comparison uses the original authors’ closest publicly released base model by total parameter count, `TinyStories-2Layers-33M`. Counts include embeddings and count tied weights once. [Official checkpoint and revision](https://huggingface.co/roneneldan/TinyStories-2Layers-33M/tree/f9cb5b1e9f9664843c179b9f7115d610c6df1be0)\n\n| Model | Total parameters | Validation NLL ↓ | Perplexity ↓ | \n|---|---|---|---|\n| **Column Attention · 256 slots** | **107,279,872** | **1.42028** | **4.13828** | \n| Official TinyStories-2Layers-33M | 78,748,672 | 1.56311 | 4.77366 | \n\nBoth scores use **the same 215,176 held-out targets**, 512-token blocks, microbatch 4, eager attention and BF16 autocast. The column-attention score comes from validation on an RTX 5090 at step 59,000. The official checkpoint was evaluated on CPU. The column-attention checkpoint has 36.2% more parameters. Depth, positional encoding and training histories also differ. This comparison measures next-token prediction on the selected stories.\n\n- **Data.** The training stream contains 2,119,489 complete stories. Validation uses the first 1,401 complete stories of the pinned original TinyStories validation file, encoded with the same 50,257-token vocabulary and an end-of-story token.[Dataset revision](https://huggingface.co/datasets/roneneldan/TinyStories/tree/f54c09fd23315a6f9c86f9dc80f725de7d8f9c64)\n- **Overlap.** Exactly 262 validation stories also appear in the training stream as identical token sequences. Their targets are masked at scoring time, preserving the packed inputs and context for both models. The remaining 1,139 stories contribute the 215,176 scored targets. Short stories share blocks and long stories can span blocks.[Story packing](https://github.com/jiaminres/drop-the-ffn/blob/main/story_packing.py) ·[Evaluation code](https://github.com/jiaminres/drop-the-ffn/blob/main/story_validation.py)\n- **Metrics.** NLL is the sum of negative log probabilities of the scored next tokens divided by their count, in natural logarithms. Perplexity is`exp(NLL)` . The JSON record includes weight, tokenizer, data and mask hashes.[Comparison record](https://github.com/jiaminres/drop-the-ffn/blob/main/results/comparison.json)\n\nA GPU can have enough arithmetic throughput to generate the next token while lacking the VRAM to hold the weights, KV cache and workspace together. For a model with large dense FFNs, one option is to keep some weights in system RAM and transfer them to the GPU layer by layer. When the transfer takes longer than the compute available to overlap it, generation stalls and per-token latency rises. Buying higher-memory hardware raises deployment cost. Both trade-offs matter for a robot that must respond on time using its onboard computer. [FlexGen study of single-GPU offloading](https://arxiv.org/abs/2303.06865)\n\nColumn attention offers a specific trade-off. Let `m` be both the number of queries per group and the number of shared keys. Keep the residual width at 512, the group count at 8 and the Q/K dimension at 54, and include the output projection. The four projections in one mixer have **`35,712 × m` learned weights**, while QK scoring takes **`8 × 54 × m²` multiply–accumulates per token**. Along this scaling path, scoring arithmetic grows quadratically with the number of mixer projection parameters. Doubling the slots doubles the projection parameters and gives each token four times as many channel scores. At the current `m = 256`, each layer generates 524,288 scores per token in on-chip tiles. [Mixer projections](https://github.com/jiaminres/drop-the-ffn/blob/main/channel_mixer.py) · [Tiled scoring kernel](https://github.com/jiaminres/drop-the-ffn/blob/main/channel_attention_triton.py)\n\nIf this compute-intensive design can reach the same quality with fewer trainable parameters, it could reduce resident weight storage and weight transfers during inference, making local deployment practical on more devices. Training presents a related opportunity. In data-parallel training with the same worker count, gradient precision and synchronization frequency, the gradient payload scales with the trainable parameter count. More local computation per learned weight could ease network bandwidth demands and make distributed training across consumer GPUs more practical. Peak memory, per-token latency and bytes communicated per update at matched quality are the measurements that would test these deployment hypotheses. [PyTorch on distributed gradient synchronization](https://docs.pytorch.org/docs/stable/notes/ddp.html)\n\nThe residual width is 512. All eight layers use global causal row attention with 16 heads and RoPE over each 32-dimensional row query and key. Column attention then operates inside one token:\n\n1. Split its 512 activations into eight groups of 64. Each group uses the same learned Q projection to produce 256 queries of width 54.\n2. Project the full token once to 256 keys of width 54 and 256 scalar values. All eight groups share these keys and values.\n3. In each group compute `A = softmax(Q @ K.T / sqrt(54), dim=-1)` and`y = A @ v` . Concatenate the eight outputs and project 2,048 channels back to 512 for the residual addition.\n\nThe Q/K/V/output projections are learned weights. The mixing coefficients in `A` are generated anew at each position. At fixed channel width, column scoring costs **O(n)** in sequence length and uses `n × 8 × 256² × 54` multiply–accumulates per layer. Global row attention still has quadratic score computation in `n`. The BF16 Triton training kernel tiles channel scores on chip and recomputes Q during backward. [Column mixer](https://github.com/jiaminres/drop-the-ffn/blob/main/channel_mixer.py) · [Triton kernel](https://github.com/jiaminres/drop-the-ffn/blob/main/channel_attention_triton.py) · [Rotary row attention](https://github.com/jiaminres/drop-the-ffn/blob/main/rotary_row_attention.py)\n\nUse Python 3.12 and install the dependencies below. Download **column-attention-256-step-59000.pt** into the repository root from the release. The inference download command fetches the tokenizer and model configuration. [Download weights](https://github.com/jiaminres/drop-the-ffn/releases/download/column-attention-256-step-59000/column-attention-256-step-59000.pt)\n\n```\npython -m pip install -r requirements.txt\npython download_assets.py --inference-only\npython generate_story.py --checkpoint column-attention-256-step-59000.pt --device cpu --prompt \"One day, a little bird found a red ribbon.\" --max-new-tokens 160 --out runs/story.json\n```\n\nDownload the pinned corpus and official baseline, encode the data, then run each evaluation on the device used for its reported score. The column-attention command requires a BF16-capable CUDA GPU.\n\n```\npython download_assets.py\npython prepare_data.py\npython story_validation.py --official --device cpu --precision bf16 --threads 8 --micro-batch 4 --out runs/official-score.json\npython story_validation.py --checkpoint column-attention-256-step-59000.pt --device cuda --precision bf16 --threads 8 --micro-batch 4 --out runs/column-score.json\n```\n\nThe reported run uses an RTX 5090 with CUDA BF16, Triton column attention, CPU AdamW with FP32 master weights and moments, and seed 42. The learning rate warms to 0.0003 over 500 updates and then stays constant. The effective batch was 32 through update 58,444, with microbatch 8 for the first 250 updates and 32 thereafter. Starting at update 58,445, each update uses one microbatch of 40 packed sequences. The command below starts a fresh run at 32 sequences per update. [Trainer](https://github.com/jiaminres/drop-the-ffn/blob/main/train_full_epochs.py)\n\n```\npython train_full_epochs.py --cpu-optimizer --max-epochs 20 --micro-batch 32 --batch-sequences 32\n```\n\nGPU training was tested with PyTorch 2.11.0+cu130 and triton-windows 3.7.0.post26. For that environment, install the CUDA wheel from `https://download.pytorch.org/whl/cu130` and install `triton-windows==3.7.0.post26`. For model checks use `python verify_wide_model.py` (CPU) or `python verify_wide_model.py --cuda-mixer` (CUDA). Use `python live_loss.py` to view training on port 8765.\n\nProject code is licensed under [Apache-2.0](https://github.com/jiaminres/drop-the-ffn/blob/main/LICENSE). TinyStories was created by Ronen Eldan and Yuanzhi Li. [TinyStories paper](https://arxiv.org/abs/2305.07759) · [Upstream dataset](https://huggingface.co/datasets/roneneldan/TinyStories)", "url": "https://wpnews.pro/news/drop-the-ffn-a-column-attention-transformer-for-tinystories", "canonical_source": "https://github.com/jiaminres/drop-the-ffn", "published_at": "2026-12-05 12:25:26+00:00", "updated_at": "2026-12-05 12:45:22.245595+00:00", "lang": "en", "topics": ["large-language-models", "machine-learning", "ai-research", "ai-infrastructure"], "entities": ["jiaminres", "TinyStories", "TinyStories-2Layers-33M", "RTX 5090", "FlexGen"], "also_reported_by": [], "takeaway": "Replacing each block's feed-forward network with column attention, where each token generates eight 256×256 channel-mixing matrices from its own activations, cut validation perplexity to 4.13828 from 4.77366 on 215,176 held-out TinyStories targets, at the cost of 36.2% more parameters.", "recommendation": {"advice": "When VRAM, not arithmetic, limits local inference, test trading dense FFN weights for per-token computed channel mixing; the source measured perplexity 4.13828 versus 4.77366 at 36.2% more parameters.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/drop-the-ffn-a-column-attention-transformer-for-tinystories", "markdown": "https://wpnews.pro/news/drop-the-ffn-a-column-attention-transformer-for-tinystories.md", "text": "https://wpnews.pro/news/drop-the-ffn-a-column-attention-transformer-for-tinystories.txt", "jsonld": "https://wpnews.pro/news/drop-the-ffn-a-column-attention-transformer-for-tinystories.jsonld"}}