arXiv:2610.19665cs.AROct 2026

Manuscript Offprint

arXiv:2610.19665

ESL-former: Event Sparse Linear Transformer for FPGA-Accelerated Malware Detection

Jun Yang, Yumeng Cao, Yingxuan Xiao, Changhong Li, Shangru Zhou

Jun Yang 1^{1}, Yumeng Cao 1^{1}, Yingxuan Xiao 1^{1}, Changhong Li 2∗^{2*}, and Shangru Zhou 3^{3}

1^{1} School of Computer Science and Engineering, Changsha University, China

2^{2} Electronics and Electrical Engineering, Trinity College Dublin, Ireland

3^{3} School of Mechanical and Electrical Engineering, Changsha University, China

Abstract. Transformer based intrusion detection has shown strong potential for identifying unknown malware variants, but its deployment on resource constrained edge devices remains difficult due to the high computational and memory cost of self attention. This paper presents an event sparse Linear Transformer framework for malware detection on FPGA edge platforms. Instead of relying on an explicit attention matrix, the proposed method derives token and channel importance directly from the accumulated key value state of Linear Transformer. A contribution aware scoring function is introduced to measure the perturbation of each token or kernel channel to the linear attention state, allowing redundant tokens and low contribution channels to be removed without constructing quadratic attention maps. To translate sparsity into practical hardware acceleration, the proposed design further replaces conventional binary mask based execution with a Top K active token buffer and a hardware compaction unit. The selected active tokens and channels are reorganized into dense fixed length data streams, enabling downstream processing elements to execute regular multiply accumulate operations with reduced redundant memory access and control overhead. This design is suitable for low power FPGA based malware detection, where both latency and on-chip resource usage are critical. Experimental evaluation demonstrates that the proposed sparse Linear Transformer can reduce hardware cost while preserving malware classification accuracy.

Keywords: Malware detection · Linear Transformer · Event sparsity · FPGA acceleration · Edge intelligence

1 Introduction

The rapid evolution of malware and network attacks has placed increasing pressure on traditional rule-based and signature-based malware detection systems. Rule-based engines remain important in high-speed network security systems, which offload Snort-compatible malware prevention workloads to FPGA hardware for 100 Gbps packet processing [1]. However, such systems are primarily driven by predefined rules and signatures, which limits their adaptability.

Yang et al.

when facing zero-day malware, obfuscated samples, and highly variant attack behaviours. This limitation has motivated the use of learning-based detection methods for malware and malware detection.

Deep learning-based detection methods can automatically learn discriminative semantic patterns from traffic features, binary code, or malware image representations. Transformer models provide stronger contextual modelling capability through self-attention, making them attractive for detecting complex malware patterns and highly variant malicious behaviours. Despite their modelling capability, Transformer models impose substantial computation and memory overhead. Standard self-attention explicitly constructs a token-to-token attention matrix, whose computational and memory complexity grows quadratically with the sequence length [2–4].

FPGAs are an ideal platform for edge IDS deployment due to their flexibility and high-speed computing capabilities. Recent FPGA Transformer accelerators have attempted to reduce this cost using window attention [2], complete FPGA mapping flows for large language model inference [5], low-complexity encoder-only Transformer designs [6], and linear attention acceleration for vision Transformer workloads [4]. These studies demonstrate the feasibility of efficient Transformer deployment on FPGA platforms, but resource-constrained malware detection on small edge FPGAs still requires further optimisation.

Linear Transformer offers an attractive alternative by replacing explicit softmax attention with a kernel-based formulation. Instead of materialising the full attention matrix, it accumulates key-value information into a compact global state, thereby reducing the dominant attention complexity from quadratic to linear with respect to the sequence length [3, 4]. This property is particularly suitable for edge FPGA deployment because it reduces attention memory pressure and avoids storing dense attention maps. However, the linear attention formulation also changes the basis for sparsification. Many existing sparse Transformer methods are designed around standard attention, where token importance can be estimated from attention maps, dynamic masks, or structured sparse patterns [2, 7, 8]. These assumptions do not directly apply to Linear Transformer, since the attention matrix is not constructed during inference.

Therefore, an effective sparse Linear Transformer for FPGA-based malware detection requires two key components. First, the sparsity metric should be mathematically aligned with the key-value state update mechanism of Linear Transformer, rather than relying on an explicit attention matrix. Second, the sparse execution scheme should translate algorithmic sparsity into actual hardware savings, including fewer loop iterations, reduced BRAM accesses, and fewer multiply-accumulate operations. Prior sparse Transformer accelerators have explored dynamic sparse attention [7] and full N: M sparsity for FPGA-based Transformer architectures [8]. However, mask-based or irregular sparse execution can still introduce additional control overhead on FPGA, such as mask loading, conditional checking, sparse index handling, and non-contiguous memory access. These overheads are particularly harmful for small edge FPGAs.

To address these challenges, this paper proposes ESL-former, an Event Sparse Linear Transformer framework for FPGA-accelerated malware detection. The framework first adopts a lightweight Linear Transformer backbone to avoid explicit quadratic attention computation. It then introduces an event sparsity mechanism inspired by the event-driven sparsity concept in spiking Transformer acceleration [9]. The proposed mechanism derives token and channel importance directly from the accumulated key-value state of the Linear Transformer. Rather than using an external prediction module or an explicit attention map, ESL-former measures how strongly each token or kernel channel contributes to the runtime linear attention state. Low-contribution tokens and channels are removed after kernel feature mapping and before the key-value state update, thereby reducing redundant computation in the actual attention dataflow.

The main contributions of this paper are summarised as follows.

– We propose ESL-former, a lightweight event-sparse Linear Transformer framework for FPGA-accelerated malware detection on resource-constrained edge platforms.

– We introduce a contribution-aware token and channel scoring method that is directly derived from the key-value state accumulation of Linear Transformer.

– We design a hardware-oriented Top-K sparse execution scheme that replaces binary mask-based sparsity with active token buffering and channel compaction.

– We implement and evaluate ESL-former on the PYNQ-Z2 FPGA platform for IMG_DS malware image detection. Experimental results show that ESL-former achieves up to 41.56×41.56\times end-to-end speedup over ViT4Mal while maintaining competitive detection performance.

The remainder of this paper is organised as follows. Section 3 describes the proposed event-sparse Linear Transformer and its hardware-oriented sparse execution scheme. Section 4 presents the experimental results on quantization, sparse execution, on-board hardware performance, and malware detection. Finally, Section 5 concludes the paper.

References (22)