Running a 26B MoE on Dual 32GB GPUs: Long-Context Deployment and Rollback

    This article outlines how to reproduce a long-context inference service for an approximately 26B-parameter MoE model on two 32GB GPUs. It covers environment records, VRAM budgeting with Q8_0 quantization, KV cache sizing, startup and monitoring commands, throughput measurement, tool-call stability testing, safe model replacement and rollback, and operational risks. The performance figures in the source report lack input length, concurrency, and measurement details, so readers should re-measure them on their own hardware.

    Scope and Prerequisites

    This article is for local deployment developers who want to reproduce a long-context inference service on a machine with two 32GB GPUs. The source report describes results with 8-bit quantization, three concurrent slots, long context, and multiple models running together, but it does not provide framework versions, driver versions, or complete commands. The steps below use llama.cpp parameters as an example. Before use, check llama-server --help for the version you are running.

    Record the following environment information:

    Item Your value
    GPU model and count [fill in]
    ROCm version [fill in; check with rocm-smi --version]
    Inference framework and commit ID [fill in]
    Model file name and quantization format [fill in, e.g. Q8_0]
    Operating system and kernel version [fill in]

    How to Estimate VRAM Budget

    Weight VRAM can be estimated with the following formula:

    Weight VRAM ≈ parameter count × bits per parameter ÷ 8

    The Q8_0 format actually uses about 8.5 bits per weight. Therefore, the weights of a 26B model take about 27.6GB, and the weights of a 20B dense side model take about 21.3GB. Together they take about 49GB, leaving about 15GB for KV cache, compute buffers, and driver overhead. When splitting across two GPUs, each GPU still needs buffer space. Reserving 1–2GB of headroom per GPU is recommended.

    KV cache size depends on the model’s layer count, KV head count, and head dimension. The formula is:

    KV size ≈ 2 × layer count × KV head count × head dimension × context length × bytes per element

    The source report gives a total context of 786,432 tokens. That is 768K, not approximately 780K as stated in the source. With -np 3, multiple slots share the total context, so each slot gets about 262,144 tokens. You need to read the layer count and head count from the model configuration file, plug them into the formula, and confirm the result with VRAM monitoring.

    An example startup command is:

    1. llama-server -m ./model-26b-a4b-Q8_0.gguf -ngl 99 -c 786432 -np 3 -fa on -ctk q8_0 -ctv q8_0 --host 127.0.0.1 --port 8080

    After startup, monitor VRAM continuously with:

    1. watch -n 2 rocm-smi --showmeminfo vram

    If VRAM approaches the limit during the long-text fill phase, reduce the value of -c rather than blindly increasing concurrency.

    How to Measure Throughput

    The two figures reported in the source are: prompt-fill speed close to 1,000 tokens/s and single-slot generation speed around 50 tokens/s. The source does not specify input length, concurrency, or scheduling overhead for these numbers, so they cannot be applied directly.

    The llama-server response includes a timings field, which lets you read prompt-fill speed and generation speed directly:

    1. curl -s http://127.0.0.1:8080/completion -H "Content-Type: application/json" -d @req.json | jq '.timings'

    Focus on prompt_per_second and predicted_per_second. Measure according to the matrix below. For each group, repeat at least five times and take the median:

    Input length Concurrent slots Prompt speed (tok/s) Generation speed (tok/s)
    1K 1 [fill in] [fill in]
    10K 1 [fill in] [fill in]
    10K 3 [fill in] [fill in]
    50K 1 [fill in] [fill in]

    As concurrency increases, per-slot generation speed usually decreases. When reporting results, provide both per-slot speed and aggregate throughput. Do not report only one number.

    How to Evaluate Tool-Call Stability

    The source compares two MoE models: one with about 26B total parameters and 4B active parameters (Model A), and another with about 35B total parameters and 3B active parameters (Model B). The author believes Model B made more tool-call errors, but the article does not provide sample size or error rate, so this conclusion can only be treated as an observation in the author’s environment.

    For evaluation, use a fixed test set, such as 200 requests. Each request should include the JSON Schema of the target function. Record each returned result in the following categories:

    • json_error: output cannot be parsed as JSON
    • unknown_tool: calls a function name that does not exist
    • type_mismatch: argument types or required fields do not match the schema
    • ok: valid call

    The core metric is first-call success rate, meaning the proportion of calls that are valid without retry. The checking logic can be written as:

    1. import json
    2. import jsonschema
    3. def check_call(raw, schemas):
    4. try:
    5. call = json.loads(raw)
    6. except json.JSONDecodeError:
    7. return "json_error"
    8. name = call.get("name")
    9. if name not in schemas:
    10. return "unknown_tool"
    11. try:
    12. jsonschema.validate(call.get("arguments", {}), schemas[name])
    13. except jsonschema.ValidationError:
    14. return "type_mismatch"
    15. return "ok"

    The retry policy should also be recorded. It is recommended to retry at most twice and to count the final success rate after retries, because retries can hide quality problems in the first output.

    Model Replacement and Rollback

    Model replacement should be a reversible operation. Recommended steps:

    1. Keep the old model files. Do not overwrite the original gguf file.
    2. Use a symbolic link to point to the current model. When replacing the model, change only the link target.
    3. Run a health check with the fixed test set to confirm first-call success rate and latency.
    4. First shift about 10% of traffic to the new model, i.e. a canary release.
    5. If problems occur, switch the link back to the old model and restart the service.

    The following thresholds are suggestions only and can be adjusted for business requirements: roll back if first-call success rate drops by more than 5 percentage points from baseline, or if P95 latency exceeds 2× the baseline.

    Risks and Boundaries

    The source mentions custom modifications to the framework, including bypassing some default compile options and rewriting operators. Such changes may cause GPU hangs, numerical errors, and license obligations. It is recommended to establish a baseline with the upstream version first, then add changes one by one, and compare outputs on fixed prompts for consistency.

    The side model and the main model share the same set of GPUs, creating a risk of crashes caused by insufficient VRAM. The side model should run as a separate process and have a VRAM limit. The main service must not depend on the side model, and a daemon should automatically restart the side model if it exits abnormally.

    The service binding address should use 127.0.0.1 or an internal network address. If an external interface is required, add authentication. Do not listen directly on 0.0.0.0. The licenses for model weights and the inference framework also need to be checked individually.

    Conclusion

    On two 32GB GPUs, running an approximately 26B MoE model with Q8_0 quantization and a long-context configuration is reported to work in the source. However, the performance numbers in the source lack input length, concurrency, and measurement method, so they represent only results in the author’s environment. Readers should use the measurement matrix in this article to obtain data on their own hardware. Tool-call stability should be evaluated with a fixed test set and first-call success rate. Model replacement should keep the old version and prepare for rollback, so that risk can be controlled when changing models.