跳到正文
arXiv cs.AI· Huzheng Yang, Yiqiao Huang, Qingqiao Hu, Dongdi Zhao, Jiaxing Zhang, Di Fu·· 3 天前AI 评分45

MLP Cache:一种面向 Transformer 推理的事后记忆-计算权衡方法

MLP Cache: A Post-Hoc Memory-Compute Trade-off for Transformer Inference

AI 导读

arXiv 论文提出 MLP Cache,一种无需重训练骨干模型、为冻结 MLP 存储紧凑局部预测器的事后缓存方法,用图谱坐标构建粗到细的区域层级,并通过树动态规划在内存和近似误差预算下选择区域-预测器组合。

正文 · 原文

View PDF HTML (experimental)

Abstract: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, so the gain is largest in batch-one decoding, where a hit skips the layer's weight reads. At batch one on an Apple M5 Pro, a cache that holds 1.2 GiB in memory makes decoding 1.20x faster with a 0.56-point change in MME-Coarse accuracy, and one that holds about 8 GiB makes it 1.38x faster at a cost of about 3 points; with this larger cache, decoding stays faster up to batch 8. On an A100, batch-one decoding is 1.09-1.15x faster against a baseline that runs each decode step as one CUDA graph. A controlled single-MLP benchmark shows that the gain grows with the size of the MLP. Project page: this https URL
Comments: 65 pages, 24 figures, 41 tables. Project page: this https URL Code: this https URL
Subjects: Machine Learning (cs.LG); Artificial Intelligence (cs.AI)
Cite as: arXiv:2612.02874 [cs.LG]
  (or arXiv:2612.02874v1 [cs.LG] for this version)
  https://doi.org/10.48550/arXiv.2612.02874

arXiv-issued DOI via DataCite (pending registration)

Submission history

From: Huzheng Yang [view email]
[v1] Tue, 1 Dec 2026 22:53:59 UTC (7,646 KB)

来源:arXiv cs.AI · arxiv.org