Abstract
On resource-constrained edge hardware, fixed-point Transformer inference is constrained by GEMM kernels and non-GEMM normalization paths. In LayerNorm and Softmax, division, inverse square root, and denominator reciprocal operations complicate fixed-point datapath design. We propose DIFT (Division and Inverse-Square-root-Free Transformer normalization), a fixed-point scheme that removes division and inverse square root from the targeted normalization paths. Starting from a trained checkpoint, we keep the weights, matrix multiplications, and Softmax exponentials unchanged, replacing only the LayerNorm inverse-standard-deviation path and Softmax denominator reciprocal path with Q7I2 fixed-point approximations. Calibration remains separate from final evaluation. We evaluate fine-tuned BERT-base on four GLUE tasks with three seeds and fixed-length-block perplexity (PPL) of GPT-2 small on WikiText-2. LayerNorm-only, Softmax-only, and Joint (DIFT) settings isolate the error sources. For BERT, the mean accuracy change under Joint (DIFT) is approximately to percentage points. GPT-2 test PPL increases from 29.009 to 31.092, a PPL of . Under this protocol, the same approximation affects token-level-likelihood PPL more strongly than classification accuracy. The results provide an algorithm-level assessment before hardware implementation on edge NPUs, FPGAs, or custom ASICs. Synthesis and hardware measurements of latency, area, power, and energy are outside the scope of this study.
1. Introduction
Transformers have become a foundational architecture for natural language understanding and generation [1]. When they are deployed on phones, wearables, and embedded devices, power and area budgets are far tighter than in data centers, and efficient floating-point units are often unavailable. Edge-oriented inference has therefore become a distinct optimization problem [2,3,4]. In this setting, optimization cannot stop at matrix multiplication. It must also account for the surrounding normalization paths. Hardware studies and surveys of Transformer inference note that nonlinear normalization modules, including Softmax and LayerNorm, do not always dominate FLOPs. These modules nevertheless contain exponentials, divisions, inverse square roots, reductions, and element-wise memory access. Under some hardware and long-sequence settings, such irregular operations can become non-GEMM bottlenecks [2,3,5,6]. Division and inverse square root are particularly costly on platforms such as FPGAs, so they are natural targets for implementation-cost reduction.
Transformer inference optimization has followed two broad directions. The first targets the GEMM, or linear, part of the model. Post-training quantization (PTQ) methods such as SmoothQuant, OPTQ, and AWQ represent weights and activations at low bit width [4,7,8]. These methods largely leave Softmax and LayerNorm computations intact, so they address a complementary target. The second direction targets non-GEMM normalization operators. I-BERT performs integer-only inference for nonlinear operations including Softmax, GeLU, and LayerNorm [9]. SOLE, Kim et al., Choi et al. and Li et al. approximate Softmax and LayerNorm to reduce the cost of exponentials, divisions, and square roots [2,5,10,11]. Softermax focuses on attention Softmax [12], whereas Kang and Wang target RMSNorm [13]. RMSNorm differs from the LayerNorm setting studied here, although the two lines of work could be combined in future systems.
In this study, we replace the two targeted normalization paths with a training-free Q7I2 fixed-point approximation based on the integer pseudo-normalization of prior work [14]. Q7I2 was empirically selected because it provided sufficiently small approximation error and adequate numerical accuracy for the present study. Here, hardware-oriented design refers to replacing explicit division and inverse-square-root operations in these paths with regular fixed-point operations, including multiplications, additions/subtractions, bit shifts, and comparisons. The Softmax exponentiation and the mean/variance computation in LayerNorm remain unchanged. We call the resulting division- and inverse-square-root-free scheme DIFT (Division and Inverse-Square-root-Free Transformer normalization). During evaluation, the weight matrices, attention matrix multiplication, and Softmax exponential remain unchanged. Only the LayerNorm inverse-std path and the Softmax denominator reciprocal path are isolated and replaced. Calibration is separated from final evaluation. BERT is evaluated with three seeds, and GPT-2 is evaluated using WikiText-2 PPL. Three settings (LayerNorm-only, Softmax-only, and Joint (DIFT)) separate the error sources of the two normalization paths. Comparing the Joint (DIFT) result with the single-path results supports estimating path interaction, while the shared protocol allows classification accuracy and language-modeling PPL to be compared under the same approximation design. Table 1 summarizes related work and the positioning of this paper.
Table 1.
Related work on Transformer inference optimization and the positioning of this paper (grouped by optimization target into GEMM and non-GEMM). In the evaluation column, accuracy refers to classification tasks and PPL to language modeling.
Our main contributions are as follows.
- Under a protocol that separates calibration from final evaluation, we quantify how BERT classification and GPT-2 language modeling respond to the same Q7I2 setting (Section 2.1). The aggregate accuracy change on BERT GLUE classification is small, whereas GPT-2 test PPL increases measurably. This contrast is consistent with the difference between argmax-based accuracy and PPL, which accumulates token-level likelihood.
- We combine measured activation-range statistics, powers-of-two range scaling, and label-free threshold calibration to reduce operator-level approximation error on the normalization paths. This makes the integer pseudo-normalization method from our previous work [14] applicable to real Transformer checkpoints without approximation-specific retraining or label-dependent calibration.
- Through LayerNorm-only and Softmax-only ablations, we show that the errors of the two approximation paths interact superadditively: the Joint (DIFT) degradation exceeds the sum of the individual contributions, and the block-level bootstrap confidence interval excludes zero. Exact-path parity and causal-mask leakage checks further rule out two specific evaluation artifacts, namely, inconsistency of the patched exact forward and nonzero probability assigned to future tokens in the present teacher-forcing diagnostic. These checks do not prove numerical correctness of the approximation paths or validity under free-running generation.
2. Materials and Methods
We simulate fixed-point approximations for the two Transformer normalization paths studied here. The replacements are limited to the LayerNorm inverse-std path and the Softmax denominator reciprocal path, as shown in Figure 1. In Softmax, exponentiation, masking, and denominator summation remain unchanged; only the denominator reciprocal is replaced. In LayerNorm, the mean, variance, and computation of remain unchanged; only the inverse-std path is replaced. The study evaluates fixed-point approximations of two normalization paths, not whole-Transformer quantization. We first define the fixed-point representation (Section 2.1), then introduce the approximation primitives (reciprocal approximation, square-root approximation, and range scaling with threshold calibration; Section 2.2), and finally assemble them into the two normalization paths (Section 2.3).
Figure 1.
Overview of the fixed-point approximation pipeline for Transformer normalization paths. The Softmax denominator reciprocal path and the LayerNorm inverse-std path (red) are replaced with a PyTorch (version 2.5.1) fixed-point simulation, while the remaining paths are kept unchanged.
2.1. Fixed-Point Representation and Simulation
The experiments use a Q-format fixed-point simulation in which the real value and integer representation satisfy . In the standard setting, the fractional scaling factor is , so 1.0 is represented as 128. Floating-point values are rounded to integers. After fixed-point multiplication, a right shift restores the scale. Range adjustment also uses powers-of-two scaling. Previous pseudo-normalization work shows that, within a restricted input range, integer multiply-accumulate, shift, and scaling operations can replace division or inverse-square-root paths in normalization [14]. The standard setting uses and applies the reciprocal approximation twice. We denote this configuration by Q7I2. Here, Q7 specifies seven fractional bits in the Q-format representation, and I2 is a literal configuration suffix that records two applications of the reciprocal approximation defined in Section 2.2.1, rather than a mathematical subscript.
The Q7I2 setting is applied only to the two targeted normalization paths. We hold this setting fixed rather than treating its fractional precision and number of reciprocal-approximation applications as experimental variables. We focus on path-level sensitivity under this setting. Design-space exploration over fixed-point precision and the number of reciprocal-approximation applications is left for future work.
All approximation evaluations are inference-only. For BERT, the task-specific fine-tuned checkpoints are held fixed during the exact and approximate evaluations, whereas GPT-2 uses the public checkpoint without task-specific fine-tuning. No retraining is performed after introducing the approximation paths, and all models are loaded through Hugging Face Transformers [15]. The code patches only the inference-time forward path, replacing the Softmax denominator reciprocal in self-attention and the inverse-std path in LayerNorm. For the deterministic fixed-point arithmetic studied here, the PyTorch simulation includes finite-precision effects associated with the Q7 fixed-point representation, such as quantization, rounding, clamping, bit shifts, and fixed-point multiplication. It also implements the range-scaling and rescaling operations used in the two approximation paths [16].
2.2. Approximation Building Blocks
DIFT uses three building blocks: reciprocal approximation, square-root approximation, and range scaling with threshold calibration. The last component maps inputs into the valid domain of the local approximations. Section 2.3 then assembles these components into the two normalization paths.
2.2.1. Reciprocal Approximation
Division is more expensive than multiply-accumulate operations in hardware. We therefore use the same reciprocal approximation in the Softmax denominator path and the reciprocal stage of the LayerNorm inverse-std path. Following the residual-correction construction in prior work [14], we define the one-pass reciprocal approximation
Prior work denotes the same one-pass approximation by . We write it as to distinguish the mathematical function from the configuration label I2. In Q7I2, g is applied twice to successive residual states:
The reciprocal estimate after two applications is
When , exact real arithmetic gives and . These identities describe the local convergence mechanism; fixed-point rounding and shifts perturb the realized error. Here, primes denote successive residual states rather than derivatives. In the fixed-point implementation, the two applications use integer multiply-accumulate operations and shifts.
Figure 2 compares the one-application estimate , the two-application estimate used in the standard setting, and the exact . Applying g twice broadens the interval over which the estimate follows . The two-application estimate nevertheless tends to 0 as . Section 2.2.3 keeps reciprocal inputs near 1 and away from 2.
Figure 2.
Reciprocal approximations based on [14]. The gray dashed curve is the exact ; the light-blue curve is the one-application estimate ; and the green curve is the two-application estimate used in Q7I2. Applying g twice extends the region of close agreement near , but the two-application estimate tends to 0 as .
2.2.2. Square-Root Approximation
Here, r denotes the nonnegative input to the square-root function. It corresponds to the quantity written as in prior work [14].
The square root is also costly in hardware, so we approximate it with multiply-accumulate operations. The LayerNorm inverse-std term combines the square-root approximation with the reciprocal approximation (Section 2.2.1). The square-root approximation adds a power-of-two correction term to a linear approximation. A Taylor expansion near first gives a linear approximation whose coefficients, except for the constant term, are powers of two.
To correct its residual , we use a correction term whose coefficients are all powers of two,
Here, is a correction term constructed to match the residual at ; it is not exactly equal to over the full range. Subtracting this correction gives the fixed-point-oriented square-root approximation.
The coefficients , , and are all powers of two and are implemented as right shifts in fixed point. The reciprocal stage uses the Q-format form of g in Equation (1), applied twice in Q7I2. This square-root approximation is stable near , and range scaling maps its input into this stable local region.
Figure 3 compares with the exact . The approximation again matches near , and the error grows as the input moves away from 1.
2.2.3. Range Scaling and Threshold Calibration
Both formulas are local approximations centered at . The prior reciprocal analysis considers , and repeated applications widen the interval of close agreement. In DIFT, powers-of-two range scaling places the Softmax denominator and LayerNorm variance in the operating ranges of the reciprocal and square-root approximations, respectively.
Range Scaling (Bidirectional)
When the input x is below the lower bound of the stable range , it is multiplied by . When it exceeds the upper bound, it is divided by . The process stops once x falls within the range.
LayerNorm variance spans very small and very large values, so we set , , and . Amplification and shrinking are implemented by 2-bit shifts, with at most 16 iterations. For the Softmax denominator, we set , , and upper bound . Because contains an term after the max reduction, it is always at least 1 and never falls below the lower bound . The amplification branch never fires. In practice, the procedure only shrinks until it is no greater than , so bidirectional scaling reduces to unidirectional shrinking. Both paths rescale the approximation result according to the number of scaling steps. This range adjustment makes restricted-domain pseudo-normalization usable on Transformer activation distributions.
Threshold Calibration (Softmax)
We introduce a threshold because contains the factor . As , , which severely underestimates the reciprocal, compresses an entire probability row, and moves the probability sum away from 1. The reciprocal input must remain near 1 and away from 2. In Softmax, the reciprocal input is the denominator itself, so the threshold pushes back toward 1. The specific value of is then selected by calibration. In LayerNorm, the reciprocal input is . After v is mapped into , , which is already far from 2. A fixed interval is sufficient, and no additional threshold is needed.
In the continuous real-valued model, the objective for the maximum deviation of the scaled interval around 1 can be written as
Setting the left and right deviations in Equation (7) equal gives the reference value . In Q-format, however, rounding, shift, clamp, and the discrete threshold values all affect the actual error, so is selected from the candidate pool according to the calibration data.
Here, denotes the Softmax output obtained by replacing only the denominator reciprocal with the proposed fixed-point approximation using threshold , whereas denotes the corresponding exact floating-point Softmax output on the same calibration inputs.
The RMSE is computed by pooling the element-wise squared differences over all calibration samples, attention layers, and heads, and taking a single square root after division by the total number of elements.
Calibration is separated from final evaluation, and threshold selection does not directly use final validation labels or test PPL. gives the admissible range, while the calibration setting determines the subinterval searched for each model. For the selected , masked leakage is verified separately to be 0. In this computation, the causal mask is applied before exponentiation, and the denominator reciprocal provides a common scalar for each attention row. The leakage is identically 0 for any . It serves only as a safety diagnostic for the threshold and implementation, not as a criterion for screening candidates.
2.3. Application to the Normalization Paths
Combining the preceding primitives, reciprocal approximation, square-root approximation, and range scaling, gives the fixed-point replacements for the two normalization paths.
2.3.1. Softmax Denominator Reciprocal Path
Softmax normalization is written as Equation (9):
The replacement target is the denominator reciprocal . The path first applies the downward scaling from Section 2.2.3, then the reciprocal approximation from Section 2.2.1. The result is rescaled according to the number of scaling steps and applied to the exponential terms. This is the Softmax branch in Figure 1. Here, D denotes the denominator (the exponential sum), the -thresholded powers-of-two-scaled value, the fixed-point reciprocal approximation, and the rescaled inverse denominator, i.e., the approximation of . The path is , as shown in Figure 4.
Figure 4.
Processing order of the fixed-point approximation with range scaling in the Softmax denominator reciprocal path. The Softmax denominator is mapped into the local approximation range by powers-of-two scaling, then applied to the exponential terms after the fixed-point reciprocal approximation and rescaling.
2.3.2. LayerNorm Inverse-Std Path
LayerNorm normalizes over the hidden dimension of each sample. Its core form is shown in Equation (10) [17]:
The inverse square root combines the bidirectional scaling from Section 2.2.3, the square-root approximation from Section 2.2.2, and the reciprocal approximation from Section 2.2.1. This is the LayerNorm branch in Figure 1. Here, v denotes the variance after adding , the variance-domain-scaled value, the fixed-point square-root approximation, and the rescaled inverse standard deviation. The path is , as shown in Figure 5.
Figure 5.
Processing order of the fixed-point approximation with range scaling in the LayerNorm inverse-std path. The variance input is mapped into the local approximation range by powers-of-two scaling, then applied to the centered activation after the square-root approximation, the reciprocal approximation, and rescaling.
3. Results
This section evaluates the path-level sensitivity of the Q7I2 approximation in two settings: BERT GLUE classification accuracy (four tasks, three seeds) and GPT-2 WikiText-2 PPL. The experimental settings are summarized in Table 2 and Table 3. For BERT, we fine-tuned one checkpoint for each task/seed combination and reused the resulting 12 checkpoints across the exact, LayerNorm-only, Softmax-only, and Joint (DIFT) evaluations. GPT-2 used the public gpt2 checkpoint directly, without task-specific fine-tuning. Approximation effects were measured relative to the exact baseline: BERT reports accuracy delta, and GPT-2 reports PPL.
Table 2.
BERT GLUE experimental setup (data/task, evaluation, fine-tuning hyperparameters, and threshold calibration; all task/seed combinations share the fine-tuning settings).
Table 3.
GPT-2 WikiText-2 experimental setup.
3.1. Activation Range and the Necessity of Range Scaling
Before task-level evaluation, we measured the input ranges in the actual models to check whether the local approximation could be applied directly. The BERT statistics covered three seeds for SST-2, MRPC, QNLI, and MNLI. Each task/seed used at most 512 validation or validation_matched inputs. The GPT-2 statistics used 243 fixed-length blocks from the validation split and covered 25 LayerNorms and all attention heads. GPT-2 small has two LayerNorms in each of its 12 transformer blocks plus the final LayerNorm, giving 25 in total. Table 4 summarizes the input ranges of LayerNorm variance and the Softmax denominator.
Table 4.
Normalization input-range diagnostics in BERT and GPT-2.
In the table, avg. P50/P95 denotes the average of the per-task/seed or per-module summary statistics, while max P99 and max observed denote the corresponding maxima. LayerNorm variance and Softmax denominator inputs span several orders of magnitude, so they must be range-scaled before entering the valid region of the local approximation. Figure 6 visualizes the ranges in Table 4 on a logarithmic scale. The GPT-2 LayerNorm variance distribution can lie several orders of magnitude away from the local approximation center .
Figure 6.
Observed input ranges in GPT-2 and BERT. The thick line denotes the average P50–P95, the thin line the maximum P99, and the dashed line and solid dot the maximum observed value. The dashed line marks . The horizontal axis is logarithmic, and the maximum observed value can be several orders of magnitude from the bulk of the distribution.
We next examined how much the LayerNorm range adjustment in Section 2 reduced operator-level error in the approximation path.
Figure 7 shows the RMSE reduction. In BERT, the RMSE of the LayerNorm normalized output drops from 65.133 without scaling to 0.093 with scaling. In GPT-2, the corresponding RMSE drops from 360.970 to 0.040. The scaled inverse-sqrt-domain RMSE in BERT remains relatively large at 1.676, but the mean relative error is 0.036. After multiplication by the centered input, the normalized-output RMSE drops to 0.093. Range adjustment therefore affects both the absolute error in the inverse-sqrt domain and the downstream RMSE of the LayerNorm output.
Figure 7.
Effect of LayerNorm range scaling on operator-level RMSE. The figure shows the inverse-sqrt and normalized-output RMSE for BERT and GPT-2. The vertical axis is logarithmic, and the gap between no range scaling and scaled denotes the error reduction from range adjustment.
3.2. Threshold Calibration
The threshold selected by calibration varied by setting. BERT used 12 independently fine-tuned checkpoints (four tasks × three seeds), each calibrated separately, so one global constant would not summarize the result. Table 5 lists the selected BERT thresholds. Only SST-2 varies across the three seeds, indicating that calibration subsets and checkpoints can affect the selected value. GPT-2 used a single checkpoint and selected . Section 4.3 visualizes and analyzes the threshold calibration sweep.
Table 5.
Softmax thresholds selected by BERT GLUE calibration (=, selected from the candidate pool ).
3.3. BERT GLUE Results
Using the calibrated thresholds, we first report aggregate BERT GLUE results over the three seeds as path-specific accuracy deltas in Table 6. Accuracy delta is measured in percentage points relative to the exact baseline. Each value is the mean over three seeds ± the sample standard deviation. Under Joint (DIFT), the mean accuracy change is about to percentage points. The drop appears mainly in the LayerNorm-only setting, whereas Softmax-only is nearly zero. MRPC has the largest across-seed variance, with a particularly wide LayerNorm-only interval (accuracy delta percentage points).
Table 6.
BERT GLUE ablation results. The exact baseline column reports the absolute accuracy of each task in percent, and the three accuracy delta columns report the change relative to the exact baseline in percentage points. Each value is the mean over 3 seeds ± the sample standard deviation. The Joint (DIFT) column corresponds to simultaneously applying our standard Q7I2 approximation to the LayerNorm inverse-standard-deviation and Softmax denominator-reciprocal paths.
Although the accuracy delta is small, the approximate predictions are not identical to the exact predictions. Table 7 summarizes the prediction match rate relative to the exact-path predictions and the p-value of the McNemar test with continuity correction [23]. The prediction match rate ranges from 95.8% to 98.8%, indicating a measurable prediction-level perturbation. In the McNemar test, QNLI () and MNLI () show a shift in the error distribution at the nominal level , whereas SST-2 and MRPC are not significant. Under a Bonferroni correction for four tasks (), none is significant. Even for nominally significant QNLI and MNLI, the corresponding accuracy delta is only about 0.23–0.24 percentage points. The test therefore detects a distribution-level shift, such as changed predictions but does not imply a similarly large aggregate-accuracy degradation. MRPC has large across-seed variance and should be read as a trend-level result; its F1 is also nearly unchanged (baseline 0.891).
Table 7.
Prediction-level diagnostics of Joint (DIFT). The prediction match rate relative to the exact-path predictions is reported in percent, together with the corresponding p-value from the McNemar test with continuity correction. The prediction match rate is the mean over 3 seeds ± the sample standard deviation, and * denotes the uncorrected nominal significance level p < 0.05.
3.4. GPT-2 WikiText-2 Results
GPT-2 WikiText-2 PPL was more sensitive under Joint (DIFT). Related GPT-2 quantization studies also report that naive quantization or insufficient calibration in generative language models can amplify PPL degradation [24,25]. Joint (DIFT) increased fixed-length-block test PPL from 29.009 to 31.092, giving a PPL of . To separate the error sources by path, we also evaluated LayerNorm-only and Softmax-only settings (Table 8). Using paired block-level bootstrap resampling (10,000 resamples) and token-weighted aggregation, the 95% CI of the Joint (DIFT) PPL was .
Table 8.
GPT-2 WikiText-2 ablation results.
Both LayerNorm-only and Softmax-only increased PPL. The sum of their PPL values was , which was smaller than the Joint (DIFT) PPL of . The difference, (block-level bootstrap CI , excluding zero), was the interaction term between the two approximation paths. Thus, the Joint (DIFT) degradation exceeds the sum of the individual contributions and is superadditive. Section 4.5 gives the detailed decomposition and interpretation.
4. Discussion
The same normalization approximation affects the two metric classes differently. BERT GLUE classification accuracy changes by only about to percentage points, whereas GPT-2 test PPL rises from 29.009 to 31.092 (PPL ). The argmax-based classification metric changes little, while PPL, which accumulates token-level likelihood, is more sensitive. We first verify the experimental setup, then discuss the implications for classification, language modeling, and pre-hardware design.
4.1. Soundness of the Patch Framework
The patch framework intervenes in the inference-time forward path and replaces only selected LayerNorm and Softmax computations. We therefore checked whether the intervention changed exact computation even before approximation was enabled. For BERT, we ran the patched forward in exact/exact mode and compared it with the corresponding unpatched fine-tuned checkpoint. BERT passed full validation parity on all 12 task/seed combinations, with a maximum absolute logit difference of , on the same order as fp32 numerical tolerance. The prediction match rate was 1.0, so the patched exact forward gave the same argmax predictions as those obtained from the corresponding unpatched fine-tuned BERT checkpoint.
GPT-2 underwent the same check on the full WikiText-2 fixed-block test evaluation. The comparison covered 279 blocks of length 1024, 285,417 predicted tokens, and about logit elements. The maximum, mean, and RMSE logit differences between the original forward and the patched exact/exact forward were all zero, and the token-level top-one match rate was 1.0. Both runs had loss per token 3.367595 and PPL 29.008674. Under the checkpoint, eager attention, fixed-length blocks, use_cache=False, and fp32 CPU execution used in this paper, the patched exact path reproduced the original GPT-2 forward.
These checks show that, in exact mode, the patched forward agrees numerically with the original model on both BERT and GPT-2.
4.2. Causal-Mask Leakage and Normalization Error Diagnostics
Table 9 summarizes the numerical diagnostics used to interpret the task metrics. For Joint (DIFT) on BERT, we measured mean probability L1 and top-one prediction change rate in addition to the prediction match rate and logit RMSE. The outputs retained a measurable perturbation, but the top-one prediction was unchanged for most samples.
Table 9.
Numerical diagnostics of Joint (DIFT). BERT values are means over 3 seeds of the four GLUE tasks, and GPT-2 values are for the test split.
Under Joint (DIFT) on GPT-2, the Softmax approximation error is small, and the recorded masked probability leakage is zero. The causal mask is applied before exponentiation, and the denominator reciprocal approximation provides a common scalar for each attention row. Leakage of zero is therefore expected in this computation. Masked leakage is not used to screen candidate thresholds; it is only a safety diagnostic for the selected threshold and implementation. The Softmax normalization itself still has a mean error, and PPL increases. This check is specific to decoder-only GPT-2 with a causal mask. BERT is bidirectional and does not involve future-token leakage.
Even when the mask is preserved, small changes in probability values and LayerNorm outputs can accumulate across layers and change the likelihood of the decoder-only language model. The PPL increase below arises from this type of perturbation.
The parity and mask-leakage checks rule out two specific evaluation issues: inconsistency of the patched exact forward and nonzero causal-mask leakage. Within the software evaluation protocol used here, the observed accuracy and PPL changes come from enabling the approximation paths, not from patched-forward inconsistency or causal-mask leakage.
4.3. Softmax Threshold Calibration
Figure 8 relates the candidate threshold to Softmax RMSE and marks the selected for each setting. The RMSE minimum occurs at a smaller than the continuous-real-model reference value . This is expected from Section 2.2.3: in Q-format, rounding, shifts, clamps, and the discrete candidate pool all affect the realized error and can move the optimum away from the analytic value. In the figure, the red region marks thresholds for which Softmax RMSE rises sharply because is too large. The selected values all fall in the low-RMSE green region. Thus, should be calibrated empirically for each model or checkpoint, rather than fixed at the analytic continuous-model value.
Figure 8.
Relationship between the candidate threshold and the Softmax RMSE in Softmax threshold calibration. The blue line is the median of the 12 BERT calibrations (tasks × seeds), the shaded band denotes their min–max range, and the red line is the GPT-2 WikiText-2 validation value. The vertical axis is logarithmic. The green region is where the RMSE stays low, and the red region is where the RMSE rises sharply when is too large; the vertical dashed line marks the continuous-real-model reference value . The ▲ (BERT) and • (GPT-2) on the curve are the selected for each setting; the // above the ▲ denote how many of the 12 calibrations selected that .
4.4. Implications for the BERT Classification Task
For Joint (DIFT) on BERT GLUE, the mean accuracy change is only about to percentage points (Table 6). In terms of aggregate accuracy, fixed-point approximation of the two normalization paths has only a small effect.
We used direct replacement to test whether the two target paths could adopt the proposed fixed-point approximations without substantial loss of classification accuracy. That evaluation did not assess the model’s broader classification robustness. The reported accuracy changes were measured without post-replacement fine-tuning. In deployment, task-specific fine-tuning may be applied after replacement, but its effect was not evaluated here. Although aggregate accuracy changed little, the exact and approximate predictions were not identical. The McNemar test and prediction match rate quantified that residual perturbation (Table 7). In the McNemar test, QNLI () and MNLI () reached the nominal level (), whereas SST-2 and MRPC were not significant. After Bonferroni correction for four tasks (), none was significant. This test pooled predictions from three seeds, so independence across seeds was an approximation. Even for QNLI and MNLI, the corresponding accuracy change was only about 0.23–0.24 percentage points. The test captures a distribution-level shift, such as prediction replacement, whose size need not match the aggregate-accuracy degradation.
4.5. GPT-2 PPL Sensitivity
By contrast, GPT-2 WikiText-2 fixed-length-block PPL is more sensitive. Joint (DIFT) increases test PPL from 29.009 to 31.092, a PPL of +2.083 (Table 8). The LayerNorm-only and Softmax-only ablations show that both normalization paths contribute to this increase.
This observation is consistent with the metric-sensitivity interpretation. PPL aggregates token likelihood as a continuous value. In GPT-2 small, small probability perturbations can accumulate across 25 LayerNorms and a 1024-token fixed-length block before being converted into PPL through the exponential function. By contrast, BERT classification accuracy depends on whether the argmax changes. A logit perturbation leaves the metric unchanged as long as the top-one prediction is preserved. In Joint (DIFT) on BERT, both the top-one prediction change rate and logit RMSE are small (Table 9), and the accuracy delta remains only about to percentage points.
Differences in dynamic range may further amplify this sensitivity gap. Table 4 shows that the maximum observed LayerNorm variance is 13,105.607 in GPT-2 and 2215.586 in BERT. The avg. P95 of the Softmax denominator is 22.286 in GPT-2 and 9.752 in BERT. Powers-of-two scaling maps these inputs into the valid region of the local approximation through bit shifts. The quantization and rounding errors introduced by scaling and fixed-point right shifts are already included in the reported approximation error.
The two normalization paths interact superadditively (Figure 9). The sum of the LayerNorm-only and Softmax-only PPL values is , smaller than the Joint (DIFT) PPL of . The difference is the interaction term, (95% CI ). This term is positive and excludes zero in both PPL space and mean NLL (log-PPL) space; Table 10 gives the detailed decomposition. In PPL space, the interaction comes mainly from the residual interaction in NLL space, while Jensen convexity of the exp transform contributes little. This decomposition reflects the metric structure and does not imply an additional hardware-level interaction mechanism between the two paths. In any case, the Joint (DIFT) degradation is larger than the sum of the independent path contributions. BERT does not allow the corresponding interaction term to be estimated reliably because its accuracy delta is buried in across-seed variance. In addition, an argmax-based metric lacks the decomposable structure of log-likelihood additivity or exp convexity.
Figure 9.
Decomposition of PPL in the GPT-2 WikiText-2 ablation. Blue, green, and red denote the LayerNorm-only contribution, Softmax-only contribution, and interaction term, respectively. The dashed line is the sum of LayerNorm-only and Softmax-only, and its difference from Joint (DIFT) is the interaction term of the two approximation paths. Numerical values are given in the text and in Table 10.
Table 10.
Decomposition of the interaction term in the GPT-2 PPL (test split, in PPL). The PPL of each setting is given in Table 8.
4.6. Quantitative Comparison with Related Normalization Methods
To complement the qualitative positioning in Table 1, Table 11 compares the reported task-level results of selected non-GEMM normalization methods.
Table 11.
Cross-study comparison based on reported encoder- and decoder-side task-level results for selected non-GEMM normalization methods. “pp” denotes percentage points.
Because the compared studies used different models, datasets, approximation scopes, and evaluation protocols, the reported values should be interpreted as cross-study context rather than as a controlled head-to-head benchmark.
The compared methods also differ in their replacement arithmetic. Kim et al. combine PLA-based exponentiation with a shared divider and Newton-based square-root computation. Choi et al. use LUT-based exponentiation together with a fixed-point divider and Newton-based inverse-square-root computation. I-BERT, SOLE, and Li et al. instead use integer-polynomial, log-domain/shift-add, and multiplication/shift/LUT structures, respectively. DIFT targets only the Softmax denominator-reciprocal and LayerNorm inverse-standard-deviation paths, replacing explicit division and inverse-square-root operations in these paths with fixed-point multiplications, additions/subtractions, bit shifts, and comparisons.
4.7. Implications for the Pre-Hardware Design Stage
This study targets embedded and edge deployment at the pre-hardware analysis stage. Here, we ask how many fixed-point multiplications, additions/subtractions, shifts, and comparisons are introduced when division or rsqrt in the mathematical normalization path is replaced under the proposed approximation formulas and fixed-point datapath. The operation counts shown in Figure 10 are active-path static analytical upper bounds for the specialized scalar replacement datapath. They characterize the structure of the replacement path and do not correspond to PyTorch runtime measurements or synthesized hardware counts. Figure 10 shows only the operations that change: the left-column panels report the explicit division and rsqrt operations eliminated from the original normalization path, whereas the right-column panels report the fixed-point operations introduced by the approximate reconstruction path. In both workloads, exp and the original Softmax summation and add/sub paths are unchanged and are therefore excluded from removed and added counts. The GLUE validation workload aggregates the validation sets of the four tasks as a single evaluation pass and does not accumulate over the three seeds. The WikiText-2 test workload corresponds to the fixed-length-block test evaluation.
Figure 10.
Replacement-path operation counts of DIFT, arranged by workload (active-path static analytical upper bounds). Top row: (a,b) GLUE validation; bottom row: (c,d) WikiText-2 test. The left column (a,c) shows the removed special-function operations: division is counted at the reciprocal-reuse granularity shared by the exact and approximate paths, corresponding to one reciprocal per Softmax row, while rsqrt is counted once per LayerNorm group. The right column (b,d) shows the added fixed-point primitives (add/sub, fixed mult., shift, compare; select is omitted). Each panel has an independent y-axis. The added add/sub count denotes the net increment introduced by two applications of the reciprocal approximation g defined in Equation (1), the square-root correction, and range scaling. The vertical axis is in units of operations.
Figure 10 gives the composition of the operations that change along the replacement path. At matched granularity, DIFT replaces one exact reciprocal per Softmax row and one rsqrt per LayerNorm group with a regular fixed-point datapath of multiplications, additions/subtractions, shifts, and comparisons. The removed-division counts use this same reciprocal-reuse granularity and are therefore consistent with the added-operation counts. Under this count, the added primitives outnumber the removed special-function operations. This is a trade for regular datapath structure, not a claim of speedup. The reconstruction computes one approximate reciprocal for the shared denominator in Equation (9) and reuses it across the row. The count therefore scales mainly with the number of Softmax rows and LayerNorm groups. LayerNorm mean/variance divisions stay exact and are not counted as removed. For reference, under a naive element-wise Softmax denominator baseline with one division per key position, the removed division counts would be 207.84 and 421.28 for GLUE and WikiText-2, respectively. These values represent upper bounds of the pre-optimization mathematical expression and are not used as the primary operation counts. Because absolute counts depend on example count, sequence length, and attention shape, Figure 10 characterizes only the structural change of the normalization path. The two workloads should not be read as an end-to-end efficiency ranking.
The replacement path can support screening at the pre-hardware design stage. The results quantify the task-level changes in BERT classification and GPT-2 PPL when part of these irregular computation paths is mapped to a more regular fixed-point datapath.
4.8. Limitations
The scope of this study was deliberately bounded. At the implementation level, the experiments were limited to algorithm-level fixed-point simulation and replacement-path operation counts. They did not include FPGA or ASIC implementation. Device-level stochastic faults and other hardware-specific nonidealities were not modeled in the present deterministic simulation; evaluating such effects would require implementation-level validation on the target hardware. We therefore make no claim about actual speedup, energy saving, area reduction, or resource reduction. The GPT-2 analysis reported only teacher-forcing PPL on fixed-length blocks and did not evaluate free-running generation. The parity and mask-leakage checks verified only the exact branch and the teacher-forcing diagnostic in the current software protocol. They did not prove the approximation formulas correct, guarantee equivalence between approximate Softmax and exact normalization, or cover mask representation in finite-bit-width hardware, KV-cache decoding, or free-running generation. Each of these still requires independent verification. The Softmax threshold was empirical and model/checkpoint-dependent and should not be treated as a model-independent constant.
At the generalization level, this paper was limited to BERT-base and GPT-2 small. Extrapolation to larger models or other Transformer architectures requires careful verification. The sensitivity difference between BERT classification and GPT-2 PPL was observed for one model scale per family under the present evaluation protocols: BERT-base with 12 task/seed-specific fine-tuned checkpoints and GPT-2 small with one public checkpoint. That difference supports the metric-sensitivity interpretation: argmax-based accuracy is insensitive to small perturbations, while PPL accumulates token-level likelihood perturbations. It does not establish a general conclusion that decoder-only architectures are intrinsically more sensitive. In this setting, metric type (argmax versus accumulated likelihood) is confounded with model family and task, so it cannot be isolated as a single factor. BERT also showed measurable perturbations at the logit/probability level (Table 9); most of these perturbations simply did not flip the argmax. This contrasted with PPL, where perturbations accumulated through likelihood, but it was still insufficient to fully separate the confounding factors.
At the statistical-evidence level, we chose tests according to metric type. For BERT, paired classification predictions can be constructed, so we used a paired McNemar test, although the analysis was limited to three fine-tuning seeds. For GPT-2, which yields continuous-valued PPL, we used a block-level bootstrap CI. This CI reflected only block-to-block variation within the test split and did not include variation from model checkpoints or fine-tuning seeds.
5. Conclusions
This paper studied two non-GEMM normalization paths in Transformer inference: the inverse-std path in LayerNorm and the denominator reciprocal path in Softmax. Building on restricted-domain integer approximation in pseudo-normalization, we implemented DIFT as a fixed-point approximation simulation in the PyTorch inference path. Range scaling and threshold calibration adapted the local approximation to the observed activation distribution. The experimental protocol separated calibration from final evaluation, avoiding hyperparameter selection based on final evaluation labels or test PPL.
The results showed that the same approximation setting could lead to different sensitivities across evaluation metrics. BERT GLUE classification accuracy changed very little, whereas GPT-2 PPL increased measurably. This pattern is consistent with the difference between argmax-based accuracy and PPL, which accumulates token-level likelihood and then applies an exponential transform. The LayerNorm-only and Softmax-only ablations further showed that Joint (DIFT) degradation exceeded the sum of the independent path contributions. This positive interaction appeared in both PPL space and mean NLL (log-PPL) space. These observations were obtained for one model scale per family under the present evaluation protocols. Because metric type was not fully separated from model family and task, broader extrapolation requires further verification.
DIFT can be used for algorithm-level screening before hardware realization of Transformer normalization paths. Within a single experimental framework, it exposes error sources, task sensitivity, and the computational structure after replacement. Future work includes datapath-level simulation, FPGA/ASIC prototype verification, free-running generation evaluation, and validation of the observed sensitivity differences across broader model scales and multiple checkpoints. A systematic design-space study is also needed to determine how fixed-point precision, rounding effects, and the number of reciprocal-approximation applications affect approximation error and inform theoretical optimization.
Author Contributions
Conceptualization, K.W., T.K. and T.T.; methodology, K.W.; application and experiment, K.W.; validation, K.W.; writing—original draft preparation, K.W.; writing—review and editing, T.K. and T.T.; supervision, T.K. and T.T. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Data Availability Statement
The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| ASIC | Application-Specific Integrated Circuit |
| BERT | Bidirectional Encoder Representations from Transformers |
| FPGA | Field-Programmable Gate Array |
| GLUE | General Language Understanding Evaluation |
| NPU | Neural Processing Unit |
| PPL | Perplexity |
| PTQ | Post-Training Quantization |
| RMSE | Root-Mean-Square Error |
References
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention Is All You Need. In Proceedings of the 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA, 4–9 December 2017; Volume 30, pp. 5998–6008. [Google Scholar]
- Choi, D.; Kim, H.; Kim, J.H. Hardware-Efficient Softmax and Layer Normalization with Guaranteed Normalization for Edge Devices. In Proceedings of the 2026 IEEE International Symposium on Circuits and Systems (ISCAS), Shanghai, China, 24–28 May 2026; pp. 1246–1250. [Google Scholar] [CrossRef] [Scilit]
- Chitty-Venkata, K.T.; Mittal, S.; Emani, M.; Vishwanath, V.; Somani, A.K. A survey of techniques for optimizing transformer inference. J. Syst. Archit. 2023, 144, 102990. [Google Scholar] [CrossRef] [Scilit]
- Lin, J.; Tang, J.; Tang, H.; Yang, S.; Xiao, G.; Han, S. Awq: Activation-aware weight quantization for on-device llm compression and acceleration. GetMobile Mob. Comput. Commun. 2025, 28, 12–17. [Google Scholar] [CrossRef] [Scilit]
- Kim, R.; Lee, D.; Kim, J.; Park, J.; Lee, S.E. Hardware Accelerator for Approximation-Based Softmax and Layer Normalization in Transformers. Electronics 2025, 14, 2337. [Google Scholar] [CrossRef] [Scilit]
- Kim, S.; Hooper, C.; Wattanawong, T.; Kang, M.; Yan, R.; Genc, H.; Dinh, G.; Huang, Q.; Keutzer, K.; Mahoney, M.W.; et al. Full Stack Optimization of Transformer Inference: A Survey. arXiv 2023, arXiv:2302.14017. [Google Scholar] [CrossRef] [Scilit]
- Xiao, G.; Lin, J.; Seznec, M.; Wu, H.; Demouth, J.; Han, S. SmoothQuant: Accurate and efficient post-training quantization for large language models. In Proceedings of the 40th International Conference on Machine Learning (ICML 2023), Honolulu, HI, USA, 23–29 July 2023; Volume 202, pp. 38087–38099. [Google Scholar]
- Frantar, E.; Ashkboos, S.; Hoefler, T.; Alistarh, D. OPTQ: Accurate quantization for generative pre-trained transformers. In Proceedings of the 11th International Conference on Learning Representations (ICLR 2023), Kigali, Rwanda, 1–5 May 2023. [Google Scholar]
- Kim, S.; Gholami, A.; Yao, Z.; Mahoney, M.W.; Keutzer, K. I-BERT: Integer-only BERT quantization. In Proceedings of the 38th International Conference on Machine Learning (ICML 2021), Virtual Event, 18–24 July 2021; Meila, M., Zhang, T., Eds.; PMLR: New Orleans, LA, USA, 2021; Volume 139, pp. 5506–5518. [Google Scholar]
- Wang, W.; Zhou, S.; Sun, W.; Sun, P.; Liu, Y. Sole: Hardware-software co-design of softmax and layernorm for efficient transformer inference. In Proceedings of the 2023 IEEE/ACM International Conference on Computer Aided Design (ICCAD), San Francisco, CA, USA, 28 October–2 November 2023; pp. 1–9. [Google Scholar] [CrossRef] [Scilit]
- Li, W.; Lyu, D.; Wang, G.; Hu, A.; Xu, N.; He, G. Hardware-oriented algorithms for softmax and layer normalization of large language models. Sci. China Inf. Sci. 2024, 67, 200404. [Google Scholar] [CrossRef] [Scilit]
- Stevens, J.R.; Venkatesan, R.; Dai, S.; Khailany, B.; Raghunathan, A. Softermax: Hardware/software co-design of an efficient softmax for transformers. In Proceedings of the 2021 58th ACM/IEEE Design Automation Conference (DAC), San Francisco, CA, USA, 5–9 December 2021; pp. 469–474. [Google Scholar] [CrossRef] [Scilit]
- Kang, Y.; Wang, D. Hardware-Oriented Approximations of Softmax and RMSNorm for Efficient Transformer Inference. Micromachines 2026, 17, 84. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Kusaka, T.; Tanaka, T. Pseudo-Normalization via Integer Fast Inverse Square Root and Its Application to Fast Computation without Division. Electronics 2024, 13, 2955. [Google Scholar] [CrossRef] [Scilit]
- Wolf, T.; Debut, L.; Sanh, V.; Chaumond, J.; Delangue, C.; Moi, A.; Cistac, P.; Rault, T.; Louf, R.; Funtowicz, M.; et al. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, Online, 16–20 November 2020; pp. 38–45. [CrossRef] [Scilit]
- Paszke, A.; Gross, S.; Massa, F.; Lerer, A.; Bradbury, J.; Chanan, G.; Killeen, T.; Lin, Z.; Gimelshein, N.; Antiga, L.; et al. PyTorch: An imperative style, high-performance deep learning library. In Proceedings of the 33rd Conference on Neural Information Processing Systems (NeurIPS 2019), Vancouver, BC, Canada, 8–14 December 2019; Wallach, H., Larochelle, H., Beygelzimer, A., d’Alché Buc, F., Fox, E., Garnett, R., Eds.; Curran Associates, Inc.: Red Hook, NY, USA, 2019; Volume 32, pp. 8024–8035. [Google Scholar]
- Ba, J.L.; Kiros, J.R.; Hinton, G.E. Layer normalization. arXiv 2016, arXiv:1607.06450. [Google Scholar] [CrossRef] [Scilit]
- Devlin, J.; Chang, M.W.; Lee, K.; Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers); Association for Computational Linguistics: Stroudsburg, PA, USA, 2019; pp. 4171–4186. [Google Scholar] [CrossRef] [Scilit]
- Wang, A.; Singh, A.; Michael, J.; Hill, F.; Levy, O.; Bowman, S.R. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP; Association for Computational Linguistics: Stroudsburg, PA, USA, 2018; pp. 353–355. [Google Scholar] [CrossRef] [Scilit]
- Radford, A.; Wu, J.; Child, R.; Luan, D.; Amodei, D.; Sutskever, I. Language Models are Unsupervised Multitask Learners. OpenAI Technical Report. 2019. Available online: https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf (accessed on 5 July 2026).
- Merity, S.; Xiong, C.; Bradbury, J.; Socher, R. Pointer sentinel mixture models. In Proceedings of the 5th International Conference on Learning Representations (ICLR 2017), Toulon, France, 24–26 April 2017. [Google Scholar]
- Hugging Face. Perplexity of Fixed-Length Models. Transformers Documentation, Version 4.42.0. 2026. Available online: https://huggingface.co/docs/transformers/v4.42.0/en/perplexity (accessed on 7 June 2026).
- McNemar, Q. Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika 1947, 12, 153–157. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Tao, C.; Hou, L.; Zhang, W.; Shang, L.; Jiang, X.; Liu, Q.; Luo, P.; Wong, N. Compression of generative pre-trained language models via quantization. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers); Association for Computational Linguistics: Stroudsburg, PA, USA, 2022; pp. 4821–4836. [Google Scholar] [CrossRef] [Scilit]
- Park, M.; You, J.; Nagel, M.; Chang, S. Quadapter: Adapter for GPT-2 quantization. In Proceedings of the Findings of the Association for Computational Linguistics: EMNLP 2022, Abu Dhabi, United Arab Emirates, 7–11 December 2022; pp. 2510–2517. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.









