Lowering LLM API Costs with FP8 and INT4 Mixed Quantization on Domestic AI Accelerators

    This article explains why inference cost often matters more than training cost for production LLMs, how mixed FP8 and INT4 quantization can keep quality nearly unchanged while cutting memory and bandwidth, and how model–chip co-design, graph optimization, and serving techniques turn those gains into lower API cost. It also outlines a practical rollout path for evaluation, limited traffic comparison, capacity planning, and ongoing quality monitoring.

    1. Why inference cost is the key variable in LLM adoption

    Large language models have improved quickly, but for enterprise deployment the ongoing cost of inference often matters more than the one-time cost of training. Inference is a recurring expense: the more calls an application makes, and the denser the usage, the harder the cost pressure becomes. In high-frequency settings such as coding assistants, enterprise knowledge Q&A, and customer-service dialogue, API spend can decide whether a product can scale.

    In practice, teams usually judge an inference setup on three dimensions:

    • Cost per call: price per million tokens
    • Inference performance: time to first token, generation speed, and concurrent throughput
    • Output quality: whether quantization or compression causes a clear drop in accuracy

    Conventional choices rarely deliver all three. Pushing cost down can hurt accuracy, while chasing performance often depends on expensive imported hardware. The engineering question is how quantization and hardware co-design can cut inference cost sharply without a meaningful loss of quality.

    2. Mixed quantization: why combine FP8 and INT4

    2.1 What quantization does

    Quantization replaces high-precision floating-point values with lower-bit representations. That reduces memory use, eases bandwidth pressure, and raises compute throughput. Common formats include FP16, FP8, INT8, and INT4. Fewer bits mean larger theoretical gains, but also higher accuracy risk.

    2.2 A mixed FP8 and INT4 strategy

    INT4 alone compresses the most, but it can hurt layers that are sensitive to rounding. FP8 alone is more stable, but the compression is less aggressive. Mixed quantization assigns precision by layer and by tensor sensitivity:

    • Sensitive layers—for example, parts of attention and normalization-related parameters—stay in FP8 to preserve numerical stability.
    • Less sensitive layers—for example, some feed-forward weights—use INT4 to maximize compression.

    Keeping precision where the model is fragile, and compressing where it is not, can approach the cost of a pure INT4 deployment while quality stays close to the full-precision model. Sensitivity is usually judged on a calibration set: each layer is quantized in simulation, and the shift in its outputs is measured with metrics such as KL divergence or cosine similarity. Those scores become the mixed-precision configuration.

    A typical offline flow is:

    1. 1. Prepare a calibration set that covers real text from the target workload
    2. 2. Simulate FP8 and INT4 quantization layer by layer and compute error metrics
    3. 3. Build a per-layer precision config from error thresholds
    4. 4. Quantize the model and export the deployment format
    5. 5. Check perplexity, downstream-task accuracy, and generation quality on an evaluation set

    2.3 What “unchanged quality” actually means

    It does not mean every token matches the full-precision model. It means that, on standard benchmarks and on business evaluation sets, the gap in the metrics that matter stays within a negligible range. Engineering checks usually include:

    • Whether perplexity (PPL) shifts only at the level of thousandths
    • Whether pass rates hold steady on downstream tasks such as code generation, math reasoning, and instruction following
    • Whether long-form generation shows clear repetition, collapse, or broken logic
    • Whether human scores in a business A/B comparison show no meaningful difference

    Only after that multi-sided check is a mixed-quantization setup reasonably described as quality-neutral.

    3. Model and chip together: deploying on domestic AI accelerators

    Quantization is only the first step. Running efficiently on a specific AI accelerator still requires a full software–hardware fit. A model–chip integrated design is not a simple port. It is end-to-end tuning around the hardware’s strengths.

    3.1 Operator support and graph optimization

    AI accelerators differ from mainstream GPUs in operator libraries and instruction sets. Mixed quantization adds FP8 matrix multiplies and INT4 dequantization operators that must be implemented or adapted. Typical work includes:

    • Writing or customizing fused FP8/INT4 operators for the chip’s matrix units
    • Fusing the compute graph to cut scheduling overhead and memory round trips
    • Using compiler techniques—operator fusion, memory reuse, and pipeline scheduling—to raise end-to-end throughput

    3.2 Memory and bandwidth

    For models from tens of billions to hundreds of billions of parameters, weight memory scales roughly with bit width. Relative to FP16, FP8 is theoretically half the size and INT4 is one quarter. Under a mixed scheme, overall model memory can fall to about 30%–50% of the FP16 footprint. That has three effects:

    • A larger model can fit on one card, which reduces communication from multi-card splits
    • More concurrent instances can share a card, which raises cluster utilization
    • KV cache shrinks, which improves concurrency for long-context workloads

    3.3 Serving-layer optimizations

    Cost also depends on the serving stack, not only the weights:

    • Continuous batching packs requests dynamically so accelerators stay busy
    • Prefix caching reuses computation for system prompts and shared prefixes in multi-turn chats
    • Speculative decoding, where the hardware supports it, lets a small model draft tokens that a larger model verifies

    Stacked on quantization, these techniques form a complete low-cost inference path.

    4. What “about one-seventh” of the API price means

    An API price around one-seventh of comparable models in the market is the result of several optimizations together:

    1. Lower memory cost. Mixed quantization lets one card hold a larger effective model, so hardware cost per token falls.
    2. Hardware acquisition and operations. At large scale, domestically produced AI chips can be competitive on total cost of ownership.
    3. Higher throughput. Lower-bit math is kinder to bandwidth, so more requests can be served in the same time.
    4. A tighter stack. Deep tuning of the model and the chip avoids some of the loss that comes from a generic adaptation layer.

    For buyers, that cost structure can make previously budget-limited uses practical—for example, giving coding assistance to an entire developer population, or summarizing large document sets in near real time.

    5. A practical rollout path

    Teams considering mixed quantization on domestic AI accelerators can proceed in four steps.

    Step 1: Fix the scenario and the baseline. Establish business quality with the full-precision model and define an acceptable quality band.

    Step 2: Compare on a small slice of traffic. Send about 5%–10% of real traffic to the quantized model and watch long-tail cases and edge inputs.

    Step 3: Load-test and plan capacity. Measure time to first token and throughput at the target concurrency, then size accelerator count and scale-out policy.

    Step 4: Monitor continuously. Track generation quality, latency percentiles, and error rates, and alert when a shift in traffic mix starts to drift quality.

    6. Conclusion

    Cheaper LLM inference is not a single trick. It is a system of mixed quantization, domestic AI accelerators, and engineering work on compilation, scheduling, and caching. Assigning FP8 to sensitive layers and INT4 to less sensitive ones, then adapting the model deeply to the chip, can push inference cost to a small fraction of the original level without a meaningful quality loss. For teams deciding whether to scale LLMs, that combination is a workable path across cost, performance, and control of the stack.