Deploying LLMs on Domestic NPU Inference Cards: Compatibility, Quantization, and Performance Testing

    This article presents a practical deployment and benchmarking study of large language models on an ARM-based server equipped with four NPU inference cards and nearly 200 GB of aggregate NPU memory. It compares open-source NPU-adapted inference frameworks with a vendor inference serving framework, highlights MoE long-context and MTP speculative decoding compatibility issues, recommends W8A8 quantization and model sizing rules, reports throughput for 35B-A3B and 122B-A10B MoE models plus a 27B dense model under TP=4, and provides container deployment guidance and future optimization directions.

    Deploying LLMs on Domestic NPU Inference Cards: Compatibility, Quantization, and Performance Testing

    1. Background and Test Environment

    With the rapid growth of LLM inference demand, many teams face a practical question: how to run large models at relatively low cost on existing domestic inference hardware. This practice is based on a typical domestically developed inference environment: an open-source ARM server operating system, a 64-core general-purpose ARMv8 server CPU, and four inference NPU chips as accelerators. Each chip provides a large amount of NPU memory, and the whole system offers close to 200 GB of aggregate NPU memory.

    These inference cards are an earlier-generation product. Their compute specifications are clearly below those of newer training/inference integrated chips, but their memory capacity is relatively substantial, and they have a large installed base and low acquisition cost. If model quantization and inference framework optimization can let small and medium-sized LLMs run stably on them, existing assets can be put to significantly better use, providing a cost-effective option for on-premises deployment, edge inference, and similar scenarios.

    For the inference engine, this test mainly compared two common technical routes:

    • An NPU-adapted version based on an open-source inference framework: this route has an open ecosystem and broad model coverage, and usually adapts to newly released model architectures faster, making it suitable for rapid validation.
    • A vendor-developed inference serving framework: this route often has deeper hardware co-optimization in operator fusion, memory management, and continuous batching, with a higher theoretical performance ceiling, but support for new models tends to lag by version.

    2. Inference Engine Selection: Compatibility First, Performance Second

    A practical conclusion first: for adaptation pace, the NPU-adapted branch of the open-source framework is clearly faster than the vendor inference framework. In this test, new-generation MoE architecture models, including sparse models with 3B–10B active parameters, could not yet be loaded on the vendor inference framework. In the adapted open-source framework, however, deployment could be completed by using an image with a new-feature pre-validation tag.

    Two types of compatibility issues require particular attention:

    1. Long-context stability of MoE models: On the open-source adapted framework, some MoE models produced abnormal output or even service crashes after the dialogue context exceeded 4K tokens. Preliminary analysis suggests this is related to the memory layout or precision handling of expert-routing-related operators under long sequences. In practice, it is advisable to limit the maximum context length to 4K–8K first and relax the limit after a framework version fixes the issue.
    2. Incomplete MTP (multi-token prediction) speculative decoding support: Although some images include MTP weights in the model directory, the inference path has not actually enabled speculative decoding, and turning on related parameters may instead cause errors. During testing, whether speculative decoding is effective should be judged by actual throughput improvement, not only by startup parameters.

    Dense architecture models have much better compatibility and can basically run stably on both frameworks. Therefore, for production environments with high requirements for context length and stability, choosing a quantized Dense architecture model is currently the safer option.

    3. Model and Quantization Strategy

    On inference cards with limited memory, W8A8 quantization—8-bit weights and 8-bit activations—is almost mandatory. This test covered three typical model scales:

    Model Type Total Parameters Active Parameters Quantization Parallelism
    MoE Model A ~122B ~10B W8A8 TP=4
    MoE Model B ~35B ~3B W8A8 TP=4
    Dense Model C ~27B 27B W8A8 TP=4

    The following principles are recommended for quantized model selection:

    • Derive model size from the memory budget: Under W8A8, each 1B parameters occupies about 1 GB of NPU memory. Add KV cache overhead, which is proportional to context length and concurrency, and reserve at least 20% memory headroom. The memory utilization parameter is recommended to be set between 0.85 and 0.92.
    • For MoE, prefer models with fewer active parameters: The compute bottleneck of the inference card is mainly in the decoding stage. The smaller the active parameter count, the lower the per-token computation, and the better the throughput.
    • Use all chips for cross-card parallelism: Four-card tensor parallelism (TP=4) is the standard configuration. Pay attention to the impact of chip interconnect bandwidth on communication overhead, and avoid excessive partitioning that leads to an excessively high communication share.

    4. Measured Performance

    The following data was measured with single-request and four-concurrent-request scenarios, an input length of about 1K tokens, and an output length of about 512 tokens. It is for reference only; actual performance should be tested in your own environment.

    • 35B-A3B MoE model (W8A8, TP=4): single-request decoding speed was about 35–37 tokens/s, and four-concurrent aggregate throughput was about 80 tokens/s. This was the best-performing combination in the test; the decoding advantage brought by the small active parameter count was very clear.
    • 122B-A10B MoE model (W8A8, TP=4): single request was about 18–20 tokens/s, and four-concurrent aggregate throughput was about 60 tokens/s. The throughput efficiency of the larger model under concurrency was actually decent, indicating that MoE sparse activation amortizes weight-loading overhead in continuous batching.
    • 27B Dense model (W8A8, TP=4): single request was about 14–15 tokens/s, and four-concurrent aggregate throughput was about 50 tokens/s. Every token in a Dense model passes through the full parameter set, so the speed is clearly lower than that of MoE models with small active parameter counts.

    These data reveal an important pattern: on inference cards, decoding speed is mainly determined by the number of active parameters rather than total parameters. Although the 35B-A3B model has more total parameters, it is more than twice as fast as the 27B Dense model. Therefore, when selecting models, prioritize MoE architectures with “large total parameters and small active parameters.”

    5. Containerized Deployment Practice

    Containerized deployment can effectively isolate dependencies and fix environment versions. The following is a generic deployment template, with specific vendor image identifiers removed. Replace the inference framework image and device nodes with the corresponding ones in actual use:

    1. docker run -itd \
    2. --net=host \
    3. --shm-size=40g \
    4. --privileged \
    5. --name llm-inference \
    6. --device=/dev/npu0 --device=/dev/npu1 \
    7. --device=/dev/npu2 --device=/dev/npu3 \
    8. -v /usr/local/npu/driver/lib64/:/usr/local/npu/driver/lib64/ \
    9. -v /home/models:/home/models \
    10. -v /root/.cache:/root/.cache \
    11. -e NPU_ALLOC_CONF=expandable_segments:True \
    12. inference-framework:latest \
    13. serve /home/models/model-w8a8 \
    14. --host 0.0.0.0 \
    15. --port 8000 \
    16. -tp 4 \
    17. --served-model-name my-model \
    18. --trust-remote-code \
    19. --max_num_seqs 4 \
    20. --max-model-len 8192 \
    21. --memory_utilization 0.90

    Key configuration notes:

    • Shared memory (shm-size): Multi-process tensor parallelism relies on shared memory to exchange data. It is recommended to set it to 40 GB or more; too small a value can cause startup failure or inference interruption.
    • Device mapping: NPU device nodes, driver management nodes, and log directories need to be fully mapped into the container; none can be omitted.
    • Memory segmentation: Enabling expandable segments can reduce memory fragmentation in long-context scenarios and significantly lower the probability of OOM.
    • Concurrency and context limits: Before stability is fully verified, max_num_seqs should start from 4, and max-model-len should be kept within 8192. After verification, relax them gradually.
    • Operator fusion switches: Some frameworks provide normalization and quantization operator fusion options, which may cause precision issues on certain models. If output anomalies occur, try disabling the fusion and troubleshooting item by item.

    6. Optimization Directions and Outlook

    The test shows that the potential of older-generation inference cards has not yet been fully released. Several clear optimization directions are worth expecting:

    1. Landing of speculative decoding (MTP): Once the inference framework fully supports multi-token prediction, the decoding speed of 27B-level Dense models is expected to improve by more than 50%.
    2. Expert parallelism (EP) support: For 122B-level MoE models, using expert parallelism instead of pure tensor parallelism can reduce per-card weight residency pressure, free more memory for KV cache, and improve concurrent throughput.
    3. Framework adaptation pace for new models: As the vendor inference framework accelerates support for new architecture models, hardware vendors’ deeply optimized operators are expected to further widen the performance gap over generic adaptation solutions.

    Overall, after quantization and framework tuning, running 30B–120B-level LLMs on older inference cards is fully feasible, and a single deployment can meet the needs of small and medium-sized on-premises deployment scenarios such as question answering, summarization, and code assistance. For teams that hold existing hardware, this is undoubtedly a pragmatic path to validate LLM business at low cost. Readers are advised to use the methodology in this article as a reference, test and verify in their own hardware environments, carefully choose model size and context configuration, and iterate gradually to a production-ready state.