Paper deep dive
Logic Gate Networks and Lookup Table Networks as Lightweight Hardware Classifiers for Inter-patient ECG Arrhythmia Classification
Wout Mommen, Lars Keuninckx, Siddharth Patil, Paul Detterer, Achiel Colpaert, Piet Wambacq
Intelligence
Status: not_run | Model: - | Prompt: - | Confidence: 0%
Entities (0)
Relation Signals (0)
No relation signals yet.
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Deep Differentiable Logic Gate Networks (LGNs) and Lookup Table Networks (LUTNs) offer a promising approach for very low power inference due to their use of simple binary logic operations instead of arithmetic. In this work, we generalize the logic gates of LGNs to more than two input pins, naturally arriving at networks consisting of $N$-input LUTs. To obtain a differentiable expression for training the $N$-LUT entries, we adopt the Boolean equation of a $2^N$:1 multiplexer (MUX) and optimize its input parameters during training. We investigate the applicability of LGNs and LUTNs to inter-patient ECG arrhythmia classification using the MIT-BIH data set. The proposed models achieve up to 94.41\% accuracy and a $j\kappa$ index of 0.683 on a four-class task, showing a competitive performance compared to existing CNN-, SVM- and SNN-based methods. Our LGNs and LUTNs only require an estimated 2.89k to 6.17k FLOPs, including preprocessing and readout, which is three to six orders of magnitude less than state-of-the-art methods. We verified our design, which consists of the preprocessing pipeline and a 6-LUTN classifier, by implementing it on a Xilinx Zynq-7000 ZedBoard. The complete system consumes a dynamic energy of 8.25 $\mu$J/inference, of which only 0.46 nJ is utilized by the LUTN classifier. These results show that both LGNs and LUTNs can be employed as lightweight hardware-based classifiers for inter-patient ECG arrhythmia classification.
Tags
Links
- Source: https://arxiv.org/abs/2609.32854v1
- Canonical: https://arxiv.org/abs/2609.32854v1
Trouble viewing inline? Open PDF directly →
Full Text
94,337 characters extracted from source content.
Expand or collapse full text
Logic Gate Networks and Lookup Table Networks as Lightweight Hardware Classifiers for Inter-patient ECG Arrhythmia Classification Journal: Computers in Biology and Medicine Wout Mommen Email: wout.mommen@imec.be Corresponding author: Corresponding author. Affiliation: Interuniversity Microelectronics Centre (IMEC), Kapeldreef 75, Leuven, 3001, Belgium Affiliation: Vrije Universiteit Brussel, Pleinlaan 2, Elsene, 1050, Belgium Lars Keuninckx Email: lars.keuninckx@imec.be Affiliation: Interuniversity Microelectronics Centre (IMEC), Kapeldreef 75, Leuven, 3001, Belgium Siddharth Patil Affiliation: Interuniversity Microelectronics Centre (IMEC), Kapeldreef 75, Leuven, 3001, Belgium Paul Detterer Email: paul.detterer@imec.nl Affiliation: imec Holst Centre, High Tech Campus 31, Eindhoven, 5656 AE, the Netherlands Achiel Colpaert Email: achiel.colpaert@imec.be Affiliation: Interuniversity Microelectronics Centre (IMEC), Kapeldreef 75, Leuven, 3001, Belgium Piet Wambacq Email: piet.wambacq@imec.be Affiliation: Interuniversity Microelectronics Centre (IMEC), Kapeldreef 75, Leuven, 3001, Belgium Affiliation: Vrije Universiteit Brussel, Pleinlaan 2, Elsene, 1050, Belgium Abstract Deep Differentiable Logic Gate Networks (LGNs) and Lookup Table Networks (LUTNs) offer a promising approach for very low power inference due to their use of simple binary logic operations instead of arithmetic. In this work, we generalize the logic gates of LGNs to more than two input pins, naturally arriving at networks consisting of N-input LUTs. To obtain a differentiable expression for training the N-LUT entries, we adopt the Boolean equation of a 2N2^N:1 multiplexer (MUX) and optimize its input parameters during training. We investigate the applicability of LGNs and LUTNs to inter-patient ECG arrhythmia classification using the MIT-BIH data set. The proposed models achieve up to 94.41% accuracy and a jκjκ index of 0.683 on a four-class task, showing a competitive performance compared to existing CNN-, SVM- and SNN-based methods. Our LGNs and LUTNs only require an estimated 2.89k to 6.17k FLOPs, including preprocessing and readout, which is three to six orders of magnitude less than state-of-the-art methods. We verified our design, which consists of the preprocessing pipeline and a 6-LUTN classifier, by implementing it on a Xilinx Zynq-7000 ZedBoard. The complete system consumes a dynamic energy of 8.25 µJ/inference, of which only 0.46 nJ is utilized by the LUTN classifier. These results show that both LGNs and LUTNs can be employed as lightweight hardware-based classifiers for inter-patient ECG arrhythmia classification. Keywords: Electrocardiography , Monitoring , Edge AI , Ultra low power , Logic gates , Lookup tables , Backpropagation 1 Introduction The World Health Organization (WHO) states that cardiovascular diseases (CVDs) are the leading cause of death globally, accounting for nearly 17.9 million deaths each year [31]. Hence, measures need to be taken for early detection or monitoring of such CVDs. Heart implants or even wearables could obtain the necessary information, provided that the battery-operated hardware uses very low power. Often, the MIT-BIH arrhythmia data set [20] is used as a first step to benchmark different technologies or algorithms for ECG arrhythmia classification, irrespective of the power usage [19, 7, 13, 27]. However, if these algorithms are envisioned to run on small embedded devices such as pacemakers, where having to replace the battery is undesirable, care should be taken regarding the power and energy consumption of these solutions. Quantization and pruning of artificial neural networks have been used in the past to increase power and energy efficiency of these algorithms [11]. A next approach is to use a Spiking Neural Network (SNN) to realize the arrhythmia classification [16, 32]. To further reduce energy consumption, researchers have explored non-conventional computing systems. For example, the use of Monostable Multivibrator (MMV) networks has been shown to improve power efficiency and is straightforward to implement in hardware [12]. These MMV networks use simple digital timers as their basic element. Building on this trend, recent studies have demonstrated that the network elements can be reduced even further, enabling trainable networks of digital logic gates to tackle a wide range of tasks. These Deep Differentiable Logic Gate Networks (LGNs) [23] are constructed from a 2-input logic gate network configuration with randomly chosen fixed connections. Given a certain data set, the optimal gate types are learned utilizing traditional backpropagation techniques. Similarly, networks built from simple Lookup Tables (LUTs) have been proposed in literature under different names: LUTNet [29, 30], LogicNets [26], NullaNet [21], PolyLUT [1], NeuraLUT [2], Differentiable Weightless Neural Networks (DWNs) [4] and Walsh-Assisted Relaxation for Probabilistic Look-Up Tables (WARP-LUTs) [10]. For clarity, in this work, we will use the term Lookup Table Network (LUTN) since this best represents its essence. Although a LUT element consists of multiple logic gates, it offers two advantages over LGNs. Firstly, a LUT is a reconfigurable element that enables a single LUTN architecture to execute different functionalities. Secondly, a LUT can have more than two input ports, allowing for more complex neuron functions. To create a LUTN for a specific application, two methods have been presented. First, a regular neural network can be converted into a LUTN using a multitude of techniques [29, 30, 26, 21, 1, 2]. Alternatively, a LUTN can be trained directly [4, 10]. The first solution allows for conventional neural network training, but the final accuracy is lower and the number of LUTs is higher compared to directly trainable LUT networks. Questions remain open on whether a LUTN can be used for efficient arrhythmia classification, what potential data preprocessing would be required, and how to efficiently train these LUT networks for this type of application. In this work, to address the aforementioned open questions, we propose an ECG classification system using LUTNs by implementing a novel training method and preprocessing method. The contributions of this work are: 1. We present a systematic evaluation of Deep Differentiable Logic Gate Networks (LGNs) and Lookup Table Networks (LUTNs) for ECG arrhythmia classification using the inter-patient training and testing paradigm. This evaluation is compliant with the guidelines of the Association for the Advancement of Medical Instrumentation (AAMI). Although the LGNs have been explored for ECG classification in prior work, this study focuses on a mixed-patient setting. In contrast, this work analyses the LGNs and LUTNs under the more challenging inter-patient paradigm, which better represents real-world scenarios. 2. The models that are studied obtain a competitive performance for the four-class MIT-BIH classification task, achieving competitive results compared to CNN-, SVM-, SNN-based models using comparable evaluation methods, while requiring only an estimated 2.89k to 6.17k operations, including preprocessing and readout. 3. We analyse the behaviour and limitations of LGN-based and LUT-based models for ECG classification, including LUT input size, network depth, and rate coding, identifying the practical regimes in which these models operate effectively. 4. We show that logic-based ECG classifiers can be implemented on FPGA hardware in an efficient and straightforward manner. Rather than targeting a specific deployment platform, the FPGA implementation serves as a verification for our preprocessing and classification methodologies. The estimated power consumption, resource utilization, and latency are reported. These results provide an early indication that our proposed approach has potential for ultra-low-complexity edge deployment. 2 Related work Spiking Neural Networks (SNNs) [15] are often adopted as energy-efficient AI models for a wide range of applications, including ECG arrhythmia classification. Mao et al. [16] benchmark the MIT-BIH data set on an SNN, achieving an accuracy of 93.67% using 0.3 µJ per inference on a chip with a leakage power of 1.14 µW. Yan et al. [32] trained a two-stage CNN on the MIT-BIH data set. The first classifier acts as a wake-up system to determine if there is a normal heartbeat or an arrhythmia and the second classifier determines the type of arrhythmia. Both CNNs were converted to SNNs using rate coding, achieving an accuracy of 90.00% and a jκ index of 0.609. The jκ index is a figure of merit commonly used for the MIT-BIH data set, where higher values indicate a better classification performance. The estimated power to run these SNNs back to back is 77 mW. Deep Differentiable Logic Gate Networks (LGNs) were first introduced by Petersen et al. [23]. An LGN is a network of randomly connected 1-input and 2-input logic gates. The gate layers are connected to each other using randomly chosen connections that remain fixed during training. The gate type, on the other hand, is learned using backpropagation by creating a linear combination of the operations fif_i of all 16 gate types and learning the corresponding coefficients wiw_i. One can apply the softmax function on the coefficients, essentially learning a discrete probability distribution pip_i over all possible gate types. The output of the combination of gate types (i.e. an LGN “neuron”) is the activation and is given by [23] a=∑i=015i⋅fi(x0,x1)=∑i=015ei∑jej⋅fi(x0,x1).a= _i=0^15 p_i· f_i (x_0,x_1 )= _i=0^15 e w_i _je w_j· f_i (x_0,x_1 ). (1) The real-valued logic operations fif_i used in this formula can be found in Table 1. Since Eq. (1) is differentiable, backpropagation is utilized to learn the most optimal gate type for each gate in the network. To finalize the training procedure, the gate type with the highest probability is chosen for each gate-type superposition. This final network is then employed for inference. After the final layer of the network, population counters are utilized to determine the predicted class label. The population counters are constructed as follows: First, the number of gates G in the final layer, needs to be dividable by the number of classes C. Next, the output values of gate 1 until gate G/CG/C are summed, which becomes the population count of the first class. For the population count of the second class, the gate outputs from gate G/C+1G/C+1 to 2G/C2G/C are summed. The population counts of the other classes are calculated in a similar manner, i.e. for class i, the gate output values of gate (i−1)⋅G/C+1(i-1)· G/C+1 until gate i⋅G/Ci· G/C, with i=1,…,Ci=1,…,C, are summed. The highest value of these population count values or group sums determines the predicted class label. During training, these population count values are converted to probabilities using a softmax function with a temperature scaling factor T, which is a hyperparameter of the model. Besides feedforward LGNs, it is also possible to create recurrent [5] and convolutional architectures [24]. All of these architectures exhibit very low power consumption at a high throughput, as they are essentially networks of 2-input logic gates. It is also possible to train the connections of these networks [18], resulting in a much smaller network with a similar performance. Apart from the classical LGNs, Gumbel LGNs [33] have been proposed, which use Gumbel noise to decrease training time, increase the number of used neurons, and decrease the discretization gap. Here, the discretization gap is a small drop in accuracy that occurs when we choose the gate type with the highest probability value for each gate-type superposition in Eq. (1). Table 1: The index of summation i, corresponding binary operation, truth table and real-valued logic operation fif_i utilized in Eq. (1) [23]. i Operation 00 01 10 11 fif_i 0 False 0 0 0 0 0 1 x0x_0 ∧ x1x_1 0 0 0 1 x0x1x_0x_1 2 ¬ (x0x_0 ⇒ x1x_1) 0 0 1 0 x0−x0x1x_0-x_0x_1 3 x0x_0 0 0 1 1 x0x_0 4 ¬ (x0x_0 ⇐ x1x_1) 0 1 0 0 x1−x0x1x_1-x_0x_1 5 x1x_1 0 1 0 1 x1x_1 6 x0x_0 ⊕ x1x_1 0 1 1 0 x0+x1−2x0x1x_0+x_1-2x_0x_1 7 x0x_0 ∨ x1x_1 0 1 1 1 x0+x1−x0x1x_0+x_1-x_0x_1 8 ¬ (x0x_0 ∨ x1x_1) 1 0 0 0 1−(x0+x1−x0x1)1-(x_0+x_1-x_0x_1) 9 ¬ (x0x_0 ⊕ x1x_1) 1 0 0 1 1−(x0+x1−2x0x1)1-(x_0+x_1-2x_0x_1) 10 ¬ x1x_1 1 0 1 0 1−x11-x_1 11 x0x_0 ⇐x1 x_1 1 0 1 1 1−x1+x0x11-x_1+x_0x_1 12 ¬ x0x_0 1 1 0 0 1−x01-x_0 13 x0x_0 ⇒ x1x_1 1 1 0 1 1−x0+x0x11-x_0+x_0x_1 14 ¬ (x0x_0 ∧ x1x_1) 1 1 1 0 1−x0x11-x_0x_1 15 True 1 1 1 1 1 Lookup Table Networks (LUTNs) [4] are similar to LGNs, but instead of using logic gates as “neurons”, Lookup Tables (LUTs) are employed. These LUTNs can be seen as a generalization of LGNs, in the sense that a LUT transforms an N-bit input value into one binary output value, while a logic gate transforms a 2-bit input value into one binary output value. Hence, a 2-LUTN is equivalent to an LGN. Due to the increased complexity of the “neurons”, an N-input LUT can learn exponentially more functions compared to a logic gate. Namely, the number of possible functions scales as 22N2^2^N, as can be seen from Table 2. The most basic building block of most FPGAs is the 6-LUT. Thus, having the ability to directly learn a network of 6-LUTs on a specific data set can lead to very efficient implementations of AI algorithms on FPGAs. Additionally, due to the high complexity of these 6-LUTs compared to logic gates, it is expected that we will need fewer neurons (i.e. LUT primitives) and hence less global interconnect for chip implementations. Consequently, chips could be smaller and routing easier when using 6-LUTs compared to logic gates. Along with reconfigurability, this is the primary motivation for switching from LGNs to LUTNs. Some research has already been conducted on LUTNs. Wang et al. [29, 30] take a pruned XNOR-Net [25] and convert it to a network of LUTs, called LUTNet. This network still includes activation functions and accumulation operations. Umuroglu et al. introduce LogicNets [26], which are sparse quantized neural networks converted into networks of LUTs. They manage to map an artificial neuron with limited and quantized inputs (X) and outputs (Y) to an X:Y logical LUT, which can be implemented on FPGAs using their underlying hardware primitives, such as 6:1 or 5:2 physical LUTs. The transformation from neuron to logical LUT eliminates the need for multiply and accumulate operations, making the computation more efficient. The final model only consists of physical LUTs and the connectivity between them. Nazemi et al. introduce NullaNet [21], and also convert neurons to logical LUTs. Conversely, these logical LUTs are converted to sum-of-products terms and are next converted to logic gates using a logic synthesis tool, which optimizes for area, delay, and power consumption. Andronic et al. propose PolyLUT [1], which is similar to LogicNets, since it also maps neurons to logical and physical LUTs. However, their neuron contains multivariate polynomials instead of a linear transformation. In that way, fewer physical LUTs are needed to match a similar accuracy. Following this, Andronic et al. present NeuraLUT [2], that builds further on PolyLUT, modelling entire sub-networks in the same size logical LUT. Previous methods train conventional neural networks and convert them to networks of LUTs; yet, research has also been conducted on directly constructing networks of LUTs. Bacellar et al. [4] train both the connections and LUT entries in a network of LUTs they call a Differentiable Weightless Neural Network (DWN). They utilize an extended finite difference method to train the LUT. Gerlach et al. [10] continue on the works of the original LGNs and Gumbel LGNs towards an algorithm called Walsh-Assisted Relaxation for Probabilistic Look-Up Tables (WARP-LUTs). These are networks of 2-input LUTs that are trained with backpropagation, but require fewer parameters and training time compared to LGNs and Gumbel LGNs. As of the time of writing, networks consisting of LUTs with more than two input pins have not been tried out using this method. Table 2: The primitive and number of binary operations it can express. An N-LUT stands for a lookup table with N input pins. Primitive No. binary functions 2-LUT 1616 4-LUT 65 53665\ 536 6-LUT 1.845⋅10191.845· 10^19 N-LUT 22N2^2^N 3 Methodology In this section, we will first describe the data set and which part of the data is used for training and testing. Following this, we explain the novel preprocessing method for extracting the features that are the inputs to the models. Subsequently, we describe the training method for LGNs and how rate coding is applied to improve performance. Next, the training method of the LUTNs is delineated. Finally, we describe the evaluation metrics and experimental protocol that are adopted in this work. 3.1 Preprocessing 3.1.1 MIT-BIH data set The data set contains 48 two-channel ECG recordings, each about 30 minutes long, originating from 47 patients. This results in approximately 100000 heartbeats, containing both normal heartbeats and various arrhythmias [20]. The signal was recorded at a sample rate of 360 Hz with a resolution of 11 bits, and independently labeled by two or more cardiologists. We only utilized one channel and omit certain parts of the data as explained in the next subsection. 3.1.2 Train-test split The data set was split into a train set (DS1) and test set (DS2) according to the inter-patient scheme designed by [7]: 1. DS1: 101, 106, 108, 109, 112, 114, 115, 116, 118, 119, 122, 124, 201, 203, 205, 207, 208, 209, 215, 220, 223, 230 2. DS2: 100, 103, 105, 111, 113, 117, 121, 123, 200, 202, 210, 212, 213, 214, 219, 221, 222, 228, 231, 232, 233, 234 Here, each number designates a patient recording, where one channel of the two-channel signal was used, following the protocol employed in [19, 13]. As proposed by the Association for the Advancement of Medical Instrumentation (AAMI), patient records containing paced beats (102, 104, 107, 217) were removed [3]. Additionally, beats were grouped together in new classes according to the AAMI guidelines [3]: N, L, R →N (89 474=45 626+43 848) (89\,474=45\,626+43\,848) e, j, A, a, J, S →S (6 986=3 778+3 208) (6\,986=3\,778+3\,208) V, E →V (3 018=975+2 043) (3\,018=975+2\,043) F →F (801=413+388) (801=413+388) Q,/,f →Q (15=8+7). (15=8+7). Following these guidelines as in [17, 19, 35], the Q class is ignored, since there are only 15 examples in the data set (8 train examples and 7 test examples). This results in a four-class classification problem: normal heartbeats (N), supraventricular ectopic beats (S or SVEB), ventricular ectopic beats (V or VEB), and beats resulting from the fusion of VEBs and normal beats (F) [7]. 3.1.3 Feature extraction The goal of the feature extraction step is to convert the full-precision raw ECG data into meaningful (binary) features from which the classifier can distinguish the four different classes more easily. Since both LGNs and LUTNs work with binary input values, a binary feature vector of length 138 was constructed containing the following parameters: [R1,R2,R3,R4,ΔRRp,ΔRRm, [R_1,R_2,R_3,R_4, R_p, R_m, (2) RRlocCV,RRratio,tb,M1,M2,M4,cf1,cf2,δ]. R_locCV,R_ratio,t_b,M_1,M_2,M_4,cf_1,cf_2,δ]. Each of these features is explained in the following paragraphs. First, for each peak position R0R_0, the next peak position Rp1R_p1 and three previous peak positions Rm1R_m1, Rm2R_m2 and Rm3R_m3 were extracted as seen in Fig. 1. The peak positions originate from the MIT-BIH data set itself, hence no peak detection algorithm was utilized. Using these peak positions the R-intervals [19, 16] RR1R_1, RR2R_2, RR3R_3 and RR4R_4 were determined. Each of the intervals was encoded into an 8-bit binary number. The features ΔRRp R_p and ΔRRm R_m designate the R-interval changes [16] and are simply sign bits: ΔRRp R_p =1 if RR1>RR20 otherwise = cases1& if R_1>R_2\\ 0& otherwise cases ΔRRm R_m =1 if RR2>RR30 otherwise. = cases1& if R_2>R_3\\ 0& otherwise. cases Inspired by [19], the local R interval was determined, specifically RR2R_2 of n=500n=500 previous examples was calculated. Following this, the mean m and standard deviation s of this list of numbers were calculated to obtain the coefficient of variation s/ms/m. To save power, this value was updated for each heartbeat, rather than calculating it fully anew at every beat. The coefficient of variation s/ms/m was converted to binary numbers by using thresholds of 0.5 and 0.1 to obtain a two-bit feature RRlocCVRR_locCV for each heartbeat. Additionally, the R-ratio RRratio=RR1/mRR_ratio=R_1/m was calculated and converted to two binary values by comparing its value to thresholds 0.25 and 0.5. Another feature to be extracted was the tachycardia bit tbt_b, to assess if the currently selected heartbeat occurs at a rate faster than 100 bpm, which was determined using the local R-interval. Figure 1: Excerpt of the ECG data highlighting the current R-peak position R0R_0, three previous R-peak positions Rm1R_m1, Rm2R_m2, Rm3R_m3, and the next R-peak position Rp1R_p1. Using these peak positions, all four R-interval features were derived. Around each peak, we define a gray window of 180 samples that was utilized to determine the morphological features M1M_1 to M4M_4 and the crest factor cf1cf_1. Hereafter, morphological features were extracted in a similar manner as [19]: 1. M1=|ecg[R0]−min(beat[0:40])|/normM_1= |ecg[R_0]-min(beat[0:40]) |/norm 2. M2=|ecg[R0]−min(beat[65:85])|/normM_2= |ecg[R_0]-min(beat[65:85]) |/norm 3. M3=|ecg[R0]−min(beat[95:105])|/normM_3= |ecg[R_0]-min(beat[95:105]) |/norm 4. M4=|ecg[R0]−min(beat[150:180])|/norm.M_4= |ecg[R_0]-min(beat[150:180]) |/norm. Here, ecg is the array containing the values of a patient’s recording, beat is an array containing 180 values around the center peak R0R_0 representing one heartbeat, and norm=max(beat)−min(beat)norm=max(beat)-min(beat). For the final feature vector, M3M_3 was excluded, since this increased the accuracy. All these features were encoded into 3 bits. Additionally, the crest factor was determined for better distinguishing normal beats from ventricular ectopic beats. The crest factor is defined as the peak amplitude of the complete heartbeat window divided by its RMS value. The crest factor cf1cf_1 was determined for a window of 180 samples, and cf2cf_2 for a window of 400 samples centered at R0R_0. Each crest factor was encoded into 8 bits. Finally, delta encoding was applied as in [16], obtaining 74 binary numbers represented by δ in the feature vector of Eq. (2). 3.2 Deep Differentiable Logic Gate Networks The Deep Differentiable Logic Gate Networks (LGNs) were trained in the same manner as described in [23] with fixed connections and a learning rate of 0.01. All networks had 8000 gates per layer and were trained for 200 epochs using a batch size of 100. A visualization of a 3-layer LGN that predicts the four classes N, S, V and F is shown in Fig. 2. This illustration shows the binary inputs, feedforward gate network, and population counts for the different classes at the output. In the figure, we only have two final-layer gates per popcount, therefore the maximum popcount value is equal to two. However, in this work, we employ 8000 gates per layer, such that the maximum popcount value equals 2000. While training the LGN, the gate types are learned using the differentiable expressions from Table 1. At inference, the inputs to the gates are binary values. Yet, during training, xj∈[0,1]x_j∈[0,1] with j=1,2j=1,2 in these expressions are interpreted as probabilities or rates. More formally, if X0,X1∈0,1X_0,X_1∈\0,1\ are binary random variables, then the probabilistic interpretation states that P(X0=1)=x0P(X_0=1)=x_0 and P(X1=1)=x1P(X_1=1)=x_1, where x0x_0 and x1x_1 are rates. To obtain the expressions in Table 1, the rates, which correspond to bit streams, need to be independent. For example, the output rate of an XOR gate is given by P(X0⊕X1=1) P(X_0 X_1=1) =P(X0=1,X1=0)+P(X0=0,X1=1) =P(X_0=1,X_1=0)+P(X_0=0,X_1=1) =P(X0=1)P(X1=0)+P(X0=0)P(X1=1) =P(X_0=1)P(X_1=0)+P(X_0=0)P(X_1=1) =x0(1−x1)+(1−x0)x1 =x_0(1-x_1)+(1-x_0)x_1 =x0+x1−2x0x1, =x_0+x_1-2x_0x_1, matching the expression in Table 1 and which assumes independent probabilities or bit streams. The other Boolean operations in Table 1 follow the same reasoning. Crucially, during training, there is no need to convert the inputs into bit streams; we simply propagate full-precision values between 0 and 1 that represent infinitely long bit streams as part of rate coding. This method not only makes training very fast compared to employing bit streams, but it also ensures that the model achieves the best possible performance when using rate coding. Of course, during inference, one has to use finite-length bit streams, usually resulting in a slightly lower performance depending on the length of the bit stream. In the limit of infinitely long bit streams, the discrete logic gate operations will converge to fif_i. The full-precision feature values of Eq. (2) were used as inputs for the networks using rate coding. Furthermore, an additional R ratio, RR2/mRR_2/m is added, since this increased the performance, resulting in 89 input features. For networks with non-rate-coded inputs, the conventional way of training these networks was employed by utilizing the binary input vector Eq. (2). Figure 2: A visualization of a 3-layer LGN that predicts four classes: N, S, V and F. The input values are binary numbers, and are propagated through the network. The final layer groups the gates, and counts the number of 1’s that appear at the gate-outputs for each group. The group sum (i.e. popcount) that has accumulated the highest value is the winner and assigns the corresponding class label to the example. In reality, we employ LGNs with 8000 gates per layer instead of just eight as displayed in the figure, meaning that the maximum popcount value is equal to 2000 instead of two. 3.3 Lookup Table Networks 3.3.1 Proposed training method A Lookup Table Network (LUTN) is a network that consists of N-input LUTs, arranged in layers. Each LUT receives N binary input values and produces one binary output value. Fig. 3 displays an example of a 4-layer LUTN consisting of 6-LUTs. The binary input values are propagated through the network layers, and similarly to the LGNs, the group sum with the highest value gives the predicted class label. In essence, a LUTN is the same as an LGN, but now the 2-input logic gates are replaced with more general N-input LUTs. The method for training the LUTNs is based on the fact that a LUT in an FPGA is implemented as a MUX. As an example, the Boolean equation of an 88:11 MUX is given by the following equation: Lout=W0L0L1L2¯+W1L0L1¯L2+…+W7L0L1L2.L_out=W_0 L_0L_1L_2+W_1 L_0L_1L_2+…+W_7L_0L_1L_2. (3) Here LoutL_out is the output value of the MUX, W0,…,W7W_0,…,W_7 are the input values of the MUX, and L0,L1L_0,L_1 and L2L_2 are the selector bits. Alternatively, this can also be viewed as a 3-input LUT, where the input values L0,L1L_0,L_1, and L2L_2 determine which of the eight LUT entries W0,…,W7W_0,…,W_7 is selected to produce the output value LoutL_out. The equivalence between a LUT and a MUX is shown graphically in Fig. 4. Note that this formula is differentiable; hence, backpropagation can be used to find the optimal LUT entries. During training, full-precision values between 0 and 1 are propagated through the network. At inference time, the network only utilizes binary values. Figure 3: An illustration of a 4-layer Lookup Table Network (LUTN) that consists out of 6-input LUTs. The binary input values are propagated through the LUT layers, where each hidden layer performs a learned binary transformation on its received binary input values. The LUTs in the final layer are grouped. Each group corresponds with a popcount that counts the number of 1’s. The popcount with the highest value gives the predicted class label. In this illustration, only eight 6-LUTs per layer are displayed, such that the maximum popcount value is equal to two. For the MIT-BIH data set, we utilize 2000 6-LUTs per layer, such that the maximum popcount value is equal to 500. Figure 4: Equivalence between an 8:1 MUX and a 3-input LUT. Left: An 8:1 MUX with 8 input values, 3 selector bits and one output value. Middle: A lookup table with entries W0,…,W7W_0,…,W_7, which are input values of the MUX. Right: The symbol we will employ for a LUT with three input values and one output value. In general, an N-input LUT is represented by a 2N2^N:11 MUX. The generalized formula for an N-input LUT is given by Lout L_out =∑i=02N−1Wi∏j=0N−1(s¯i,jL¯j+si,jLj) = _i=0^2^N-1W_i _j=0^N-1 ( s_i,j L_j+s_i,jL_j ) (4) with =(00⋯0000⋯0100⋯1011⋯11.). = pmatrix0&0&·s&0&0\\ 0&0&·s&0&1\\ 0&0&·s&1&0\\ && &&\\ 1&1&·s&1&1.\\ pmatrix. (5) Here, WiW_i are the trainable weights, which are the entries of the LUT. The values of WiW_i are continuous and are binarized during training as in [12], but in a layer-wise fashion. The sum in this equation is performed over all 2N2^N LUT-entries, where N is the number of input pins of the LUT. In addition, LjL_j with j=0,…,N−1j=0,…,N-1 are the input values of the LUT. LoutL_out is the LUT output value, which is the LUT entry that is selected based on the input values LjL_j. In this general formula, the constant 2N×N2^N× N selector matrix s, which lists integers 0 through 2N−12^N-1 in binary format, is used to select the correct Boolean variables Lj¯ L_j or LjL_j for each input index j and each LUT entry index i. During training, one must consider the batch size and the number of LUTs per layer, so that the above LoutL_out variable becomes a matrix of size B×OB× O, with B the batch size and O the layer size. The PyTorch pseudo-code for training a layer of LUTs that makes use of the above method is presented in Algorithm 1. Here B is the batch size, I is the input size of a layer, O is the output size of a layer, and N is the number of input pins of a LUT. Algorithm 1 Forward pass of a LUTN layer 0: dim(input)=B×Idim(input)=B× I 0: dim(idx)=O×Ndim(idx)=O× N 0: dim(W)=2N×Odim(W)=2^N× O 0: dim(s)=2N×Ndim(s)=2^N× N 0: LoutL_out is calculated according to Eq. (4) L←input[:,idx].unsqueeze(2)L← input[:,idx].unsqueeze(2) L←broadcast_to(L,(B,O,2N,N))L← broadcast\_to(L,(B,O,2^N,N)) L←torch.prod(L⋅s+(1−L)(1−s),dim=−1)L← torch.prod(L· s+(1-L)(1-s),dim=-1) L←torch.transpose(L,1,2)L← torch.transpose(L,1,2) Lout←torch.sum(L⋅W,dim=1)L_out← torch.sum(L· W,dim=1) return LoutL_out 3.3.2 Probabilistic interpretation While training, the LjL_j values will be real numbers, and only after binarization will Lj∈0,1L_j∈\0,1\. We will now show that when these continuous valued LjL_j parameters are employed in the aforementioned LUT equation, this will lead to a probabilistic interpretation of the LUT primitive. Let Xj∈0,1X_j∈\0,1\ be a Bernoulli distributed random variable with parameter Lj∈[0,1]L_j∈[0,1]. In addition, let ∈0,1Nb∈\0,1\^N be a LUT address, i.e. bj=sijb_j=s_ij, where N is the number of LUT input pins. Then the LUT-equation Eq. (4), can be rewritten as Lout L_out =∑∈0,1NW∏j=0N−1Ljbj(1−Lj)1−bj = _b∈\0,1\^NW_b _j=0^N-1L_j^b_j(1-L_j)^1-b_j (6) =∑∈0,1NW∏j=0N−1P(Xj=bj) = _b∈\0,1\^NW_b _j=0^N-1P(X_j=b_j) (7) =∑∈0,1NWP(=) = _b∈\0,1\^NW_b\,P(X=b) (8) =[W]. =E\! [W_X ]. (9) The input values of the LUT, Lj∈[0,1]L_j∈[0,1], now represent the probability of the input being equal to one: P(Xj=1)=LjP(X_j=1)=L_j. Note that we assumed independent probabilities, i.e. P(=)=P(X0=b0,…,XN−1=bN−1)=∏j=0N−1P(Xj=bj)P(X=b)=P(X_0=b_0,…,X_N-1=b_N-1)= _j=0^N-1P(X_j=b_j), and thus independent bit streams and rates LjL_j. In the last step, we defined a random variable W_X, such that the LUT output value becomes equal to the expected value over all LUT entries. If Wi∈[0,1]W_i∈[0,1], the LUT output value Lout∈[0,1]L_out∈[0,1] represents the output rate of the LUT. 3.3.3 Relation to DWNs and WARP-LUTs The proposed method and Differentiable Weightless Neural Networks (DWNs) [4] are closely related. Both methods directly train networks of differentiable N-input LUTs using backpropagation. When N=6N=6, such LUTs naturally correspond to the primitive 6-LUTs available in modern FPGAs. To learn the LUT entries, DWNs employ an Extended Finite Difference method, while our proposed method employs a hardware-inspired differentiable MUX equation. Hence, both methods are able to learn the same LUT functions, but use a different differentiable LUT model during training. Our method places DWNs in a probabilistic interpretable setting and is purely used as an alternative to DWNs. The LUTNs also differ from WARP-LUTs [10], which parameterize LUTs using Walsh-Hadamard coefficients, reducing the number of learnable parameters compared to softmax-based LGNs. However, their method has only been evaluated for two-input LUTs. In addition, other LUT training methods such as LUTNet [29, 30], LogicNets [26], NullaNet [21], PolyLUT [1] and NeuraLUT [2] do not learn LUT entries directly. Rather, they first train a neural network and subsequently map it to a LUT-based network. 3.4 Evaluation metrics Accuracy may not be the best evaluation metric for the MIT-BIH data set, as 88.58% of the train set and 89.81% of the test set data examples are normal heartbeats. This class imbalance means that any classifier that predicts every heartbeat as normal already achieves an accuracy of 89.81%. Thus, we employ per-class evaluations of the precision or positive predictive value (P), sensitivity, recall or true positive rate (Se), specificity or true negative rate (Sp) and F1F_1 score. These are given by: P P =TPTP+FP, = TPTP+FP, Se Se =TPTP+FN, = TPTP+FN, Sp Sp =TNTN+FP, = TNTN+FP, F1 score F_1 score =2P−1+Se−1. = 2P^-1+Se^-1. Here TPTP, FPFP, TNTN, FNFN are the true positives, false positives, true negatives and false negatives respectively. In addition, we report the jκjκ index which has been proposed to quantify the performance on the most important arrhythmia types [17, 19] better, namely the supraventricular ectopic beats (S) and ventricular ectopic beats (V) by employing the j index. It also takes into account the class imbalance through the κ index. The jκjκ index consists of the j index and the Cohen’s Kappa index κ as follows: jκ=1/8⋅j+1/2⋅κ.jκ=1/8·\,j+1/2·κ. (10) To make sure that jκjκ ∈[0,1]∈[0,1], coefficients of 1/8 and 1/2 are chosen, since j ∈[0,4]∈[0,4] and κ ∈[0,1]∈[0,1]. The j index is given by [17]: j=SeS+SeV+PS+PV,j=Se S+Se V+P S+P V, (11) and quantifies the classifier’s performance of the S class and V class based on sensitivity and precision. The κ index is given by [8, 19] κ=Acc−pe1−pe,κ= Acc-p_e1-p_e, (12) where AccAcc is the overall accuracy and pep_e is the chance agreement [8, 19]: pe p_e =∑kP(T=k)P(Pr=k) = _kP(T=k)P(Pr=k) =∑k[∑iCik⋅∑jCkj](∑ijCij)2. = _k [ _iC_ik· _jC_kj ] ( _ijC_ij )^2. Here, P(T=k)P(Pr=k)P(T=k)P(Pr=k) is the probability that both the true label and predicted label are of class k, assuming independence P(T=k,Pr=k)=P(T=k)P(Pr=k)P(T=k,Pr=k)=P(T=k)P(Pr=k). Summing over all classes yields the probability to obtain a correct classification by chance alone, given by pep_e. These probabilities can be obtained from the confusion matrix C. The chance agreement pep_e is compared with the actual accuracy of the classifier and normalized to obtain Cohen’s Kappa. Therefore, the κ index is a more robust metric for imbalanced data sets compared to just the overall or mean accuracy [8, 19]. For example, assume a classifier that classifies normal heartbeats (N) and three different arrhythmias (S, V, F). Assume that we have 100 examples, 90 of which are normal beats, 5 of class S, 4 of class V and 1 of class F. Assume that all heartbeats are classified as normal, so that we have a high accuracy of 90%. In that case, we obtain pe=0.9p_e=0.9 and κ=0κ=0, showing that even with a high accuracy the κ value is lowest when all beats are classified as normal heartbeats. 3.5 Experimental protocol Before benchmarking the LGNs and LUTNs on the MIT-BIH data set, preliminary experiments were conducted on the MNIST Handwritten Digits and Fashion-MNIST data sets to assess the validity of rate coding and the LUTN training algorithm. The findings are presented in A. Next, the ECG arrhythmia data set is benchmarked employing both the mixed-patient and inter-patient paradigm. In the latter case, models are evaluated utilizing all of the preceding metrics, alongside an estimate of the number of FLOPs. Additionally, the design is implemented on a Xilinx Zynq-7000 ZedBoard, providing resource, power and latency estimations in a practical setting. 4 Experimental Results This section first validates rate coding of the LGNs. The performance of the LGNs with rate-coded inputs are presented in A.1 on the MNIST Handwritten Digits and Fashion-MNIST data sets. The results showcase that using rate coding results in a higher accuracy on the MNIST Handwritten Digits and Fashion-MNIST data sets compared to threshold coding. In addition, the proposed LUTN training method is validated on the same data sets in A.2, demonstrating a higher accuracy compared to LGNs in all cases. We find that networks using rate-coded inputs always outperform networks without rate-coded inputs, and networks of LUTs with a greater fan-in outperform LUT networks with a lower fan-in. The remainder of this section is dedicated to ECG arrhythmia classification by benchmarking trained LGNs and LUTNs on the MIT-BIH data set. First, the mixed-patient paradigm is employed to train LGNs. The performance of these trained LGNs is compared to state-of-the-art (SOTA) LGN results to assess how well our preprocessing method improves their performance. Next, the inter-patient paradigm is utilized to analyze how well our classifiers can generalize to unseen patient data. Our work is compared to SOTA methods based on accuracy, jκjκ index, per-class metrics and number of FLOPs. 4.1 Evaluation on the MIT-BIH data set 4.1.1 Mixed-patient paradigm To evaluate our preprocessing methodology, we trained LGNs using our preprocessing method and compared them to SOTA LGN results. Table 3 gives the accuracy on the MIT-BIH mixed-patient test set of our preprocessing method in comparison with the SOTA method that only utilizes dynamic thresholds. All networks consisted of 8000 gates per layer, and were trained for 200 epochs with a batch size of 100 examples, using the same randomly chosen train-test split of 0.67 – 0.33 for all models. As mentioned in Section 3.1, four classes were utilized in all of our models, since the fifth class only consists of 15 examples. Feng et al. [9] report accuracies of 97.54%, 97.86% and 98.05% for a 2-layer, 3-layer and 4-layer network respectively. However, under previously mentioned training circumstances of 200 epochs and a batch size of 100 examples, the accuracies are equal to 97.30%, 97.44% and 97.47%, as seen in Table 3. Our preprocessing method significantly increased the accuracy on the MIT-BIH data set for the mixed-patient case. Table 12 in B.1 gives the optimal temperature of the applied softmax function to the population counters during training. Table 3: Accuracy (%) on the mixed-patient MIT-BIH benchmark using LGN classifiers with varying number of layers. The second and third rows use the binary and full-precision features described in this work respectively. The superscript r indicates the use of rate coding. The first row only uses dynamic thresholds as preprocessing [9]. Models Ref. 2 layer 3 layers 4 layers LGNs [9] 97.30 97.44 97.47 LGNs Proposed 97.90 98.25 98.35 LGNsr Proposed 97.56 97.64 97.76 4.1.2 Inter-patient paradigm Table 4: Comparison of our trained models with state-of-the-art results on the MIT-BIH data set employing the inter-patient paradigm. For our models, the best jκjκ index and accuracy values across all evaluated network depths are reported. A dash means that this metric could not be determined from the reference. Models Ref. j index κ index jκjκ index Acc. (%) LGN [9] 1.540 0.483 0.434 91.13 SNN [16] – – – 93.70 SNNr [32] 2.490 0.595 0.609 90.00 SNNr+CNN [32] 2.660 0.597 0.631 90.00 Deep CNN [13] 2.693 0.729 0.701 89.00 SVM Ensemble [19] 3.164 0.755 0.773 94.50 LS-SVM [27] 2.830 0.500 0.610 81.00 LGN Proposed 2.576 0.657 0.650 94.28 LGNr Proposed 2.768 0.675 0.683 93.63 2-LUTN Proposed 2.693 0.666 0.669 94.41 4-LUTN Proposed 2.634 0.633 0.646 94.26 6-LUTN Proposed 2.661 0.636 0.651 94.24 Table 5: The per-class precision (P), sensitivity (Se), specificity (Sp) and F1-score of our trained LGNs and LUTNs compared to other works on the MIT-BIH inter-patient test set. The superscript r indicates a rate-coded network. The blank entries represent values that could not be determined in a reliable manner. N S V F Models Ref. P Se Sp F1F_1 P Se Sp F1F_1 P Se Sp F1F_1 P Se Sp F1F_1 SNNr [32] 0.970 0.920 0.779 0.944 0.460 0.670 0.966 0.545 0.590 0.770 0.963 0.668 – – – – SNNr + CNN [32] 0.970 0.920 0.779 0.944 0.360 0.680 0.948 0.471 0.840 0.780 0.990 0.809 – – – – Deep CNN [13] 0.933 0.945 0.808 0.939 0.798 0.884 0.949 0.839 0.659 0.352 0.988 0.459 0.450 0.424 0.992 0.437 SVM Ensemble [19] 0.982 0.959 0.863 0.971 0.498 0.781 0.966 0.608 0.938 0.948 0.996 0.943 0.236 0.124 0.997 0.162 LS-SVM [27] 0.980 0.820 0.864 0.893 0.290 0.830 0.922 0.430 0.840 0.880 0.988 0.860 0.080 0.110 0.990 0.093 LGN Proposed 0.946 0.988 0.558 0.966 0.689 0.127 0.998 0.214 0.906 0.867 0.994 0.886 0.022 0.013 0.995 0.016 LGNr Proposed 0.958 0.972 0.667 0.965 0.745 0.338 0.995 0.465 0.795 0.908 0.984 0.848 0.013 0.013 0.992 0.013 2-LUTN Proposed 0.945 0.997 0.546 0.970 0.793 0.047 0.999 0.089 0.953 0.901 0.997 0.926 0.059 0.005 0.999 0.009 4-LUTN Proposed 0.940 0.997 0.506 0.968 0.810 0.008 1.000 0.016 0.951 0.865 0.997 0.906 0.000 0.000 0.999 0.000 6-LUTN Proposed 0.941 0.998 0.511 0.968 0.833 0.007 1.000 0.015 0.952 0.869 0.997 0.908 0.023 0.003 0.999 0.005 To assess the performance of the LGNs and LUTNs for ECG arrhythmia classification on unseen patients, both the LGNs and LUTNs were evaluated on the MIT-BIH data set using the inter-patient paradigm. The performance of the LGNs and LUTNs is presented in Table 4. The LGNs/2-LUTNs, 4-LUTNs, and 6-LUTNs use 8000 gates/LUTs per layer (16000 connections per layer), 3000 LUTs per layer (12000 connections per layer), and 2000 LUTs per layer (12000 connections per layer) respectively. Both binary features and numerical features (rate-coded) were tested. In addition, our results are compared to those of the LGNs in [9], which used only dynamic thresholds for preprocessing. From these results, it can be concluded that using just thresholds is not enough for performing well on this data set, e.g. the normal class occurs around 89% of the time, which should be the lower bound of the accuracy, and the networks of [9] obtain 91.13%. In addition, the κ index, which is a metric that takes into account this imbalance, equals 0.483. Our models obtain an accuracy above 94%, with a κ index up to 0.675. The j index, which takes into account the sensitivity and precision of the most important arrhythmias is equal to 1.540 with dynamic threshold encoding, while the networks employing our preprocessing achieve a value between 2.576 and 2.768. These results show that a proper preprocessing method is of vital importance to generalize well to unseen patient data. Table 4 also compares our work with an SNN [16], a rate-coded SNN (SNNr) [32], a rate-coded SNN in combination with a CNN [32], a deep CNN [13], an ensemble of SVMs [19] and an LS-SVM [27]. Compared to these SOTA results, our models attain the highest accuracy of 94.41%, except for an ensemble of SVMs (94.50%). Based on the jκjκ index, only a deep CNN (jκ=0.701jκ=0.701) and an ensemble of SVMs (jκ=0.773jκ=0.773) perform better than our models (jκ=0.683jκ=0.683). Nevertheless, these SOTA models do not take into account the energy usage, which will be discussed in Section 4.1.3. The optimal softmax function temperatures that are applied to the population counters for our models employing the inter-patient paradigm are shown in Table 13 of B.1. More detailed results about the accuracy and jκjκ index are presented in Table 14, Table 15 and Table 16 of B.2. We found that using binarized input features enhances the performance of the classifiers. To test this, a total of 60 multilayer perceptrons (MLPs) were trained on both continuous-valued and binary input data with different seeds. Utilizing binary features, we obtained an accuracy of 94.11±0.18%94.11± 0.18\% and a jκjκ index of 0.669±0.0120.669± 0.012, while for continuous-valued inputs we achieved an accuracy of 93.09±0.32%93.09± 0.32\% and a jκjκ index of 0.608±0.0500.608± 0.050. From the tested models (binary input MLP, MLP, LUTN, LUTNr, LGN, LGNr), only LGNr obtains a higher jκjκ index on average compared to its binary equivalent. In addition, to have stable training of high-fan-in LUTs, clamping weights between zero and one seemed to be crucial. Note that rate coding is performed with full-precision values, which corresponds to an infinite bit stream length. As a consequence, our reported performance relates to optimally encoded input values. In practice, a trade-off exists between performance and energy usage: A shorter bit stream duration results in a higher performance degradation, as shown in Fig. 7, while reducing the required energy per inference. Table 5 shows the per-class precision, sensitivity, specificity and F1F_1-score for our methods compared to the SOTA. Our models tend to have slightly lower specificity for the normal-beat class than less-energy-efficient SOTA models. The LGNs and LUTNs obtained a higher precision for the supraventricular ectopic (S) beats compared to other works, meaning that if an S beat is predicted, it is almost certainly an S beat. In turn this means that the sensitivity is lower compared to other works, implying that many S beats are classified as normal beats. The LGN with rate-coded inputs (LGNr) is our most suitable model for predicting the S class, having a precision of 0.745, a sensitivity of 0.338 and an F1F_1-score of 0.465. The performance of our models on ventricular ectopic (V) beats show that they achieve a higher precision (up to 0.952) and higher sensitivity (up to 0.908), resulting in a higher F1F_1-score (up to 0.908) compared to the SOTA. Only the deep CNN achieves a higher F1F_1-score of 0.943. Lastly, the F class is very hard to detect due to the low number of examples, and again, the deep CNN has the highest F1F_1-score of 0.437. Table 6 displays the confusion matrix for the rate-coded LGN, and confirms our previous per-class reasoning. Both the normal and V beats are classified very well, while a significant number of S and F beats are classified as normal beats. Of the 43761 normal beats, only 1204 were classified as arrhythmias. Nevertheless, compared to the very low F class counts, the 355 normal beats classified as F beats have a large impact on the F class precision, shown in Table 5. Many F class examples (383), compared to the total number of F class examples (388), are confused as normal (289) or ventricular (93) ectopic beats, resulting in a low sensitivity in Table 5. Table 6: Confusion matrix of our 2-layer LGN with rate-coded inputs on the MIT-BIH inter-patient test set. N S V F N 42557 222 627 355 S 1317 691 32 3 V 269 14 2913 12 F 289 1 93 5 4.1.3 Estimating the number of FLOPs Table 7: Comparison of the number of floating-point operations per inference (FLOPs) for different approaches. The total number of FLOPs is the sum of the FLOPs for preprocessing, the network, and the readout. Only the convolution operations are counted for the ANN network FLOPs. Our networks presented here are only 1-layer feedforward architectures of 8000 gates/2-LUTs, 3000 4-LUTs or 2000 6-LUTs. Still, the number of network FLOPs can be extended to multilayer networks by multiplying the current value with the number of layers. In that case, the number of FLOPs for the preprocessing and readout stay the same. 1Not computed, as the reported value is already notably higher than those of the proposed methods, and would not affect the comparative conclusions. Models Ref. Architecture Preprocessing Network Readout Total FLOPs FLOPs FLOPs FLOPs ANN [13] Conv. Not computed1 1.35⋅1091.35· 10^9 0 >> 1.35 G SNNr [32] Conv. 0 31.0⋅10631.0· 10^6 Not computed1 >> 31.0 M SVM [19] Ensemble Not computed1 4.93⋅1064.93· 10^6 0 >> 4.93 M LGNs Proposed 1x8000 2246 80 560 2.89 K 2-LUTN Proposed 1x8000 2246 720 560 3.53 K 4-LUTN Proposed 1x3000 2246 1350 211 3.81 K 6-LUTN Proposed 1x2000 2246 3780 139 6.17 K With the goal of determining the energy expenditure of our networks, and comparing it to state-of-the-art literature, we estimate the number of floating-point operations (FLOPs) per inference as shown in Table 7. To estimate the number of FLOPs for the LGNs, we use the conservative estimate of 100 binary operations (i.e. gate operations) for one floating-point operation as mentioned in original LGN work [23]. In reality, it is expected that one FLOP requires much more than 100 gate operations, and as such, the number of FLOPs for the LGNs (and by extension the LUTNs) is most likely underestimated. The number of FLOPs for the LUTNs is calculated in the same manner, taking into account that an N-LUT is represented by a 2N:1 MUX that contains 3(2N−1)3(2^N-1) gates. To estimate the number of FLOPs of the readout, the number of gates of a ripple carry adder tree is counted and converted to FLOPs. Table 7 displays the results for the top-performing SOTA models and a rate-coded SNN. Although the SVM achieves the best performance in terms of accuracy and jκjκ index in Table 4, the LGNs and LUTNs require about three orders of magnitude less FLOPs. As mentioned, it is expected that the number of FLOPs for the LGNs and LUTNs are significantly lower, due to our conservative conversion rate from gates to FLOPs. Additionally, the number of FLOPs for the preprocessing is mainly dominated by the calculation of the crest factor, which is discussed in more detail in the next section. 5 Hardware Implementation and Evaluation 5.1 System architecture To assess the deployment of LUTN-based arrhythmia classification, the full ECG preprocessing and LUTN classification pipeline was implemented on an Xilinx Zynq-7000 ZedBoard (part number xc7z020clg484-1). We chose to implement a LUTN instead of an LGN, given that the LUTN is inherently reprogrammable on both ASICs and FPGAs, such that if additional heartbeat data is available, the network can be retrained and new lookup table entries can be uploaded. The FPGA in our design uses 6-LUTs as the core elements of its reconfigurable logic blocks, making a 6-LUTN the ideal model choice to implement. The block diagram is shown in Fig. 5, displaying the Processing System (PS) and Programmable Logic (PL). The PS consists of a dual-core Arm Cortex-A9 processor, memory interfaces, I/O peripherals and AXI interface ports. The latter enables communication between the ARM processor and custom IP cores on the PL through AXI SmartConnect. In this case, the custom IP cores are the ECG Preprocessing IP for heartbeat preprocessing and LUTN IP for heartbeat classification. We employed Vitis HLS (version 2025.1) to convert the C++ preprocessing code of Section 3.1.3 to an ECG Preprocessing IP. A Python script was used that automatically converted the trained LUTN along with readout into Verilog files, creating the LUTN Classifier IP. The next two sections explain each of these IPs in more detail. Figure 5: The block diagram of the full ECG preprocessing and LUTN classification pipeline, implemented on a Xilinx Zynq-7000 ZedBoard. The Processing System (PS) includes the dual-core Arm Cortex-A9 processor, memory controllers and AXI interconnect interfaces. Through this interconnect (i.e. AXI SmartConnect), the PS can control the custom IPs in the Programmable Logic (PL). The ECG processing IP reads raw ECG data and extracts the wanted binary features as explained in Section 3.1.3. The 138-bit wide feature vector is fed into the single layer LUTN consisting of 2000 6-LUTs, after which one 9-bit adder is reused four times to calculate the class scores. The class with the highest score represents predicted class label. Table 8: The number of lookup tables (LUTs), flip-flops (F), BRAMs and DSPs provided by the post-implementation report in Vivado for each hardware block and its components. The power is provided from the post-implementation report and converted to energy per inference employing a clock frequency of 1 MHz. The latency of the ECG Preprocessing IP is determined from the Vitis C/RTL Cosimulation Timeline Trace, while the latency of the LUTN Classifier IP is determined from Vivado. 1Only combinational logic. 2Control logic adds no latency. Hardware Block LUTs FFs BRAMs DSPs Latency Latency Dynamic Power Energy (clk cycles) (ms) (mW) (μ ) ECG Preprocessing IP 17064 2811 3.5 53 3540 3.540 2.33 8.25 r_feature_unit 3697 0 0 20 01 01 0.42 1.49 r_history_unit 3194 314 0 9 504 0.504 0.59 2.09 morphology_unit 2903 735 0 3 295 0.295 0.24 0.85 crest_factor_unit 6254 574 0 21 1754 1.754 0.99 3.50 compress_and_delta_encode 319 267 0.5 0 478 0.478 0.02 0.07 Interface & control logic 697 921 3 0 509 0.509 0.07 0.25 LUTN Classifier IP 3223 267 0 0 5 0.005 0.092 0.00046 LUTN 2000 0 0 0 1 0.001 0.004 0.00002 Popcount/Adder 1122 0 0 0 4 0.004 0.070 0.00035 Interface & control logic 101 267 0 0 02 02 0.018 0.00009 5.2 ECG preprocessing accelerator The ECG Preprocessing IP consists of five RTL modules, each of them representing one of the preprocessing steps in Section 3.1.3. First, the r_feature_unit extracts the R-intervals RR1R_1, RR2R_2, RR3R_3 and RR4R_4, encoding each of them into 8 bits. It also determines the R-interval changes ΔRRp R_p and ΔRRm R_m, each representing one bit. Note that no peak detection algorithm is implemented. Instead, the peak annotations from the MIT-BIH data set are utilized. Next, the r_history_unit is employed to determine RRlocCVRR_locCV and RRratioRR_ratio, each of which are encoded into two bits. This module also determines the tachycardia bit. Following this, the morphology_unit calculates morphology features M1M_1, M2M_2, M4M_4, encoding each one into three bits. Hereafter, the crest_factor_unit determines both 8-bit crest factors cf1cf_1 and cf2cf_2. Lastly, the compress_and_delta_encode module performs delta encoding, obtaining a 74-bit feature value. All these features are represented as one 138-bit long feature vector that is passed to the LUTN classifier. 5.3 LUTN classifier accelerator The LUTN Classifier IP receives a 138-bit feature vector that is extracted from every heartbeat. The feature vector is used as input for the LUTN that consists of one layer of 2000 6-LUTs. At the end of the network, the output values of the LUTs in the final layer are added in chunks of 500 LUTs, where each chunk corresponds with one class population counter. Since the LUTN itself requires less than a clock cycle of latency and the ECG arrhythmia classification does not need such rapid predictions, we chose to reuse one 9-bit adder for each class label, instead of instantiating four adders in parallel. Each class label is associated with a sum, and the sum with the highest final value corresponds to the predicted class label. 5.4 Hardware integration and data flow The peak positions along with the ECG sample values are given to the ECG Preprocessing IP through the AXI Smart Connect. After the ECG preprocessing is finished, the 138-bit feature vector is passed to the LUTN Classifier IP, where a one-layer LUTN consisting of 2000 6-LUTs performs the classification. This IP employs one adder that is used four times, once for each class score. 5.5 Resource utilization Table 8 presents the number of LUTs, FFs, BRAMs and DSPs of both the ECG Preprocessing IP and the LUTN Classifier IP for a single layer LUTN consisting of 2000 6-LUTs. These numbers were obtained from the post-implementation Vivado (version 2025.1) report. The LUTN Classifier IP uses significantly fewer LUTs compared to the ECG Preprocessing IP, showcasing that the LUTN can be use as a hardware-efficient classifier add-on to the necessary ECG preprocessing. In detail, the LUTN itself employs 2000 LUTs and 0 FFs, while the readout utilizes 1122 LUTs and 0 FFs. The rest of the utilization stems from interface and control logic. Note that LUTN topology, i.e. the number of layers and the layer-size for each layer, was chosen in PyTorch as a hyperparameter before training. After the network is trained, it is automatically converted to Verilog files, and converted to a classifier IP. In this case, the chosen topology was one layer of 2000 6-LUTs. Based on the post-implementation report of Vivado, the LUTN is indeed mapped to exactly 2000 6-LUTs. This demonstrates that the topology selected prior to training remains valid in the final implementation, enabling a one-to-one software-to-hardware mapping. The ECG Preprocessing IP employs 17064 LUTs, 2811 FFs, 3.5 BRAMs and 53 DSPs. Most of those utilization numbers are used by the five modules. Again some LUTs, FFs and BRAMs are used as interface and control logic. The crest factors utilize most of the LUTs (6254), while the delta encoding requires the least number of LUTs (319) compared to the other modules. 5.6 Latency, power, and energy evaluation Table 8 also shows the latency, power and energy estimation of both IPs for one inference, employing a clock frequency of 1 MHz. These results were obtained from the post-imple-mentation report in Vivado and from the Vitis C/RTL Cosimulation Timeline Trace. The Vivado report shows only the dynamic power usage for each IP and their subcomponents, employing a vectorless analysis that results in a medium confidence level. The ECG Preprocessing IP requires 3540 clock cycles, or 3.540 ms to complete, while the LUTN Classifier IP needs 5 clock cycles or 0.005 ms. This combined latency is well below the 273 ms inter-beat interval corresponding to a maximum heart rate of 220 bpm. On this Xilinx Zynq-7000 ZedBoard, the energy per inference estimate is equal to 8.25 µJ, of which almost all stems from the preprocessing IP. The full LUTN IP with popcount and interface/control only consumes 0.46 nJ/inference. The LUTN can be viewed as a highly energy efficient and very fast classification add-on to the ECG preprocessing, in essence reducing the overall power consumption to that of the preprocessing units alone. 5.7 Comparison with existing ECG classifiers Table 9 compares our implementation with other works based on energy per inference and power. Similar to several prior ECG arrhythmia classification works [7, 19, 32, 16, 9], our work utilizes peak positions from the data set itself. Hence, the current utilization, latency and power measurements do not include R-peak detection. Our LUTN IP requires only 0.46 nJ per inference. In comparison, the LGN of Feng et al. [9] requires 5.67 nJ per inference. Including preprocessing, our implementation consumes 8250 nJ/inference, while the SNN in [16] only requires 300 nJ/inference. However, we implemented our design on an FPGA instead of an ASIC, meaning that there is additional implementation overhead, and direct comparison is not ideal. Moreover, we employ a much more complex preprocessing, giving rise to a higher accuracy of 94.41% instead of 93.67%. The rate-coded SNNr of [32] implemented as an ASIC consumes 77 mW without preprocessing, while our FPGA implementation with preprocessing only consumes 2.33 mW. Larger models such as an ensemble of SVMs [19] or a Linear Discriminant (LD) classifier [7] do not report any energy usage. In general, these results highlight that the energy and power value estimations of our LUTN classifier are low compared with existing works. Nevertheless, a direct comparison remains difficult, because of different preprocessing methods and implementation platforms. Table 9: Comparison of ECG arrhythmia classifiers in terms of power (mW) and energy/inference (nJ/inf.). The reported energy or power does not always include preprocessing or R-peak detection. 1Does not contain any significant preprocessing. 2Employs the mixed-patient scheme. Classifier Ref. Preproc. R-peak Detec- Energy/inf. Power Process Platform Included tion Included (nJ/inf.) (mW) LD classifier [7] Yes No – – – No implementation SVM Ensemble [19] Yes No – – – No implementation SNNr [32] No1 No Not reported 77 28 nm Shenjing [28] ASIC simulator SNN [16] Yes Not reported 300 Not reported 28 nm CMOS Fabricated ASIC LGN [9] No1,2 No 5.67 Not reported 55 nm CMOS ULP Synopsys Design Compiler (ASIC) LUTN Proposed No No 0.46 0.092 28 nm HKMG FPGA implementation LUTN & preproc. Proposed Yes No 8250 2.33 28 nm HKMG FPGA implementation 6 Conclusion We investigated the use of logic-based models, i.e. Deep Differentiable Logic Gate Networks (LGNs) and Lookup Table Networks (LUTNs), as lightweight classifiers for inter-patient ECG arrhythmia classification. A novel LUTN training method was introduced that uses the Boolean equation of a multiplexer, along with preprocessing of the MIT-BIH data set tailored to LGNs and LUTNs. The effect of rate coding, LUT fan-in and network depth on the classification performance was investigated. Our study showed that these logic-based models achieve an accuracy of 94.41% and a jκjκ index of 0.683, matching CNN-, SVM- and SNN-based state-of-the-art methods. Yet, our models required only a few thousand FLOPs, which is an estimated three to six orders of magnitude less than state-of-the-art approaches. In addition, our results demonstrated that rate coding LGNs improves the jκjκ index due to an enhanced classification performance of supraventricular ectopic beats. We also demonstrated that 6-LUTNs with 12000 connections per layer obtained a similar performance as 2-LUTNs/LGNs with 16000 connections per layer, enabling a more compact hardware representation. Obtaining an efficient hardware implementation with LGNs and LUTNs is straightforward, since the trained network is directly converted to Verilog, showcasing a one-to-one mapping of 6-LUTNs to FPGA. We implemented our network on FPGA as a verification of our methods. In reality, an ASIC implementation will deliver the lowest achievable energy consumption. Validation of the proposed methods was performed by implementing both the preprocessing and logic-based model on a Xilinx Zynq-7000 FPGA, highlighting the practical feasibility of our approach. The ECG Preprocessing IP occupied 17064 LUTs, had a latency of 3540 clock cycles and a dynamic energy per inference of 8.25 µJ. In contrast, the LUTN Classifier IP only needed 3223 LUTs, had a latency of 5 clock cycles and an energy per inference of 0.46 nJ. This confirms that LGNs/LUTNs are promising candidates as lightweight arrhythmia classifiers. The total inference time of both IPs combined was 3.5 ms at a clock speed of 1 MHz, which is ample time to classify heartbeats in streaming mode. Overall, the results show that logic-based classifiers obtain competitive inter-patient ECG classification performance with low computational complexity and a straightforward hardware implementation. This combination suggests that LGNs and LUTNs are promising candidates for future resource-con-strained biomedical monitoring systems, including implantable or wearable devices, for which current methods are too computationally demanding. A list of possible research directions is given in Table 10. One possible research direction is to adapt the current algorithm to increase the classification performance on the fusion (F) beats on the MIT-BIH data set by employing synthetic minority oversampling (SMOTE) [6] and utilizing a focal loss function [14]. As shown in Table 5, the supraventricular ectopic (S) beat classification performance is oftentimes lower than state-of-the-art methods, thus low-complexity preprocessing should be added directed at increasing this class-specific performance, which is a second research direction. A third research direction could aim at improving training stability and decreasing training time. Early results have demonstrated that clamping weight values between zero and one at all times increases training stability of deep LUTNs consisting out of high-fan-in LUTs. Alternatively, the trainable LUT entries could be bounded by applying a sigmoid function, limiting their values to [0,1][0,1]. Sigmoid annealing could be an alternative binarization mechanism to binarize all layers of the network in one go. In contrast, the current algorithm binarizes the network in a layer-wise fashion over the duration of the training. A fourth research direction is the application of convolutional LGNs [24] and LUTNs to ECG arrhythmia classification. These logic-based convolutional networks could extract non-handcrafted morphological features in an equally hardware-efficient manner, again possibly leading to increased performance. Adding a light-weight peak detection algorithm [22] is another research direction. This is currently the main component that is missing to obtain an end-to-end arrhythmia classifier. Finally, the LGNs transform input features into class predictions using binary transformations consisting of simple 2-input Boolean operations. Extracting logic rules for specific examples or classes could give insight into why the LGN decides to assign a class label to a specific example. The resulting set of Boolean rules could then be compared to clinical protocols, potentially providing insights into clinical decision-making. Table 10: Possible future research directions and their main motivations. Future Research Direction Motivation Advanced lightweight preprocessing The current pipeline does not classify the supraventricular ectopic (S) beats well compared to the state of the art. Therefore, the current preprocessing should be adapted for enhanced S class detection, while keeping the computational complexity simple. Advanced class imbalance mitigation The fusion (F) class is heavily underrepresented in the MIT-BIH data set. To mitigate this underrepresentation, synthetic minority oversampling (SMOTE) [6] could be employed to create additional F class examples. In addition, focal loss [14] could be utilized for better classification performance of examples which are hard to classify. Limiting weight values and binarization method Early results show that clamping LUT entries to [0,1][0,1] during the full training phase, enhances final performance of the deep 6-LUTNs on the MIT-BIH data set. Yet, the weight values could be bounded by applying a sigmoid function. Instead of the current layer-wise binarization method that requires more training epochs for deeper networks, sigmoid annealing the full network could be employed to lower training times. Convolutional architectures Instead of utilizing handcrafted morphological features, convolutional LGNs [24] or convolutional LUTNs could be utilized to extract these automatically. This could lead to a higher performance compared to feedforward architecture in a hardware-efficient manner. Peak detection an end-to-end implementation The main missing component in our setup to obtain and end-to-end ECG arrhythmia classification pipeline, is a lightweight peak detection algorithm such as the Pan-Tompkins algorithm [22]. Interpretation and explainability LGNs [34] consist of logic gates, and hence for each example or class, one could extract logic rules from input features up until prediction. These rules could be compared with clinical knowledge, providing decision insights for LGNs and clinicians. CRediT authorship contribution statement Wout Mommen: Conceptualization, Data curation, Formal analysis, Investigation, Methodology, Software, Visualization, Writing – original draft. Lars Keuninckx: Conceptualization, Data curation, Supervision, Validation, Writing – review & editing. Siddharth Patil: Software, Validation, Visualization. Paul Detterer: Software, Validation. Achiel Colpaert: Conceptualization, Supervision, Writing – review & editing. Piet Wambacq: Supervision, Funding acquisition. Declaration of competing interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. Ethics statement This study utilized the publicly available MIT-BIH Arrhythmia Database, that has been extensively used in ECG arrhythmia classification benchmarks. The study only involved secondary analysis of anonymized, pre-existing data and no additional ethical approval or informed consent was required. Acknowledgements This research received funding from the Flemish Government under the “Onderzoeksprogramma Artificiële Intelligentie (AI) Vlaanderen” program. Appendix A Validation of proposed methods A.1 Rate coding validation To evaluate rate coding in LGNs, the networks were tested on the MNIST Handwritten Digits and Fashion-MNIST data sets for different network depths, with 8000 gates per layer. These findings are displayed in Fig. 6(a) (MNIST Handwritten Digits) and 6(b) (Fashion-MNIST), and are compared to LGNs with binary input values. The binarized input values are obtained by thresholding the pixel values with a threshold equal to 0.5. Based on these results, all networks with rate-coded inputs outperform the networks with binary input values on both data sets. The results of employing rate coding for the MIT-BIH data set are presented in Section 4.1. (a) (b) Figure 6: Comparison between single threshold coding and rate coding on (a) the MNIST Handwritten Digits data set and (b) the Fashion-MNIST data set, for LGNs using 8000 gates per layer. A.2 LUTN training validation To ensure that the LUTN training method works effectively, it is first tested on the MNIST Handwritten Digits and Fashion-MNIST data sets. Table 11 presents the accuracy of an LGN (8000 gates/layer), a 2-LUTN (8000 LUTs/layer), a 4-LUTN (3000 LUTs/layer), and a 6-LUTN (2000 LUTs gates/layer). The 4-LUTNs and 6-LUTNs consist of 12000 connections per layer, while the LGNs and 2-LUTNs contain 16000 connections per layer. All models were also tested with rate-coded input features, indicated by the superscript r in the model name. The 6-LUTNs outperform all other models with binary input features, given a constant number of layers. One exception might be the 2-layer 4-LUTN trained on the Fashion-MNIST data set. This model achieves an accuracy of 80.46%, which is comparable to the accuracy of the 6-LUTN obtaining 80.00%. This statement is also true for the networks with rate-coded inputs: The 6-LUTNsr outperform all other models, given a constant number of layers. Moreover, networks with rate-coded inputs always outperform networks with binary input values, especially on the Fashion-MNIST data set. The reason is that gray-scale values are more important for the Fashion-MNIST data set compared to the MNIST Handwritten Digits data set, where most pixels mostly fall into just two categories, namely black and white. Note that even though the LGNs/LGNsr contain more connections and number of “neurons” compared to networks with 4-input and 6-input LUTs, the 4-LUTNs/4-LUTNr and 6-LUTNs/6-LUTNsr always outperform the LGNs/LGNsr. We expect that this is due to the large number of functions an N-LUT can represent. As shown in Table 2, a 6-LUT can represent 1.845⋅10191.845· 10^19 functions, while a 2-LUT can only represent 16 different binary functions. Table 11: Accuracies (%) of the LGNs [23] and LUTNs on the MNIST Handwritten Digits and Fashion-MNIST data sets. MNIST Fashion-MNIST Model 1 layer 2 layers 1 layer 2 layers LGN 91.22 94.57 77.41 79.40 2-LUTN 91.74 94.22 77.36 79.20 4-LUTN 92.66 96.73 78.19 80.46 6-LUTN 93.88 97.29 79.61 80.00 LGNr 91.22 95.14 81.38 83.69 2-LUTNr 92.26 94.85 81.83 83.75 4-LUTNr 94.30 97.85 83.97 86.17 6-LUTNr 95.34 98.41 85.09 87.48 Appendix B Additional MIT-BIH results B.1 Optimal softmax temperatures The performance of LGNs and LUTNs depends on the chosen hyperparameter values. One such hyperparameter is the output softmax temperature, that converts the population counts to class probabilities. The optimal output softmax temperature is defined as the temperature value for which the network attains the highest accuracy on the data set, while keeping all other hyperparameter values fixed. Table 12 displays the optimal softmax temperature values for the LGNs on the MIT-BIH data set when patients are mixed in train and test set. Table 13 presents the optimal softmax temperature values of the LGN and LUTNs on the MIT-BIH data set employing the inter-patient paradigm. In both cases, this temperature was found utilizing a grid search in the range of 1 to 10, for all integer values. For values above 10, a step size of 5 was employed. As mentioned in [23], networks with wide layers obtain a higher final accuracy if a larger temperature is chosen. This trend is also observed in Table 13 for the LUTNs. The optimal temperature value for 6-LUTNs (2000 LUTs/layer) is 25, for 4-LUTNs (3000 LUTs/layer) is 30, and for 2-LUTNs (8000 LUTs/layer) is 50. In addition, the optimal temperature value of 6-LUTNsr (2000 LUTs/layer) is 15, for 4-LUTNsr (3000 LUTs/layer) is 40, and for 2-LUTNsr (8000 LUTs/layer) is 50. The superscript r in the model name indicates rate-coded network inputs. Table 12: Ideal softmax temperatures for the networks that use mixed patients for the MIT-BIH data set. Our models use the preprocessing as explained in Section 3.1.3, while Feng et al. [9] utilizes dynamic thresholds. The superscript r indicates rate-coded inputs. All LGNs consisted out of 8000 gates per layer. Model Ref. No. classes Temp. LGNs Proposed 4 30 LGNsr Proposed 4 20 LGNs [9] 4 8 LGNs [9] 5 5 Table 13: Ideal softmax temperatures for the networks that use the inter-patient paradigm. Our models use the preprocessing as explained in Section 3.1.3, while Feng et al. [9] utilizes dynamic thresholds. The superscript r indicates rate-coded inputs. The LGNs and 2-LUTNs had 8000 gates/LUTs per layer, while the 4-LUTNs and 6-LUTNs consisted of 3000 and 2000 LUTs per layer respectively. Model Ref. Temp. LGNs [9] 30 LGNs Proposed 35 LGNsr Proposed 10 2-LUTNs Proposed 50 4-LUTNs Proposed 30 6-LUTNs Proposed 25 2-LUTNsr Proposed 50 4-LUTNsr Proposed 40 6-LUTNsr Proposed 15 B.2 Detailed performance results Table 14 and Table 15 present the accuracy and jκjκ index of the LGNs and LUTNs employing binary input features and rate coding. The models are trained on the MIT-BIH test set utilizing the inter-patient paradigm. LGNs vs 2-LUTNs Table 14 and Table 15 show that the 2-LUTNs outperform LGNs based on the accuracy and jκjκ index for all depths. Hence for binary input features, the 2-LUTNs are preferred, due to a better performance. The primitives of LGNs and 2-LUTs can learn exactly the same functions, but an LGN primitive needs 16 trainable parameters, while a 2-LUT primitive only needs four, reducing the number of training parameters by a factor of four. Although, the 2-LUTNs perform better than LGNs with binary input values, the opposite is true when the input data is rate-coded. Rate coding and LGNs Based on the accuracy and jκjκ index results in Table 14 and Table 15 respectively, we observe that the accuracy is higher and the jκjκ index is lower for the LGNs compared to the rate-coded LGNsr. For the LGNsr, the number of correctly classified supraventricular ectopic (S) beats is higher, while the number of correctly classified normal (N) beats is lower compared to the LGNs. Since the performance is better on the S class, the F1F_1 score of the LGNsr in Table 5 is higher compared to the one of the LGNs. Thus, the values of the j index and jκjκ index of LGNsr are also higher than the ones of LGNs. Still, for the LGNsr, the decrease in performance on the normal class is larger in magnitude than the increase in performance on the S class compared to the LGNs. This is the reason why the accuracy of the LGNsr are lower than the accuracy of the LGNs. To conclude: Rate coding our input features enhances the performance on the S class, while diminishing the performance for normal heartbeats. A detailed investigation into the classification performance of the supraventricular ectopic beats is necessary to pinpoint why this is the case. This corresponds to the first entry in Table 10, which lists possible future research directions. Depth of LGNs The accuracy of the LGNs rises with the number of layers, as seen in Table 14. Based on the obtained confusion matrices, we conclude that the normal class and ventricular ectopic (V) class are predicted correctly more often. The opposite is true for networks with rate-coded inputs: The accuracy decreases with depth for the LGNsr. For example, a 2-layer network predicts the normal class less well than a single layer network. The decrease in accuracy from 2-layer networks to 4-layer networks is due to a worse performance on the S class, which also explains the downwards trend of the jκjκ index. A careful analysis of the S class performance is required to explain this downwards trend. This is the first mentioned future research direction in Table 10. LUT fan-in Table 14 and Table 15 show that the accuracy and jκjκ index are lower for deep 6-LUTNs compared to deep 4-LUTNs and deep 2-LUTNs. In detail, the 4-layer 6-LUTN achieves an accuracy of 88.67% and a jκjκ index of 0.000. Nevertheless, the training method does not force the weight values to lie within [0,1][0,1] before binarization. Early results in Table 16 show that if these weights are clamped throughout the full training phase, the accuracy and jκjκ index remain stable. Namely, a 4-layer 6-LUTN now obtains an accuracy of 94.32% and a jκjκ index of 0.659. Rate coding and LUTNs Utilizing rate coding with the LUTNs decreases both accuracy and jκjκ index for all considered LUT fan-in values compared to using binary input values. Utilizing the above clamping throughout the full training phase, of which the results are shown in Table 16, did not improve the results shown in Table 14 and Table 15. Yet, the jκjκ index of the 4-layer 6-LUTNr is now equal to 0.552 instead of 0.000. To assess if the cause of the lower accuracy and jkjk index was due to the LUTNr model or due to the input features themselves, a multilayer perceptron (MLP) was trained on the binarized and one on continuous-valued inputs. Each MLP consisted of two hidden layers of 256 and 128 neurons respectively, with ReLU activation functions. Both the MLPs with binary inputs and with continuous-valued inputs were trained 30 times, each with a different seed. On average, the MLP with binarized input values obtains an accuracy of 94.11±0.18%94.11± 0.18\% and a jκjκ index of 0.669±0.0120.669± 0.012. The MLP with continuous-valued inputs obtains an accuracy of 93.09±0.32%93.09± 0.32\% and a jκjκ index of 0.608±0.0500.608± 0.050. Clearly, the MLP with binary input values performs better than the MLP employing continuous-valued inputs. It is plausible that binarizing the input features acts as a regularization mechanism that suppresses patient-specific variability. Yet, the reason why the LGNs with rate-coded inputs obtain a higher jκjκ index compared to the LGN with binarized inputs is unknown at the time of writing. Depth of LUTNs The accuracy increases with depth for 2-LUTNs, stays more or less constant for 4-LUTNs, and decreases for 6-LUTNs. When clamping is utilized, the accuracy of the 6-LUTNs does not decrease with depth anymore, as is shown in Table 16. The jκjκ index also shows a decrease for 3-layer and 4-layer 6-LUTNs, but this has been resolved by clamping weight values to the interval [0,1][0,1]. Table 14: Accuracies (%) of our networks (LGNs, 2-LUTNs, 4-LUTNs, and 6-LUTNs) that use the inter-patient paradigm for different number of layers. The LGNs/2-LUTNs have 8000 gates/LUTs per layer, the 4-LUTNs have 3000 LUTs/layer, and the 6-LUTNs have 2000 LUTs/layer. The superscript r indicates the use of rate coding as described in this work. This is compared to the known state-of-the-art LGN results on this data set. The LUT entries are not clamped to [0,1][0,1] during training. No. Layers LGNs LGNsr 2-LUTNs 2-LUTNsr 4-LUTNs 4-LUTNsr 6-LUTNs 6-LUTNsr LGNs [9] 1 93.79 93.63 93.99 93.17 94.00 92.91 94.04 92.66 90.86 2 94.06 93.48 94.18 93.34 94.26 92.85 94.24 92.79 90.30 3 94.19 93.50 94.23 93.41 94.21 93.14 94.20 93.17 89.73 4 94.28 93.26 94.41 93.54 94.23 93.20 88.67 92.14 91.13 Table 15: jκjκ indexes of our networks (LGNs, 2-LUTNs, 4-LUTNs and 6-LUTNs) that use the inter-patient paradigm for different number of layers. The LGNs/2-LUTNs have 8000 gates/LUTs per layer, the 4-LUTNs have 3000 LUTs/layer and the 6-LUTNs have 2000 LUTs/layer. The superscript r indicates the use of rate coding as described in this work. This is compared to the known state-of-the-art LGN results on this data set. The LUT entries are not clamped to [0,1][0,1] during training. No. layers LGNs LGNsr 2-LUTNs 2-LUTNsr 4-LUTNs 4-LUTNsr 6-LUTNs 6-LUTNsr LGNs [9] 1 0.645 0.633 0.659 0.595 0.646 0.549 0.651 0.572 0.407 2 0.569 0.683 0.669 0.618 0.638 0.614 0.643 0.571 0.434 3 0.650 0.660 0.654 0.585 0.624 0.557 0.583 0.561 0.412 4 0.559 0.649 0.669 0.610 0.635 0.612 0.000 0.000 0.409 Table 16: Accuracy (%) and jκjκ index on the inter-patient MIT-BIH data set for 6-LUTNs and rate-coded 6-LUTNs (6-LUTNsr) using 2000 6-LUTs per layer. These results applied clamping of the LUT entries to [0,1][0,1] during training. 6-LUTNs 6-LUTNsr No. Layers Accuracy jκjκ Accuracy jκjκ 1 94.07 0.649 92.59 0.565 2 94.30 0.655 92.67 0.562 3 94.36 0.647 93.09 0.537 4 94.32 0.645 92.80 0.552 B.3 Convergence of rate coding Fig. 7 displays the accuracy and jκjκ index for a 2-layer LGNr utilizing different bit stream lengths. The longer the bit stream length, the higher the accuracy and jκjκ index. The accuracy and jκjκ index values converge to the LGNr values in Table 4, corresponding with the confusion matrix in Table 6, when a long enough bit stream length is applied. This behaviour is expected because LGNsr are trained with full-precision values, corresponding to theoretically infinite bit stream lengths. Figure 7: The accuracy and jκjκ index of a 2-layer rate-coded LGN for a varying number of bit stream lengths. As expected, the longer the bit stream length, the closer our classifier is to attaining the maximum possible performance. References [1] M. Andronic and G. A. Constantinides (2023) PolyLUT: learning piecewise polynomials for ultra-low latency FPGA LUT-based inference. In 2023 International Conference on Field Programmable Technology (ICFPT), p. 60–68. External Links: Document Cited by: §1, §2, §3.3.3. [2] M. Andronic and G. A. Constantinides (2024) NeuraLUT: hiding neural network density in boolean synthesizable functions. In 2024 34th International Conference on Field-Programmable Logic and Applications (FPL), p. 140–148. External Links: Document Cited by: §1, §2, §3.3.3. [3] Association for the Advancement of Medical Instrumentation (1998) Testing and reporting performance results of cardiac rhythm and ST segment measurement algorithms. Association for the Advancement of Medical Instrumentation. Cited by: §3.1.2. [4] A. T.L. Bacellar, Z. Susskind, M. Breternitz Jr., E. John, L. K. John, P. M.V. Lima, and F. M.G. França (2024) Differentiable weightless neural networks. External Links: 2410.11112 Cited by: §1, §2, §2, §3.3.3. [5] S. Bührer, A. Plesner, T. Aczel, and R. Wattenhofer (2025) Recurrent deep differentiable logic gate networks. External Links: 2508.06097 Cited by: §2. [6] N.V. Chawla, K.W. Bowyer, L.O. Hall, and W.P. Kegelmeyer (2002) SMOTE: synthetic minority over-sampling technique. Journal of Artificial Intelligence Research 16, p. 321–357. External Links: Document Cited by: Table 10, §6. [7] P. de Chazal, M. O’Dwyer, and R.B. Reilly (2004) Automatic classification of heartbeats using ECG morphology and heartbeat interval features. IEEE Transactions on Biomedical Engineering 51 (7), p. 1196–1206. External Links: Document Cited by: §1, §3.1.2, §3.1.2, §5.7, Table 9. [8] M. Fatourechi, R. K. Ward, S. G. Mason, J. Huggins, A. Schlögl, and G. E. Birch (2008) Comparison of evaluation metrics in classification applications with imbalanced datasets. In 2008 Seventh International Conference on Machine Learning and Applications, p. 777–782. External Links: Document Cited by: §3.4, §3.4, §3.4. [9] C. Feng, X. Wang, and T. T. Ye (2024) Low-power consumption inference of ECG signals using differential logic networks. In 2024 IEEE Asia Pacific Conference on Circuits and Systems (APCCAS), p. 20–24. External Links: Document Cited by: Table 12, Table 12, Table 12, Table 12, Table 13, Table 13, Table 13, Table 14, Table 15, §4.1.1, §4.1.2, Table 3, Table 3, Table 3, Table 4, §5.7, Table 9. [10] L. Gerlach, L. Våge, T. Gerlach, and E. Kauffman (2025) WARP-LUTs: walsh-assisted relaxation for probabilistic look-up tables. External Links: 2510.15655 Cited by: §1, §2, §3.3.3. [11] B. Hawks, J. Duarte, N. J. Fraser, A. Pappalardo, N. Tran, and Y. Umuroglu (2021) Ps and qs: quantization-aware pruning for efficient low latency neural network inference. Frontiers in Artificial Intelligence 4, p. 676564. External Links: Document Cited by: §1. [12] L. Keuninckx, M. Hartmann, P. Detterer, A. Safa, W. Mommen, and I. Ocket (2025) On training networks of monostable multivibrator timer neurons. Neural Networks, p. 108092. External Links: Document Cited by: §1, §3.3.1. [13] Y. Li, R. Qian, and K. Li (2022) Inter-patient arrhythmia classification with improved deep residual convolutional neural network. Computer Methods and Programs in Biomedicine 214, p. 106582. External Links: Document Cited by: §1, §3.1.2, §4.1.2, Table 4, Table 5, Table 7. [14] T. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár (2018) Focal loss for dense object detection. External Links: 1708.02002 Cited by: Table 10, §6. [15] W. Maass (1997) Networks of spiking neurons: the third generation of neural network models. Neural Networks 10 (9), p. 1659–1671. External Links: Document Cited by: §2. [16] R. Mao, S. Li, Z. Zhang, Z. Xia, J. Xiao, Z. Zhu, J. Liu, W. Shan, L. Chang, and J. Zhou (2022) An ultra-energy-efficient and high accuracy ECG classification processor with SNN inference assisted by on-chip ANN learning. IEEE Transactions on Biomedical Circuits and Systems 16 (5), p. 832–841. External Links: Document Cited by: §1, §2, §3.1.3, §3.1.3, §4.1.2, Table 4, §5.7, Table 9. [17] T. Mar, S. Zaunseder, J. P. Martínez, M. Llamedo, and R. Poll (2011) Optimization of ECG classification by means of feature selection. IEEE Transactions on Biomedical Engineering 58 (8), p. 2168–2177. External Links: Document Cited by: §3.1.2, §3.4, §3.4. [18] W. Mommen, L. Keuninckx, M. Hartmann, and P. Wambacq (2025) A method for optimizing connections in differentiable logic gate networks. External Links: 2507.06173 Cited by: §2. [19] V. Mondéjar-Guerra, J. Novo, J. Rouco, M.G. Penedo, and M. Ortega (2019) Heartbeat classification fusing temporal and morphological information of ECGs via ensemble of classifiers. Biomedical Signal Processing and Control 47, p. 41–48. External Links: Document Cited by: §1, §3.1.2, §3.1.2, §3.1.3, §3.1.3, §3.1.3, §3.4, §3.4, §3.4, §3.4, §4.1.2, Table 4, Table 5, Table 7, §5.7, Table 9. [20] G.B. Moody and R.G. Mark (2001) The impact of the MIT-BIH arrhythmia database. IEEE Engineering in Medicine and Biology Magazine 20 (3), p. 45–50. External Links: Document Cited by: §1, §3.1.1. [21] M. Nazemi, G. Pasandi, and M. Pedram (2019) Energy-efficient, low-latency realization of neural networks through boolean logic minimization. In 2019 24th Asia and South Pacific Design Automation Conference (ASP-DAC), p. 1–6. External Links: Document Cited by: §1, §2, §3.3.3. [22] J. Pan and W. J. Tompkins (1985) A real-time QRS detection algorithm. IEEE Transactions on Biomedical Engineering BME-32 (3), p. 230–236. External Links: Document Cited by: Table 10, §6. [23] F. Petersen, C. Borgelt, H. Kuehne, and O. Deussen (2022) Deep differentiable logic gate networks. Advances in Neural Information Processing Systems 35, p. 2006–2018. Cited by: Table 11, Table 11, §B.1, §1, Table 1, Table 1, §2, §3.2, §4.1.3. [24] F. Petersen, H. Kuehne, C. Borgelt, J. Welzel, and S. Ermon (2024) Convolutional differentiable logic gate networks. External Links: 2411.04732 Cited by: §2, Table 10, §6. [25] M. Rastegari, V. Ordonez, J. Redmon, and A. Farhadi (2016) XNOR-Net: ImageNet classification using binary convolutional neural networks. External Links: 1603.05279 Cited by: §2. [26] Y. Umuroglu, Y. Akhauri, N. J. Fraser, and M. Blott (2020) LogicNets: co-designed neural networks and circuits for extreme-throughput applications. In 2020 30th International Conference on Field-Programmable Logic and Applications (FPL), p. 291–297. External Links: Document Cited by: §1, §2, §3.3.3. [27] A. Villa, M. Deviaene, R. Willems, S. Van Huffel, and C. Varon (2019) Are we training our heartbeat classification algorithms properly?. In 2019 41st Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), p. 6363–6366. External Links: Document Cited by: §1, §4.1.2, Table 4, Table 5. [28] B. Wang, J. Zhou, W. Wong, and L. Peh (2019) Shenjing: a low-power reconfigurable neuromorphic accelerator with partial-sum and spike networks-on-chip. External Links: 1911.10741 Cited by: Table 9. [29] E. Wang, J. J. Davis, P. Y.K. Cheung, and G. A. Constantinides (2019) LUTNet: rethinking inference in FPGA soft logic. External Links: 1904.00938 Cited by: §1, §2, §3.3.3. [30] E. Wang, J. J. Davis, P. Y.K. Cheung, and G. A. Constantinides (2020) LUTNet: learning FPGA configurations for highly efficient neural network inference. External Links: 1910.12625 Cited by: §1, §2, §3.3.3. [31] World Health Organization (2025) Cardiovascular diseases. External Links: Link Cited by: §1. [32] Z. Yan, J. Zhou, and W. Wong (2021) Energy efficient ECG classification with spiking neural network. Biomedical Signal Processing and Control 63, p. 102170. External Links: Document Cited by: §1, §2, §4.1.2, Table 4, Table 4, Table 5, Table 5, Table 7, §5.7, Table 9. [33] S. Yousefi, A. Plesner, T. Aczel, and R. Wattenhofer (2025) Mind the gap: removing the discretization gap in differentiable logic gate networks. External Links: 2506.07500 Cited by: §2. [34] C. Yue and N. K. Jha (2024) Learning interpretable differentiable logic networks. IEEE Transactions on Circuits and Systems for Artificial Intelligence 1 (1), p. 69–82. External Links: Document Cited by: Table 10. [35] Z. Zhang, J. Dong, X. Luo, K. Choi, and X. Wu (2014) Heartbeat classification using disease-specific feature selection. Computers in Biology and Medicine 46, p. 79–89. External Links: Document Cited by: §3.1.2.