Single-Card LLM Deployment on Chinese-Made AI Accelerator Cards: A Practical Evaluation Guide
This article provides a practical evaluation framework for deploying large language models on a single Chinese-made AI accelerator card. It covers capacity planning, KV cache and memory headroom, memory bandwidth and inference speed, software stack preparation, quantization and accuracy checks, serving deployment, performance measurement, troubleshooting, and selection guidance. Readers can apply the formulas, checklists, and example scripts to assess whether a given card can support their target model and workload.
1. Background and Evaluation Goals
Demand for large language model (LLM) inference is growing quickly. Many individual developers, small teams, and researchers face the same problem: high-end accelerator cards are expensive, procurement cycles are long, and supply is unstable. As a result, Chinese-made AI accelerator cards are increasingly entering the selection scope for individuals and small teams.
When choosing a card, most people do not focus on the vendor’s advertised peak compute. They care about several concrete questions: can a single card hold the target model, can generation speed support actual use, how much time will driver and framework configuration take, and can problems be resolved when they arise. This article breaks these questions into reusable evaluation steps. Readers can substitute their own device specifications and obtain conclusions for their own environment.
2. Four Questions to Answer Before Evaluation
Before evaluating whether an accelerator card can handle LLM inference, it is recommended to answer four questions.
- Capacity: can the model weights and runtime cache fit into the memory of a single card?
- Speed: can generation speed meet interaction requirements, and is time to first token acceptable?
- Software: can the driver, runtime libraries, and inference framework be installed stably, and are the versions compatible?
- Accuracy: after quantization, is the model’s quality loss on target tasks within an acceptable range?
These four questions have a sequential relationship. If capacity is insufficient, the model cannot run even if speed and software are fine. Therefore, in practice, memory estimation is usually performed first, and later stages begin only after the capacity check passes.
3. Memory Estimation
3.1 Weight Memory
The memory occupied by model weights can be estimated with the following formula:
Weight memory (bytes) = number of parameters × bytes per parameter
Common data types use the following bytes per parameter:
- FP16 or BF16: 2 bytes per parameter.
- INT8: 1 byte per parameter.
- INT4: 0.5 bytes per parameter. Real implementations also store metadata such as group scaling factors, so actual usage increases slightly.
For a model with 26 billion to 27 billion parameters, rough results are as follows:
| Data type | Weight size (approx.) |
|---|---|
| FP16/BF16 | 52 GB to 54 GB |
| INT8 | 26 GB to 27 GB |
| INT4 | 13 GB to 14 GB |
The same model has very different memory requirements at different precisions. If only about 48 GB of memory is available, loading directly in FP16 will fail, while INT8 or INT4 may fit.
3.2 Runtime Cache (KV Cache)
During inference, the model needs to cache the keys and values of each layer, known as the KV cache. Its size grows with context length and concurrency. It can be calculated as follows:
KV cache bytes = 2 × number of layers × number of KV heads × head dimension × sequence length × concurrency × bytes per element
The factor 2 represents one copy for keys and one for values. The following example uses a set of hypothetical parameters, not the real configuration of a specific model, only to demonstrate the calculation process: 48 layers, 8 KV heads, head dimension 128, sequence length 8192, concurrency 1, and 2 bytes per element (FP16).
2 × 48 × 8 × 128 × 8192 × 1 × 2 = 1,610,612,736 bytes, about 1.5 GiB.
A single 8K context requires about 1.5 GiB of cache. If concurrency increases to 8, this item grows to about 12 GiB, which is easy to overlook.
3.3 Headroom
Actual available memory must subtract driver and runtime usage, and the framework also needs temporary buffers during computation. In practice, a portion of headroom should be reserved, and the ratio depends on the framework and operator implementation. It is recommended to first run a small-scale trial to observe peak memory, then determine the upper limits for context length and concurrency.
The check order can be: weight memory plus KV cache for the target concurrency, plus temporary buffers and system overhead. The sum of these three should be clearly below the device’s nominal memory. If the gap is very small, the model may start, but long-text requests can easily trigger out-of-memory errors.
4. Memory Bandwidth and Inference Speed
4.1 Bottlenecks in Two Phases
LLM inference is divided into two phases: prefill and generation. Prefill processes the input prompt at once, involves a large amount of computation, and depends more on compute capacity. The generation phase outputs tokens one by one, and each generated token requires reading the weights once, making it very sensitive to memory bandwidth.
In the single-concurrency case, the theoretical upper bound of generation speed can be estimated with the following formula:
Theoretical upper bound (tokens/s) ≈ memory bandwidth (GB/s) ÷ weight size read per token (GB)
Assume an accelerator card has a memory bandwidth of 1000 GB/s, the model uses INT4 quantization, and the weights are about 13.5 GB. The theoretical upper bound is then about 74 tokens/s. This is only an upper bound. Actual speed will decrease due to computational overhead, scheduling, memory access patterns, and framework efficiency.
4.2 Using Theoretical Upper Bounds for Comparison
The value of the theoretical upper bound lies in comparison. Under the same model and precision, if bandwidth doubles, the theoretical upper bound of generation speed also doubles. If measured speed is far below the theoretical upper bound, the bottleneck is usually not bandwidth, but operator implementation, batching strategy, or software stack maturity. In this case, check logs and profiling results first before considering whether to change hardware.
4.3 Time to First Token
Time to first token is mainly determined by the prefill phase. The longer the input, the higher the latency. For long-input scenarios such as document question answering, time to first token under long inputs must be tested separately; short-prompt performance alone is not enough.
5. Software Stack and Environment Preparation
5.1 Environment Checklist
Before deployment, confirm the environment in the following order:
- Confirm the compatibility between the operating system version and the accelerator card driver, based on the vendor’s compatibility documentation.
- Install the driver and confirm that the device is enumerated by the operating system.
- Install the runtime libraries and communication components, and check whether the version numbers match.
- Create an isolated virtual environment or container to isolate dependency versions.
- Install the inference framework, run a minimal example, and verify device visibility and basic operators.
Device enumeration can be performed with the operating system’s device query function, then cross-checked with the accelerator runtime’s device list command. Only when both results are consistent can driver loading be considered successful.
5.2 Minimal Verification Script
Before loading a large model, use a small program to verify whether the framework can recognize the device and complete a matrix operation. The following pseudocode is framework-agnostic and illustrates the verification logic:
def verify_device(runtime):# 1. Check device countcount = runtime.device_count()if count < 1:raise RuntimeError("No available accelerator device detected")# 2. Allocate tensors on the device and perform matrix multiplicationdevice = runtime.get_device(0)a = runtime.random_tensor((1024, 1024), device=device)b = runtime.random_tensor((1024, 1024), device=device)c = runtime.matmul(a, b)runtime.synchronize(device)# 3. Check result shape and available memoryassert c.shape == (1024, 1024)free, total = runtime.memory_info(device)print(f"Available memory {free / 2**30:.1f} GiB / Total memory {total / 2**30:.1f} GiB")
The three checks cover device count, actual computation, and memory information. Only when all three are normal can the environment be considered basically usable.
5.3 Dependency and Version Management
The same driver version may support only specific versions of the runtime and framework. It is recommended to write all dependency versions into a lock file and share it within the team. Before upgrading the driver, complete regression testing in an isolated environment to confirm that model loading, inference results, and performance metrics have not degraded, then switch to the production environment.
6. Quantization and Model Accuracy
6.1 Common Quantization Methods
Quantization is the main method for reducing memory usage. Common approaches include:
- Weight quantization: quantize only model weights, then dequantize during inference or use low-precision computation. It is simple to implement and provides clear memory savings.
- Group quantization: divide weights into fixed-size groups, with an independent scaling factor for each group. Accuracy is usually better than global quantization.
- Activation quantization: also quantize intermediate activations. This places higher requirements on hardware operator support, and it is necessary to confirm whether the target device supports the corresponding low-precision operations.
When choosing a quantization method, priority should be given to whether the target framework and device already support it. Introducing operators that cannot run just to save memory is not worthwhile.
6.2 Accuracy Evaluation Method
Accuracy evaluation after quantization should use a fixed evaluation set and compare results with the original precision. It is recommended to cover at least three types of tasks:
- General question answering: check whether factual answers degrade noticeably.
- Instruction following: check whether output format and constraints are still respected.
- Reasoning tasks (if required by the business): these are more sensitive to numerical errors and are most likely to expose quantization problems.
During evaluation, fix random seeds and decoding parameters, compare output differences under the same input, and record statistical results. Drawing conclusions from only a few samples can easily lead to misjudgment.
6.3 Model File Integrity
When obtaining model weights externally, verify hashes or signatures to confirm that files are complete and the source is trustworthy. When loading, use a safe format that does not execute arbitrary code whenever possible, and do not directly run loading scripts from unknown sources. This is a basic security requirement unrelated to hardware selection, but it is often overlooked in personal environments.
7. Inference Service Deployment
7.1 Basic Structure of a Single-Machine Service
A single-machine inference service usually contains the following components:
- Model loading module: reads weights, completes quantization configuration and device allocation.
- Request scheduling module: manages concurrent requests, merges batches, and limits the maximum context length.
- Interface layer: provides a unified external calling method for application integration.
- Monitoring module: records memory usage, latency, throughput, and error rate.
7.2 Configuration Example
The following is a configuration example unrelated to any specific product, used to illustrate the parameters that need to be determined:
model:path: /data/models/target-model-int4dtype: int4max_context_length: 8192serving:max_concurrency: 4max_batch_tokens: 4096timeout_seconds: 120device:index: 0memory_reserve_ratio: 0.15
There are constraints between parameters. The product of concurrency and context length determines the upper limit of the KV cache. Before increasing concurrency, recalculate memory requirements using the formula in Section 3.2.
7.3 API Call Example
After the service starts, the client can test it with a simple HTTP request. The address and fields below are examples and need to be modified according to the actual service definition:
import jsonimport urllib.requestpayload = {"prompt": "Explain in three sentences how memory capacity and bandwidth affect inference speed.","max_tokens": 256,"temperature": 0.7,}req = urllib.request.Request("http://127.0.0.1:8000/generate",data=json.dumps(payload).encode("utf-8"),headers={"Content-Type": "application/json"},method="POST",)with urllib.request.urlopen(req, timeout=120) as resp:print(json.loads(resp.read())["text"])
8. Performance Evaluation Method
8.1 Key Metrics
During evaluation, it is recommended to record the following metrics:
- Time to first token: the time from sending a request to receiving the first token.
- Generation throughput: tokens output per second, measured separately for single concurrency and multiple concurrency.
- Tail latency: P95 or P99 latency, reflecting stability under high load.
- Peak memory: record values after loading completes, during long requests, and under concurrency pressure.
- Stability: whether memory growth or memory fragmentation causes failures after several hours of continuous operation.
8.2 Test Script Approach
import timedef measure(generate_fn, prompt, runs=5):results = []for _ in range(runs):start = time.perf_counter()first_token_time = Nonen_tokens = 0for _tok in generate_fn(prompt): # Streaming output token by tokenif first_token_time is None:first_token_time = time.perf_counter() - startn_tokens += 1total = time.perf_counter() - startresults.append((first_token_time, n_tokens / total))return results
Before testing, warm up several times, discard the first loading result, and then take the median of multiple runs. A single test has large fluctuations and should not be used as the basis for conclusions.
8.3 Interpreting Results
Evaluation results should correspond to the usage scenario. Interactive dialogue pays more attention to time to first token and single-concurrency speed, while batch generation tasks pay more attention to total throughput. The same card may lead to completely different conclusions in the two scenarios.
9. Common Issues and Troubleshooting
- Out of memory during loading. First determine whether the limit is exceeded by weights or cache. If it is cache, reduce the context limit or concurrency; if it is weights, switch to lower precision. Also check whether other processes are occupying memory.
- Device is visible but computation reports errors. In most cases, the driver and runtime versions do not match, or an operator is not supported. Check the operator name in startup logs and compare it with the framework’s support scope.
- First load is very slow. Weight reading and format conversion take a long time. The converted result can be cached in local high-speed storage and read directly on subsequent startups.
- Abnormal output, such as garbled text, repetition, or obvious accuracy degradation. Check whether the tokenizer matches the weights, verify the data type settings, and compare fixed inputs with outputs at original precision.
- Performance degrades after long-running operation. Observe memory growth trends and check for memory fragmentation. If necessary, set up periodic worker process restarts or limit maximum concurrency.
- Service becomes unresponsive after requests accumulate. Set timeouts for requests, limit queue length, and implement retry backoff on the client side to avoid expanding the failure.
10. Selection Advice and Conclusion
Whether single-card deployment is feasible depends on whether the model can fit into memory through quantization and whether the business can accept the measured generation speed. Based on the evaluation methods above, the following criteria can be used.
- Suitable scenarios: budget-sensitive, the team can afford some environment debugging effort, the business has moderate requirements for time to first token and concurrency, and model accuracy still meets requirements after quantization.
- Scenarios requiring caution: strict requirements for time to first token and high concurrency, the team lacks low-level troubleshooting experience, or the project strongly depends on a specific toolchain.
- Recommended evaluation order: first use the memory formulas for capacity screening, then use the minimal verification script to confirm the environment, then test accuracy and speed on a fixed evaluation set, and finally compare migration and maintenance costs before deciding whether to invest.
By following this process, readers can obtain reliable conclusions through a few days of small-scale verification before investing a large amount of time.
