报道正文
本文目录3 个章节
Drop the FFN · A Column Attention Transformer for TinyStories
简体中文 · Checkpoint and checksum · Evaluation results (JSON)
This 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.
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.
TinyStories validation
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
| Model | Total parameters | Validation NLL ↓ | Perplexity ↓ |
|---|---|---|---|
| Column Attention · 256 slots | 107,279,872 | 1.42028 | 4.13828 |
| Official TinyStories-2Layers-33M | 78,748,672 | 1.56311 | 4.77366 |
Both 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.
What was scored
- 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
- 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 · Evaluation code
- 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
Why weight storage and bandwidth matter
A 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
Column 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 · Tiled scoring kernel
If 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
(注:更多技术实现细节与完整 API 文档请查阅原项目 README)