Transformer tricks: Precomputing the first layer
Not on the map. Why?
Abstract (arXiv)
This micro-paper describes a trick to speed up inference of transformers with RoPE (such as LLaMA, Mistral, PaLM, and Gemma). For these models, a large portion of the first transformer layer can be precomputed, which results in slightly lower latency and lower cost-per-token. Because this trick optimizes only one layer, the relative savings depend on the total number of layers. For example, the maximum savings for a model with only 4 layers (such as Whisper tiny) is limited to 25%, while a 32-layer model is limited to 3% savings. See https://github.com/OpenMachine-ai/transformer-tricks for code and more transformer tricks.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 12 of its 17 references that are in the map. First posted on arXiv 20 Feb 2024.
Builds on
12 of 17 references.
References · 12
- 2017Attention Is All You Needcited by 59,932
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2022Robust Speech Recognition via Large-Scale Weak Supervisioncited by 3,972
- 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
- 2020GLU Variants Improve Transformercited by 1,724
- 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpointscited by 1,311
- 2020On Layer Normalization in the Transformer Architecturecited by 906
- 2019Fast Transformer Decoding: One Write-Head is All You Needcited by 700
- 2023The Micro-Paper: Towards cheaper, citable research ideas and conversationscited by 2
Built on by
Citing papers per year: 2024: 2; 2025: 1.
3 papers.
- 2025APT-LLM: Exploiting Arbitrary-Precision Tensor Core Computing for LLM Acceleration26 Aug 2025
- 2024KV-weights are all you need for skipless transformers18 Apr 2024
- 2024Introducing Super RAGs in Mistral 8x7B-v113 Apr 2024