在微控制器上实现激活函数的常数时间方法
A Constant-Time Implementation Methodology for Activation Functions on Microcontrollers
AI总结:
本文提出了一种在嵌入式微控制器上实现激活函数的常数时间方法,通过结合无分支选择、固定成本Padé近似、必要的虚拟算术和周期对齐,实现了定时规律的激活函数实现,并验证了其在ReLU、sigmoid、tanh、GELU和Swish函数上的有效性。
摘要:
嵌入式神经网络推断可能通过定时侧信道泄露信息,包括由激活函数评估引起的泄露。本文提出了一种在嵌入式微控制器上实现激活函数的常数时间方法,并在ARM Cortex-M4平台上验证了ReLU、sigmoid、tanh、GELU和Swish函数。所提出的方法结合了无分支选择、固定成本Padé近似、必要的虚拟算术和周期对齐,以获得定时规律的激活函数实现。作为动机,我们评估了一种基于脱同步的防护措施,并展示了其仍易受基于模板的定时攻击攻击。实验结果表明,所得到的受保护实现对于所有测试输入具有相同的周期数,包括三函数设置下的88个周期和五函数设置下的108个周期。同时,数值误差分析表明,近似的非线性函数保留了高精度。这些结果表明,所提出的方法为构建在嵌入式推断中抗侧信道攻击的激活函数提供了实用基础。
英文摘要:
Embedded neural-network inference can leak information through timing side channels, including leakage caused by the evaluation of activation functions. This work proposes a constant-time implementation methodology for activation functions on embedded microcontrollers and validates it on ReLU, sigmoid, tanh, GELU, and Swish on an ARM Cortex-M4 platform. The proposed methodology combines branchless selection, fixed-cost Padé-based approximation, dummy arithmetic where needed, and cycle alignment to obtain timing-regular activation-function implementations. As motivation, we also evaluate a desynchronization-based countermeasure and show that it remains vulnerable to a template-based timing attack. Experimental results show that the resulting protected implementations achieve identical cycle counts for all tested inputs, including (88) cycles in the three-function setting and (108) cycles in the five-function setting. At the same time, the numerical-error analysis indicates that the approximated nonlinear functions retain high accuracy. These results suggest that the proposed methodology provides a practical basis for constructing side-channel-resistant activation functions in embedded inference.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。