Autoregressive inference is typically assumed to scale predictably with decoding length, with latency increasing smoothly as generated sequence length grows. In this work, we identify unexpected non-monotonic latency behavior in the Apple MPS backend, where latency changes abruptly across nearby decoding configurations during transformer decoding. Using multiple model families (GPT-2, BLOOM, and OPT), we observe latency spikes of up to 21x within specific decoding-budget intervals, followed by recovery at neighboring configurations. Controlled experiments show that these anomalies originate primarily during the decode phase rather than prefill, are not explained by memory pressure alone, and remain absent on CPU and NVIDIA CUDA backends under identical conditions. We further show that key-value (KV) cache interacts strongly with these pathological execution regimes: KV caching remains beneficial overall, but its practical speedup collapses sharply within anomalous configurations, while cache-disabled decoding still exhibits residual non-monotonic behavior. These findings suggest that autoregressive decoding on MPS enters discrete execution regimes that are not captured by coarse-grained benchmarking, highlighting the importance of hardware-aware evaluation for long-context inference.


翻译:自回归推理通常被认为随解码长度呈现可预测的缩放规律,即延迟随生成序列长度增长而平滑增加。本研究发现Apple MPS后端存在意外的非单调延迟行为——在Transformer解码过程中,延迟在邻近解码配置间发生突变。使用多种模型族(GPT-2、BLOOM、OPT),我们在特定解码预算区间内观测到高达21倍的延迟峰值,并在相邻配置中恢复。控制实验表明:这些异常主要源于解码阶段而非预填充阶段,无法仅用内存压力解释,且在相同条件下CPU和NVIDIA CUDA后端均未出现。进一步研究发现,键值(KV)缓存与这些病态执行模式存在强交互:KV缓存整体上仍具性能优势,但其实际加速比在异常配置中急剧坍塌,而禁用缓存的解码仍表现出残余的非单调行为。这些发现表明,MPS上的自回归解码会进入离散执行模式,该模式无法通过粗粒度基准测试捕获,凸显了硬件感知评估对长上下文推理的重要性。

0
下载
关闭预览

相关内容

【CVPR2024】掩码自解码器是有效的多任务视觉通用模型
专知会员服务
20+阅读 · 2024年3月16日
EMNLP 2021 | 学习改写非自回归机器翻译的翻译结果
专知会员服务
16+阅读 · 2021年12月25日
【反馈循环自编码器】FEEDBACK RECURRENT AUTOENCODER
专知会员服务
23+阅读 · 2020年1月28日
使用 Keras Tuner 调节超参数
TensorFlow
15+阅读 · 2020年2月6日
iOS如何区分App和SDK内部crash
CocoaChina
11+阅读 · 2019年4月17日
深度学习中Attention Mechanism详细介绍:原理、分类及应用
深度学习与NLP
10+阅读 · 2019年2月18日
【干货】深入理解变分自编码器
专知
21+阅读 · 2018年3月22日
【干货】深入理解自编码器(附代码实现)
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
1+阅读 · 52分钟前
定向能反无人机系统最新发展动态
专知会员服务
3+阅读 · 今天13:50
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
2+阅读 · 今天13:33
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员