1. Introduction
Hyperspectral imaging (HSI) captures both dense spectral information, by recording hundreds of narrowly spaced contiguous bands for each pixel, and high-resolution spatial information [
1]. HSI enables not only non-destructive analysis of material properties, but also detailed spatial feature extraction [
2]. As a result, HSI has become a key technology in high-impact applications ranging from food safety and quality control to remote-sensing-based environmental monitoring and land-cover mapping [
3,
4,
5]. One particularly important application in food safety is foreign object detection (FOD) and classification, which seeks to identify small (≈5 mm) non-biological foreign objects (FOs), especially low-density foreign plastic objects (FPOs), in food products, objects that are often difficult to detect using other imaging modalities such as X-ray or conventional RGB vision [
3,
6,
7]. These FOs in food production lines pose severe health risks to consumers, but can also result in costly product recalls and brand damage [
8]. Efficient detection and removal of such contaminants are therefore essential for maintaining food-safety standards and ensuring regulatory compliance. More recently, deep learning (DL) approaches, particularly HSI-based and transformer-based methods, have increasingly outperformed traditional methods that primarily rely on spectral analysis in a variety of hyperspectral computer vision tasks across both remote sensing and food inspection, owing to their ability to learn complex spatial–spectral representations [
4,
5]. However, the same properties that make HSI powerful, high spectral dimensionality and fine spatial resolution, also create significant efficiency bottlenecks. Modern deep HSI classifiers must process large spatial–spectral tensors, and transformer-based architectures further amplify this cost by modeling complex spatial and spectral interactions through computationally expensive attention mechanisms and large general matrix multiplications (GEMMs), making them both memory- and compute-intensive [
9]. These efficiency constraints hinder the practical deployment of transformer-based HSI models, particularly in throughput-constrained environments such as industrial food inspection lines [
10].
Low-precision numerical representations and arithmetic can significantly improve the efficiency of both training and inference in deep learning models. Reducing numerical bit-width with low-precision operations decreases memory footprint and can lower the cost of computation and data movement, thereby improving overall efficiency [
11,
12,
13]. Quantization provides the mechanism for achieving this by mapping high-precision values to lower-bit representations. It has become an effective strategy for reducing memory requirements, computational costs, and improving overall efficiency, particularly in large pretrained models. These advantages motivated the adoption of 16-bit floating-point formats, such as Google’s Brain Floating Point 16-bit (BF16) [
14], as a standard alternative to the full-precision floating-point format (FP32) in the training of early large language models (LLMs). BF16 not only reduces memory usage and improves efficiency but also enhances numerical robustness by preserving an FP32-like dynamic range, with 8 bits for the exponent [
15]. In recent years, 8-bit floating-point (FP8) formats have also been introduced, and recent studies suggest that FP8 is both feasible and effective for training and inference in LLMs, while offering additional efficiency gains [
16,
17,
18,
19]. Consequently, FP8 is rapidly emerging as a new standard for large-scale model training in both natural language processing and computer vision [
17,
18]. More recently, NVIDIA introduced the Blackwell GPU architecture, representing a major milestone as the first GPU to natively support 4-bit floating-point (FP4) operations such as matrix multiplication via specialized tensor cores [
20]. This development has pushed the precision frontier even further, and preliminary studies have proposed FP4 formats with different scaling-factor strategies and block sizes that show promising performance and energy-efficiency gains for LLM training while maintaining model accuracy and training stability [
21]. Beyond training, these low-precision formats have also been widely studied for inference efficiency, and 8-bit and 4-bit numerical formats have increasingly become standard choices for inference in large pretrained models. However, although such formats have been actively explored for LLM training, especially FP8 and FP4, it remains unclear whether aggressive quantization strategies that are effective for large pretrained vision or language models transfer directly to much smaller transformer-based HSI models [
18,
22]. HSI inputs consist of continuous, high-dimensional spectral signatures, where discriminative information may be encoded in subtle magnitude differences across correlated bands; as a result, quantization noise may interact with the spectral feature space in domain-specific ways. Moreover, smaller models may derive limited benefit from specialized hardware accelerators such as Blackwell tensor cores, which natively support FP4 and FP8 matrix multiplication and typically realize their full advantage in the large-scale GEMMs characteristic of massive-model pretraining and inference.
In practice, model quantization approaches are categorized into fully quantized training (FQT), post-training quantization (PTQ), and quantization-aware training (QAT). The latter two are primarily inference-oriented. In PTQ, a pretrained model, typically trained in full precision, is converted to a lower precision without further training to enable more efficient inference [
13,
23,
24]. In QAT, by contrast, the model is trained using higher-precision arithmetic for parameter updates, while quantization effects are simulated during training through fake-quantized weights and activations so that the model learns to remain robust under low-precision inference, thereby preserving accuracy more effectively than PTQ [
25]. FQT differs from both PTQ and QAT in that it is not only intended to preserve robustness and accuracy under quantization but is also explicitly oriented toward training efficiency. In FQT, the model is trained predominantly in the target low precision throughout the training process; that is, weights, activations, and gradient computations are all performed in low-bit formats, enabling efficiency gains during training itself [
21]. PTQ has been shown to be a practical and straightforward strategy for deploying low-precision inference when retraining is infeasible or computational resources are limited, as is often the case for large pretrained models [
13,
26]. PTQ typically relies on calibration statistics to estimate dynamic ranges, particularly for activations. Although effective at moderate precisions, PTQ can suffer performance degradation under more aggressive quantization levels and in models that are sensitive to activation outliers [
23,
27,
28]. For large pretrained transformer models, specialized PTQ techniques, largely developed in the language-model literature, have further improved quantization parameter optimization for effective deployment [
29,
30]. QAT is typically used as a complementary approach to PTQ, yielding better accuracy preservation during inference because the model learns to compensate for quantization-induced errors during training. However, QAT requires access to the training recipe as well as additional retraining time and computational cost, making it more suitable when high accuracy must be maintained and retraining remains feasible. Unlike FQT, however, it does not provide gains in training efficiency. More recently, FQT has emerged as an effective approach for reducing training cost while also demonstrating stable convergence and numerical robustness at low precision compared with higher-precision training. Recent studies show that low-precision training can succeed when supported by appropriate scaling strategies and block-size design choices [
17,
21,
31]. In addition, prior work has demonstrated the feasibility of FP8 and FP4 FQT on Blackwell GPUs by leveraging tensor cores for large-model training [
17,
21,
32]. Beyond the question of when quantization is applied, an equally important consideration is how it is applied. Quantization does not necessarily require a uniform precision across all layers or operations of a neural network. Mixed-precision quantization assigns different bit-widths to different layers or computations according to their sensitivity to quantization. In doing so, it seeks to balance model size, computational efficiency, and predictive performance by allocating higher precision to more sensitive components and lower precision to less sensitive ones [
33].
Despite the growing interest in low-precision computing and its demonstrated effectiveness for accelerating training and inference in large foundation models, a critical gap remains in understanding how aggressive quantization affects transformer models operating on high-dimensional hyperspectral data. Existing HSI studies predominantly rely on FP32 or FP16 training, while the comparatively limited use of quantization in HSI has largely focused on inference-oriented PTQ at moderate precisions. In contrast, emerging floating-point formats such as FP8 and FP4 have been investigated primarily for large-scale language and vision models, and their suitability for compact HSI transformers remains largely unexplored. Consequently, there is still no systematic understanding of whether such models can be reliably trained and deployed across progressively reduced floating-point precisions, or whether FQT provides an advantage over PTQ in preserving predictive performance. Moreover, the lack of a controlled evaluation across FP32, FP16, BF16, FP8, and FP4 limits the development of practical guidelines for selecting precision configurations in resource-constrained HSI applications. In this paper, we investigate mixed-precision quantization as a practical strategy for enabling efficient transformer-based HSI classifier training and inference without sacrificing predictive accuracy. Using a compact transformer for foreign plastic object classification in hyperspectral poultry images as a representative case study, we isolate numerical precision as the primary experimental variable by holding the architecture, optimizer, data pipeline, training protocol, and inference procedure constant while varying only the computation precision. We further distinguish between training-phase behavior under fully quantized training (FQT) and inference-phase behavior under both FQT and PTQ, providing a comprehensive analysis of the trade-offs between numerical precision, model accuracy, and computational efficiency. Our study not only characterizes the robustness limits of low-precision training but also identifies mixed-precision configurations that maintain accuracy even under aggressive quantization, providing practical guidance for efficient deployment of compact HSI transformers. Our contributions are fourfold:
- 1.
Accuracy-preserving mixed-precision strategies. We identify mixed-precision configurations that retain near-full-precision accuracy under aggressive 8-bit and 4-bit quantization.
- 2.
End-to-end training-phase comparison across the precision spectrum for mixed-precision FQT. We provide a controlled evaluation of transformer-based pixel-level FPO classification under FP32, FP16, BF16, FP8, and FP4, and distinguish the regimes in which FQT remains stable from those in which it leads to accuracy degradation.
- 3.
Joint inference accuracy–efficiency characterization of both FQT and PTQ. Beyond headline OA, we report class-balanced and agreement-based metrics together with detailed training and inference efficiency measurements, enabling an accuracy–efficiency frontier analysis rather than a single-point comparison.
- 4.
Deployment-oriented guidance. By explicitly comparing FQT and PTQ at inference under the same target precisions, we identify when PTQ is sufficient for rapid deployment and when FQT is justified to preserve accuracy under aggressive quantization.
2. Preliminaries
According to the IEEE 754 standard [
34], a binary floating-point number consists of three components: a 1-bit sign (
S), exponent bits (
E), and mantissa (fraction) bits (
M). In the machine learning literature, this representation is often denoted as
ExMy, where
x and
y specify the number of exponent and mantissa bits, respectively. For instance, FP16 is represented as E5M10, whereas BF16 uses E8M7. FP8 typically comes in two variants, E4M3 and E5M2. In contrast, FP4 uses the E2M1 format, using two exponent bits and one mantissa bit for its 4-bit floating-point representation [
35]. Unlike integer (INT) quantization, floating-point (FP) quantization is characterized by nonuniform quantization intervals and a wider dynamic range. To quantize a high-precision tensor such as FP32 into lower-precision FP formats, including FP16, BF16, FP8, and FP4, and to dequantize it accordingly, we formulate a unified quantization–dequantization framework in which each FP precision paradigm is treated as a special boundary case determined by its scaling-factor mechanism.
The generalized quantization of a tensor
X, which may represent weights, activations, or gradients, into a low-precision tensor
is defined as
where
X denotes the full-precision input tensor,
is the corresponding generalized scaling factor, and
is the projection operator that maps a full-precision value to the nearest discrete value in the finite set of representable values of a target low-precision format
(e.g.,
), thereby inherently encompassing operations such as rounding (e.g., round-to-nearest). The resulting quantized tensor satisfies
and is encoded in the target low-precision format.
To reconstruct the approximate full-precision tensor
, the scaling factor is reapplied in dequantization as follows:
2.1. Defining the Scaling Factor per Precision
With the generalized projection framework established, the different low-precision paradigms can now be distinguished solely by the way the scaling factor is defined. Let denote the maximum representable absolute value of the target low-precision format.
2.1.1. 16-Bit Unscaled Formats (FP16, BF16)
For formats with sufficient native dynamic range—or that share the same exponent size E as FP32—no explicit scaling is required. In this case, the generalized equation reduces to a pure projection with .
2.1.2. FP8 Quantization (Per-Tensor Scaling)
FP8 formats (e.g., E4M3 and E5M2) commonly use a single scaling factor broadcast across the entire tensor, which represents a relatively coarse-grained per-tensor scaling strategy for mapping the tensor distribution safely into the dynamic range of the target format. Finer-grained alternatives also exist, such as block-level or microscaling-based approaches that assign separate scaling factors to groups of values; however, in our implementation through Transformer Engine on the laptop Blackwell GPU, FP8 was employed using the tensor-wise scaling formulation. FP8 tensors in the forward pass use the E4M3 format, whereas FP8 tensors in the backward pass use E5M2 because gradients require a greater dynamic range for stable training. The scaling factor is obtained using the widely adopted
absmax method [
18,
36], computed from the maximum absolute magnitude of the tensor:
where
denotes the maximum absolute value of the entire tensor
X, and
is the maximum representable value of the selected FP8 format.
2.1.3. FP4 Quantization (NVFP4)
For ultra-low-precision formats such as FP4, the tensor is partitioned into contiguous sub-blocks to preserve local activation outliers better and maintain structural fidelity. In this work, we adopt the NVFP4 format, following recent low-precision training studies in the LLM literature [
21], while noting that other FP4-style microscaling formats also exist and may differ in their block sizes and scaling strategies. Under this formulation, the scaling factor is defined as
where
is the scaling factor computed for the full tensor and stored in FP32, and
is the local block-level scaling factor for each block of 16 consecutive elements, and each
is stored in FP8 format to have better range [
20]. Both of these scaling factors are computed using the same absmax method defined earlier.
2.2. Mixed-Precision Strategy for FQT and PTQ
Following the conceptual overview provided in the Introduction, this section formalizes the common mixed-precision framework and the technical distinctions between FQT and PTQ, with particular emphasis on their training, calibration, and scaling procedures. Quantization does not require assigning a uniform precision to every layer and operation of a neural network. Instead, mixed-precision quantization assigns different bit-widths to different computations according to their sensitivity to precision reduction. This design balances the trade-off among model size, computational efficiency, and predictive performance by preserving higher precision in numerically sensitive components while applying lower precision where greater compression and acceleration can be achieved with minimal loss. In this study, both FQT and PTQ follow the same mixed-precision strategy. As a result, the comparison between the two paradigms isolates differences arising from when quantization is introduced and how the scaling statistics are obtained, rather than from differences in precision allocation across the network.
2.2.1. FQT
FQT integrates quantization directly into the training process. Both the forward and backward passes are performed predominantly in low-precision arithmetic, including weights, activations, and gradients, while higher precision is retained only where necessary to ensure numerical stability. Within the common mixed-precision framework adopted in this work, FQT is intended not only to improve training efficiency but also to reduce the accuracy degradation that can arise from applying quantization only after training. Because quantization effects are present throughout optimization, the model can adapt to quantization noise during learning, which often leads to better accuracy preservation, particularly at aggressive low precisions. In FQT, the ranges are tracked during training; consequently, at inference time, these training-time statistics are reused to compute the scaling factor , eliminating the need for a separate calibration dataset.
2.2.2. PTQ
PTQ, by contrast, is designed specifically for inference-time efficiency. Under the same mixed-precision strategy used for FQT, a pretrained full-precision model is converted to a lower precision after training, without any additional optimization, so that low-precision computation can be used during deployment. The process begins by determining the ranges of model parameters and activations. Whereas the parameter ranges are directly available from the pretrained model, the activation ranges must be estimated using a representative calibration dataset. The scaling factor is then computed from these ranges and the target numerical format, following the scaling formulations described above. PTQ is attractive because of its simplicity and low overhead, making it suitable when retraining is impractical or computational resources are limited. However, because the model does not adapt to quantization noise during learning, PTQ can incur greater performance degradation, especially in smaller models that are highly sensitive to precision loss.
4. Results and Analysis
This section first examines model compression under the common mixed-precision design to quantify how checkpoint size changes as the target numerical precision is reduced. We then evaluate predictive performance under mixed-precision fully quantized training to determine how far precision can be lowered in the compact transformer-based classifier without materially degrading hyperspectral foreign plastic object classification. Next, we compare fully quantized training and post-training quantization at matched target precisions in terms of classification accuracy. We then analyze the training dynamics and convergence stability of fully quantized training, followed by its training-time efficiency and batch-size scaling behavior on the Blackwell GPU platform. Finally, we compare the inference-time behavior of fully quantized training and post-training quantization on the same hardware. Unless otherwise stated, the main results correspond to the default configuration used for the headline experiments, whereas the scaling studies isolate the effect of batch size.
4.1. Model Compression and Serialized Footprint
Table 1 reports the on-disk serialized model size obtained at each target precision under the common mixed-precision strategy. Because FQT and PTQ apply the same precision allocation to the same subset of layers, the resulting stored model size is identical for both paradigms at a given target precision. Accordingly, model size is reported once per precision level as a deployment-oriented compression metric rather than separately for FQT and PTQ.
A clear monotonic reduction in model size is observed as the precision of the quantized components decreases. Relative to the FP32 reference checkpoint (1.36 MB), FP16 and BF16 reduce the model size to 0.79 MB, corresponding to a compression ratio of
. FP8 further reduces the checkpoint size to 0.51 MB (
compression), whereas NVFP4 produces the smallest artifact at 0.37 MB, corresponding to
compression. The identical sizes of FP16 and BF16 are expected because both use 16 bits for the quantized portion under the same mixed-precision assignment. Similarly, the progressive reduction from FP16/BF16 to FP8 and then to NVFP4 directly reflects the lower storage cost of the quantized weights in the transformer backbone. The table further shows that scale metadata contributes negligibly to the total model size. For FP8 and NVFP4, the scale overhead is less than 0.01 MB in both cases, indicating that the storage gains from lower-precision quantization are not meaningfully offset by the additional quantization parameters. At the same time, the retained FP32 portion remains fixed at 0.23 MB across all quantized variants, which establishes a lower bound on the total achievable model size under the adopted selective mixed-precision design. This behavior is consistent with the quantization strategy described in
Section 3.3, in which numerically sensitive components are preserved in FP32 while only the dominant transformer operations are quantized.
4.2. Accuracy Analysis of FQT and PTQ
4.2.1. Predictive Performance Under Mixed-Precision FQT
We first focus on the FQT rows in
Table 2 to isolate the effect of reduced precision during training. Overall, the results show that the proposed mixed-precision design remains robust across the full tested precision spectrum for the compact transformer-based classifier on this hyperspectral FPO classification task. Relative to the FP32 baseline (98.88% OA), all reduced-precision FQT configurations remain within 0.63 percentage points (pp), indicating that most of the predictive performance can be preserved even when the dominant GEMM-intensive components of the transformer are executed in lower precision.
Among the reduced-precision FQT modes, BF16 provides the closest match to FP32, achieving 98.60% OA, 98.98% AA, and 98.45% , corresponding to only a 0.28 pp reduction in OA. FP8 is the next strongest low-precision setting, with 98.53% OA, 98.97% AA, and 98.37% , representing a 0.35 pp drop relative to FP32. FP16 follows with 98.33% OA, corresponding to a 0.55 pp reduction, whereas NVFP4 yields the lowest accuracy among the FQT variants at 98.25% OA, a 0.63 pp decrease from the baseline. Importantly, however, even the most aggressive tested format does not produce a severe loss in predictive performance. The same overall ordering is preserved across AA and , indicating that the observed trend is consistent not only in aggregate accuracy but also in class-balanced performance and chance-corrected agreement.
The class-wise results in
Figure 2 further clarify how quantization affects predictive behavior under FQT. The FQT columns show that the impact of reduced precision is not uniform across classes, but instead is concentrated in a subset of materials. In particular, larger recall reductions are observed for classes such as HDPE, LDPE, and PET, whereas several other classes remain nearly unchanged across all tested precisions. At the same time, a few classes exhibit slight recall improvements relative to the FP32 baseline, most notably PS under BF16, FP8, and NVFP4, and fillet under FP16 and BF16. This heterogeneous pattern is consistent with the nature of hyperspectral classification, where discriminative information may be encoded in subtle reflectance differences across correlated spectral bands, making some classes more sensitive than others to quantization noise.
Several conclusions follow from these results. First, the transformer-based hyperspectral classifier is reasonably tolerant to low-precision training when numerically sensitive components are preserved in FP32 and quantization is applied selectively to the dominant transformer operations. Second, aggressive quantization does not lead to catastrophic failure on this task, even for NVFP4, although the ranking of formats suggests that preserving dynamic range and effective scaling remains important for maintaining fine-grained spatial–spectral discrimination. Third, the fact that FP8 slightly outperforms FP16 in this setting is noteworthy. A plausible explanation is that the tensor-level scaling used for FP8 may better adapt numerical ranges to the underlying activation distributions than FP16, which, in our setup, primarily relies on conventional mixed-precision execution with loss scaling. Although this interpretation is consistent with the observed behavior, it should be viewed as a task- and implementation-specific explanation rather than a universal ordering between FP16 and FP8.
4.2.2. Comparative Accuracy Analysis of FQT and PTQ
Having established the feasibility of low-precision FQT, we next compare FQT and PTQ at matched target precisions using
Table 2. A clear and consistent pattern emerges: FQT outperforms PTQ at every tested reduced precision. At BF16, FQT improves OA over PTQ by 0.52 pp (98.60% versus 98.08%). The corresponding OA gains are 0.31 pp for FP16 (98.33% versus 98.02%), 0.44 pp for FP8 (98.53% versus 98.09%), and 0.33 pp for NVFP4 (98.25% versus 97.91%). The same ordering is preserved for AA and
, indicating that the advantage of FQT is consistent across overall accuracy, class-balanced performance, and chance-corrected agreement.
The class-wise recall differences in
Figure 2 provide additional insight into how the two quantization flows differ. Across the tested precisions, the FQT columns show that deviations from the FP32 baseline are distributed across a small subset of classes, most notably HDPE, LDPE, PET, and, in some cases, PS. By contrast, the PTQ columns indicate that the degradation is more concentrated, with LDPE showing the most pronounced and persistent recall drop across precisions. This class-specific pattern suggests that training-time exposure to quantization noise enables FQT to distribute the impact of reduced precision more smoothly across the learned representation, whereas PTQ is more vulnerable to sharper degradation in particularly sensitive classes.
Although both flows remain highly accurate in absolute terms, the gap between FQT and PTQ is practically meaningful. All PTQ variants remain within 0.97 pp OA of the FP32 baseline, confirming that PTQ is still a strong and viable low-overhead deployment strategy for this task. However, the uniformly better results of FQT indicate that calibration alone is less effective than training-time adaptation for absorbing low-precision noise in this hyperspectral setting. This observation is especially relevant for compact domain-specific models trained from scratch on high-dimensional spectral data, where the learned representation may be less redundant and therefore more sensitive to quantization perturbations than that of very large pretrained models.
From a deployment perspective, the matched-precision comparison supports a clear interpretation. When retraining is feasible and preserving accuracy is important, FQT is preferable to PTQ, particularly at more aggressive precisions such as FP8 and NVFP4. When retraining is impractical, PTQ remains a practical fallback because it preserves strong absolute accuracy while requiring only a calibration stage. Nonetheless, this convenience comes with a consistent accuracy penalty relative to FQT and a stronger dependence on the quality and representativeness of the calibration data.
4.2.3. Convergence Behavior and Training Stability Under FQT
The convergence statistics in
Table 3, together with the trajectories in
Figure 3a, show that reduced precision does not destabilize optimization under the mixed-precision formulation. On the contrary, all reduced-precision modes reach 90% of their own peak validation OA in fewer epochs than FP32. FP8 converges fastest to both 90% and 95% of its own peak validation OA, requiring only 12 and 33 epochs, respectively, compared with 20 and 43 epochs for FP32. BF16 shows similarly rapid convergence, reaching the same thresholds in 14 and 34 epochs. At the stricter 99% threshold, FP16 converges fastest at 75 epochs, followed by FP8 at 87 and NVFP4 at 96, all substantially ahead of FP32 at 141 epochs.
These convergence results should be interpreted carefully. Because the thresholds are defined relative to each format’s own peak validation OA, faster convergence does not imply that lower precision reaches a better optimum than FP32. Rather, it indicates that the reduced-precision models attain a high fraction of their eventual validation performance in fewer training epochs. In this task, such behavior suggests that low-precision training can learn useful spatial–spectral discriminative structure efficiently, even if the final optimum remains slightly below that of the full-precision baseline. One plausible interpretation is that quantization noise acts as a mild implicit regularizer, accelerating coarse optimization while slightly constraining the final attainable optimum at more aggressive precisions.
Figure 3b provides the complementary loss-level view and further supports the numerical stability of the training process. All precision modes exhibit a consistent downward loss trajectory without major divergence or irregular behavior. The inset over epochs 1–20 shows that FP8 and NVFP4 have somewhat higher and slightly noisier early-stage losses than FP32, FP16, and BF16, but this additional variability does not prevent stable optimization or high final accuracy. By later epochs, all modes settle into similar low-loss regimes, although NVFP4 remains modestly higher than the others, which is consistent with its slightly lower final test accuracy. Taken together, these results indicate that the given mixed-precision training strategy remains numerically stable across all evaluated floating-point precisions while enabling convergence rates that are competitive with, and in some cases faster than, FP32.
4.3. Training-Time Efficiency Under FQT
4.3.1. Training-Time Efficiency at the Default Batch Size
Table 4 summarizes training-time efficiency under FQT at the default batch size of 512. The results show that reduced precision yields clear memory savings, but these savings do not translate uniformly into higher end-to-end training throughput for this compact hyperspectral transformer. Relative to FP32, FP16 and BF16 reduce peak memory from 306.6 MB to 272.3 MB, corresponding to a
reduction, while maintaining essentially the same throughput: 23,397 and 23,618 samples/s, respectively, versus 23,320 samples/s for FP32. Their total training time remains unchanged at 0.09 h, and both slightly reduce total energy consumption, with FP16 yielding the lowest energy usage among the 16/32-bit modes at 2.18 Wh.
FP8 and NVFP4 provide larger memory reductions, lowering peak memory to 247.1 MB and 237.3 MB, respectively, equivalent to and reductions relative to FP32. However, these gains are accompanied by substantially lower throughput at the default workload. FP8 reaches 14,804 samples/s, corresponding to a speedup relative to FP32, while NVFP4 reaches 12,779 samples/s, or relative throughput. Their longer training times, 0.15 h for FP8 and 0.16 h for NVFP4, also increase total energy consumption to 3.03 Wh and 2.86 Wh, respectively. Thus, at the default batch size, ultra-low precision improves memory efficiency but does not improve training throughput or energy efficiency.
This behavior is consistent with the workload characteristics of the model and the adopted mixed-precision design. Because only selected modules are quantized and the network itself is relatively compact, the arithmetic intensity of the low-precision GEMMs is likely insufficient to amortize the additional overhead associated with dynamic scaling, quantization, dequantization, and format conversion. In other words, the memory benefit of FP8 and NVFP4 appears immediately, whereas the throughput benefit requires a larger effective workload so that the low-precision tensor-core kernels can dominate execution more fully. This differs from the regime encountered in very large transformer models, where GEMMs are sufficiently large for low-precision hardware acceleration to provide more consistent end-to-end gains.
4.3.2. Training Batch-Size Scaling
The batch-size sweep in
Figure 4 clarifies when low-precision hardware support begins to provide a practical throughput advantage during training. As shown in
Figure 4a, FP32, FP16, and BF16 remain competitive or superior at small and moderate batch sizes. Up to batch size 2048, the best throughput is still achieved by FP16 or BF16, with BF16 reaching 30,017 samples/s at batch size 2048, while FP8 remains slightly lower at 29,061 samples/s and NVFP4 at 25,949 samples/s. At batch size 512, which is the default setting used in the main experiments, BF16 again provides the highest throughput, followed closely by FP16 and FP32, whereas FP8 and NVFP4 remain substantially slower.
A clear crossover emerges only at larger batch sizes. At batch size 4096, FP8 becomes the fastest configuration at 31,664 samples/s, exceeding FP32 at 27,931 samples/s and also surpassing FP16 and BF16. This advantage persists at batch size 8192, where FP8 again leads at 31,764 samples/s. At the largest tested batch size of 16,384, NVFP4 becomes the fastest configuration at 32,520 samples/s, slightly ahead of FP8 at 31,321 samples/s. These results indicate that the throughput advantage of native FP8/FP4 tensor-core execution is strongly workload-dependent and becomes visible only once the GEMM dimensions are large enough for the specialized hardware to offset the overhead of low-precision scaling and runtime quantization.
The key question, however, is whether these throughput gains during training are obtained without compromising predictive performance.
Figure 4b shows that they are not. As batch size increases beyond the moderate regime, test OA declines for all precisions, with the degradation becoming more pronounced for the more aggressive low-precision formats. At batch size 4096, FP32 still retains 98.02% OA, whereas FP8 falls to 96.55% and NVFP4 to 95.65%. At batch size 8192, all precisions degrade further, and by batch size 16,384, the drop becomes substantial across the board, with NVFP4 reaching 87.61% OA. Thus, the throughput advantage of FP8 and NVFP4 emerges primarily in a regime where optimization quality has already begun to deteriorate, especially for the lower-precision modes.
Taken together, these results suggest that the most practically useful operating region for this model or any small model is not the absolute maximum-throughput point, but rather the intermediate batch-size regime that balances computational efficiency and predictive accuracy. More broadly, the findings reinforce an important systems-level conclusion: native FP8 and FP4 hardware support does not guarantee end-to-end training acceleration for compact, domain-specific transformers. Instead, the benefit appears only after sufficient workload scaling, and even then it must be weighed against the accompanying reduction in predictive performance.
4.4. Inference-Time Efficiency Under FQT and PTQ
4.4.1. Inference Batch-Size Scaling
We next examine inference-time efficiency for the quantized models obtained from the two quantization flows. Because FQT and PTQ use the same mixed-precision assignment, quantize the same subset of operations, and target the same numerical formats, their inference behavior should in principle be very similar at a matched precision. Accordingly, the main factors governing inference efficiency are not when the model is quantized, but rather the target numerical format and, most importantly, the batch size used at deployment.
Figure 5 shows that batch size is the dominant driver of inference efficiency across all precisions and both flows. In
Figure 5a, latency per sample decreases sharply as batch size increases, especially from
to approximately
–
, after which the gains begin to taper.
Figure 5b shows the complementary throughput view: at small batch sizes, FP32 and the 16-bit modes remain competitive or superior, whereas the lower-precision FP8 and NVFP4 modes lag behind. This behavior mirrors the training-time results at small workloads and indicates that, for compact models, the overhead associated with scaling, format conversion, and runtime quantization can dominate when the effective GEMM workload is too small to fully utilize the low-precision tensor-core path.
At larger batch sizes, however, the trend reverses. As the batch size increases, FP8 and especially NVFP4 achieve higher throughput than FP32 and the 16-bit modes in both FQT and PTQ. This crossover is consistent with the increasing arithmetic intensity of batched inference: once the workload becomes sufficiently large, the specialized low-precision hardware is better able to amortize its overhead and deliver higher effective throughput. Importantly, unlike the training setting, increasing the inference batch size does not introduce an optimization-related accuracy penalty, because the model parameters are fixed and no learning occurs during deployment. Consequently, the throughput gains from larger inference batches can be harvested without the accuracy degradation that accompanied large-batch training, although they still come with the usual system-level trade-off of higher batch latency and reduced responsiveness for individual requests.
The energy-per-sample curves in
Figure 5c reinforce the same conclusion. Across all flows and precisions, energy per sample decreases by orders of magnitude as batch size increases, indicating that batching improves not only throughput but also energy efficiency. By the largest batch sizes, the curves begin to converge, suggesting that batching has a stronger effect on deployment energy efficiency than precision alone. In this regime, lower-precision formats still provide a modest additional advantage, but their main runtime benefit appears only once batch sizes are large enough for the workload to become hardware-efficient.
4.4.2. Peak Throughput and Deployment Implications
Table 5 summarizes the peak inference throughput achieved by each configuration. Two observations stand out. First, the differences between FQT- and PTQ-derived models at the same precision are very small, which is consistent with the expectation that their inference behavior should be nearly identical under a shared mixed-precision deployment policy. For example, peak throughput differs only marginally between FQT–FP8 and PTQ–FP8 (311,555 vs. 314,524 samples/s) and between FQT–NVFP4 and PTQ–NVFP4 (331,545 vs. 334,165 samples/s). These small gaps are better interpreted as implementation- and measurement-level variation than as a fundamental difference between the two quantization flows at inference time.
Second, the highest peak throughput is achieved not by the 16-bit modes, but by the more aggressive low-precision formats at the largest tested batch size. Relative to the FP32 reference peak of 247,999.6 samples/s, FQT–FP16 and FQT–BF16 provide only modest gains of and , while PTQ–FP16 and PTQ–BF16 reach . By contrast, FP8 reaches approximately – the FP32 peak, and NVFP4 attains the highest overall throughput, achieving – speedup over FP32. Notably, all configurations reach their peak throughput at the largest tested batch size, , further emphasizing that the hardware advantage of FP8 and NVFP4 emerges only in the high-workload regime.
Taken together, these results suggest a more nuanced inference story than the training results. At small deployment batch sizes, lower precision does not automatically yield better inference performance, because overheads dominate for this compact transformer-based hyperspectral model. At large batch sizes, however, FP8 and especially NVFP4 do provide the highest throughput and lowest energy per sample. Since inference batching does not alter model accuracy in the way that large-batch training can, these gains are practically attainable whenever the deployment scenario can tolerate large batched execution. Therefore, if the primary objective is maximum serving throughput in a throughput-oriented deployment setting, FP8 and NVFP4 are the most attractive inference formats on this hardware. If instead the deployment is latency-sensitive and operates at small batch sizes, the practical advantage of aggressive low precision becomes much less pronounced, and FP32 or 16-bit execution may remain competitive despite their higher nominal precision.
4.5. Ablation of the Mixed-Precision Module Selection Strategy
To justify the selective mixed-precision design adopted throughout this work, we perform an ablation study at the most aggressive training precision, NVFP4, by comparing two configurations:
full quantization, in which all modules are quantized to NVFP4, and
our mixed-precision design, in which the initial Conv1 × 1 layer, RoPE, Softmax, and the final MLP classifier head are retained in FP32.
Table 6 shows that this design choice is essential for preserving predictive performance.
When all layers are quantized to NVFP4, performance degrades sharply to 84.31% OA, 85.26% AA, and 83.95% . By contrast, the proposed mixed-precision design restores performance to 98.25% OA, 98.78% AA, and 98.06% , bringing the model within only 0.63 pp of the FP32 baseline in OA. This corresponds to an absolute improvement of 13.94 pp in OA over the full-quantization variant, with similarly large gains in AA and . The magnitude of this gap shows that the strong results reported earlier for NVFP4 do not arise from the numerical format alone, but from the combination of low-precision execution in the dominant transformer computations and full-precision retention in numerically sensitive modules.
These findings suggest that the excluded modules are substantially more sensitive to aggressive quantization than the quantized GEMM-dominated layers. The initial Conv1 × 1 projection operates directly on the raw spectral input and therefore likely requires greater numerical fidelity to preserve fine-grained spectral structure before tokenization. The RoPE module encodes relative positional information, where quantization error can distort the spatial relationships needed for local spatial–spectral reasoning. The Softmax operation is also known to be numerically delicate because small perturbations in its inputs can produce amplified changes in the normalized attention distribution. Finally, the classifier head directly maps the learned representation to decision boundaries, making it particularly sensitive to precision loss when classes are separated by subtle spectral differences.
More broadly, this ablation supports the central premise of the proposed mixed-precision strategy: not all modules contribute equally to the numerical robustness of the model. Aggressively quantizing the dominant transformer operations can preserve most of the efficiency benefits of low precision, but only when a small set of sensitive components is protected in FP32. In this compact hyperspectral transformer, selective precision assignment is therefore not merely a refinement for improving accuracy, but a necessary condition for making NVFP4 training viable.
4.6. Overall Interpretation and Practical Guidelines
Taken together, the results show that reduced-precision floating-point computation is a viable strategy for compact transformer-based hyperspectral foreign plastic object classification, but its benefits are strongly metric- and workload-dependent. In terms of predictive performance, the mixed-precision FQT design remains highly robust across all tested precisions, with all FQT variants staying within 0.63 percentage points of the FP32 baseline, while consistently outperforming PTQ at matched precisions. BF16 provides the closest accuracy to FP32 mainly because both have the same number of exponent bits, resulting in the same dynamic range, whereas FP8 offers a particularly favorable compromise between accuracy preservation and reduced precision. FP16, on the other hand, despite having a broader dynamic range, still resulted in degraded accuracy compared to FP8 due to using loss scaling as a replacement for a dedicated scaling factor. At the same time, the model-compression results confirm a clear monotonic storage benefit as precision decreases, culminating in checkpoint compression under NVFP4. These findings indicate that, for this task, aggressive quantization is feasible when numerically sensitive modules are protected, and quantization is applied selectively rather than uniformly.
The efficiency results reveal a more nuanced systems-level picture. During training, lower precision does not automatically translate into higher throughput for a compact hyperspectral transformer. At the default operating point, FP16 and BF16 provide modest memory savings while preserving FP32-level throughput, whereas FP8 and NVFP4 reduce memory further but incur lower throughput and higher training energy because the workload is too small to fully amortize quantization overhead. Only at sufficiently large batch sizes do FP8 and NVFP4 expose the throughput advantage of native low-precision tensor-core execution, but this is not feasible for training because training batch size is a hyperparameter and increasing the batch size in deep learning models to increase the workload for tensor cores results in accuracy degradation. Inference differs in one important respect: because no optimization is involved, larger batch sizes can be exploited without affecting predictive accuracy. Accordingly, FP8 and especially NVFP4 become the fastest inference formats in throughput-oriented large-batch deployment, while FP32 and 16-bit execution remain competitive at small, latency-sensitive batch sizes. Since FQT- and PTQ-derived models use the same mixed-precision deployment policy, their inference behavior is correspondingly very similar at matched precisions.
These findings can also be viewed in the context of the emerging FQT literature. Recent studies on large transformer and language models have demonstrated that FP8 and FP4 training can preserve higher-precision performance when appropriate scaling and mixed-precision strategies are employed [
17,
21]. Our results show a similar requirement for numerical care in a substantially smaller and domain-specific HSI transformer, particularly at FP8 and NVFP4. However, unlike the large-model workloads considered in most prior FQT studies, the compact GEMM dimensions of the present model do not consistently saturate low-precision hardware at moderate batch sizes. This explains why reduced numerical precision produces clear storage and accuracy trade-offs but does not automatically translate into higher training throughput. To the best of our knowledge, comparable FQT studies across FP16, BF16, FP8, and FP4 have not previously been reported for transformer-based HSI classification, limiting direct quantitative comparison within the HSI literature.
A final and critical conclusion comes from the ablation study. The strong NVFP4 results are not obtained by simply quantizing the entire network, but by combining low-precision execution in the dominant transformer computations with full-precision retention in a small set of sensitive modules. Quantizing all modules to NVFP4 causes a severe performance collapse, whereas the proposed selective mixed-precision design restores performance to near-FP32 levels. This confirms that the initial spectral projection, RoPE, Softmax, and classifier head are disproportionately sensitive to aggressive quantization and should be preserved at higher precision.
From a practical deployment perspective, the guidelines are therefore as follows. If the primary goal is maximum accuracy under reduced precision, BF16-FQT is the most conservative choice, with FP8-FQT offering a strong alternative when slightly more aggressive compression is desired. If retraining is feasible, FQT is preferable to PTQ because it consistently delivers better accuracy at matched precision. If retraining is not feasible, PTQ remains a practical fallback, particularly at FP16 or BF16, provided that a high-quality representative calibration set is available. If the primary goal is maximum compression, NVFP4 is the most effective format, but only under a selective mixed-precision design. If the primary goal is maximum inference throughput, FP8 and NVFP4 are attractive only in large-batch serving scenarios; for smaller or latency-sensitive deployments, 16-bit modes may offer a more favorable practical trade-off. Overall, the results suggest that for compact, domain-specific hyperspectral transformers, low precision should be viewed not as a universally beneficial replacement for FP32, but as a workload-aware design choice whose success depends on selective module assignment, scaling strategy, and the intended deployment scenarios.
4.7. Limitations
Several limitations of this study should be acknowledged. First, all training hyperparameters were tuned only on the FP32 baseline and then kept fixed across all reduced-precision experiments. This choice was made intentionally to ensure a fair comparison in which performance differences can be attributed to quantization behavior rather than to precision-specific optimization. However, it also means that the reported results may not reflect the best achievable performance for each lower-precision format individually. In particular, some reduced-precision modes might benefit from different learning rates, loss-scaling policies, regularization strengths, or stopping criteria.
Second, the empirical findings are based on a single established state-of-the-art transformer-based model and a single in-house hyperspectral food-safety dataset for poultry FPO classification in the 1000–1700 nm spectral range. Although this controlled design is useful for isolating the effects of numerical precision and quantization strategy, the observed robustness to reduced precision should not be assumed to generalize directly to other transformer architectures, HSI datasets, spectral ranges, sensors, or downstream tasks. Different materials, class structures, spectral characteristics, noise levels, spatial contexts, and environmental conditions may produce different activation distributions and dynamic-range requirements, thereby altering sensitivity to low-precision computation. Future work should therefore evaluate the proposed quantization framework across additional HSI architectures, datasets, spectral ranges, and application domains to establish the broader generalizability of these findings. In addition, the present evaluation uses a labeled pixel-level partition rather than an image-disjoint partition. Consequently, spatially neighboring samples from the same hyperspectral image may occur in different subsets, and their extracted spatial contexts may partially overlap. The reported results therefore characterize a controlled comparison of quantization strategies under a common pixel-level sampling protocol rather than generalization to completely unseen hyperspectral images or material sources. Future work should additionally consider image- and source-disjoint evaluation to assess cross-image and cross-source generalization.
Third, for FP8 and FP4, we adopted specific scaling mechanisms motivated by their strong performance in the LLM literature, namely, tensor-level scaling for FP8 and the NVFP4 tensor-plus-block scaling formulation for FP4. These choices provide a reasonable and practically relevant starting point, but they are not exhaustive. Other scaling mechanisms, including finer-grained or alternative microscaling variants, may behave differently and could prove more suitable for smaller hyperspectral transformer models such as the one studied here.
Fourth, our analysis of workload scaling focused primarily on increasing batch size while keeping the internal tensor dimensions of the selected model unchanged. This was appropriate for isolating the effect of workload on the same backbone under a fair comparison setting. Nevertheless, batch size is only one way to alter the effective GEMM workload. An alternative and complementary approach would be to study a family of models with different widths, depths, or embedding dimensions while holding the batch size fixed. Such experiments could offer further insight into when native FP8 and FP4 hardware support begins to provide consistent end-to-end benefits for hyperspectral transformers.
The reported training and inference efficiency measurements are also specific to the NVIDIA GeForce RTX 5080 Laptop GPU and the associated Blackwell-optimized Transformer Engine software stack used in this study. In particular, the complete precision comparison including native NVFP4 execution requires Blackwell-class hardware support. Therefore, absolute latency, throughput, memory-scaling behavior, and batch-size crossover points should not be interpreted as hardware-independent quantities. These characteristics may vary across GPU architectures, depending on their low-precision tensor core support, memory subsystem, kernel implementations, and software stack. The reported measurements should therefore be interpreted as hardware-specific evidence of the relative scaling behavior observed on the evaluated Blackwell platform, while broader hardware generalization will require evaluation across additional accelerator architectures.
An additional practical limitation concerns FPO visibility and occlusion. This study and its dataset were designed for pixel-level classification of surface-exposed FPOs, with the prepared pieces positioned directly on the fillet surface and visible to the hyperspectral imaging system. Consequently, the reported results do not characterize performance for partially embedded or completely hidden contaminants. Partial occlusion can still be detectable; however, it reduces the number of directly observed FPO pixels and may introduce mixed spectral contributions from both the FPO and surrounding poultry tissue. Complete coverage by tissue may require a mechanical device or robot arm capable of flipping the fillet to inspect both sides, which would necessitate an additional camera downstream before a product rejector or FPO-removal device is used. Future work should therefore investigate controlled levels of partial occlusion, as well as fillet manipulation strategies, to establish the practical detection and classification limits of the proposed framework under more challenging processing conditions.