MLP Cache: A Post-Hoc Memory-Compute Trade-off for Transformer Inference
MLPs impose substantial inference cost in Transformers by applying a full, high-capacity transformation to every token. Deployed workloads revisit recurring regions of the MLP input space, which creates an opportunity for compute reuse beyond exact-match caching. We introduce MLP Cache, a post-hoc cache that stores compact local predictors of a frozen MLP without retraining the backbone. The central challenge is to allocate limited memory across region scale and predictor capacity: broader regions cover more inputs but may require larger predictors, while finer regions are easier to approximate but require more entries. MLP Cache constructs a coarse-to-fine hierarchy using shared graph-spectral coordinates, whose signs define candidate regions and whose continuous values provide features for region-specific predictors. Tree dynamic programming selects region-predictor pairs to maximize workload coverage under memory and approximation-error budgets. On frozen Qwen3.5-9B, MLP Cache replaces 24-28% of MLP calls in the cached layers on MME-Coarse and MMStar-Coarse. A cached layer saves time when its hit rate times the time one hit saves exceeds its fixed cost of routing and lookup,…
- arXiv
- 2612.02874
- Authors
- Huzheng Yang, Yiqiao Huang, Qingqiao Hu, Dongdi Zhao, Jiaxing Zhang and 1 more
- Categories
- cs.LG · cs.AI