The Tsetlin Machine (TM) offers high-speed inference on resource-constrained devices such as CPUs. Its logic-driven operations naturally lend themselves to parallel execution on modern CPU architectures. Motivated by this, we propose an efficient software implementation of the TM by leveraging instruction-level bitwise operations for compact model representation and accelerated processing. To further improve inference speed, we introduce an early exit mechanism, which exploits the TM's AND-based clause evaluation to avoid unnecessary computations. Building upon this, we propose a literal Reorder strategy designed to maximize the likelihood of early exits. This strategy is applied during a post-training, pre-inference stage through statistical analysis of all literals and the corresponding actions of their associated Tsetlin Automata (TA), introducing negligible runtime overhead. Experimental results using the gem5 simulator with an ARM processor show that our optimized implementation reduces inference time by up to 96.71% compared to the conventional integer-based TM implementations while maintaining comparable code density.
翻译:Tsetlin机(TM)可在CPU等资源受限设备上实现高速推理。其逻辑驱动的运算特性天然适合在现代CPU架构上并行执行。受此启发,我们提出一种高效的TM软件实现方案,通过利用指令级位运算实现紧凑的模型表示与加速处理。为进一步提升推理速度,我们引入一种提前退出机制,该机制利用TM基于AND的子句求值特性来避免不必要的计算。在此基础上,我们提出一种字面量重排序策略,旨在最大化提前退出的概率。该策略通过统计所有字面量及其关联Tsetlin自动机(TA)的对应动作,在训练后、推理前的阶段实施,仅引入可忽略的运行时开销。基于gem5模拟器与ARM处理器的实验结果表明,相比传统的基于整数的TM实现,我们的优化方案在保持相近代码密度的同时,最高可减少96.71%的推理时间。