Deploying a 35B-A3B Model Locally on a 16GB GPU: Requirements and Testing

    This article explores the feasibility of deploying a 35B-A3B sparse activation model locally on a 16GB GPU. It covers VRAM calculations, deployment steps using frameworks like llama.cpp and Ollama, and troubleshooting common issues. It also details capability tests for multimodal prompt generation, chain-of-thought reasoning, paraphrasing, and SVG code generation, concluding with model selection and deployment strategies.

    1. Calculating VRAM Requirements Before Deployment

    The “35B-A3B” designation means the model has a total of approximately 35 billion parameters, but only about 3 billion parameters are activated per token. Sparse activation reduces the number of parameters that need to be read from VRAM during each generation step, which theoretically benefits bandwidth-limited inference. However, it does not reduce the storage space required for the weights themselves.

    Estimating at 4 bits per parameter, the weights for a 35B parameter model take up about 17.5GB. Actual GGUF quantized files may vary slightly depending on the quantization scheme and are usually larger. Therefore, a 16GB GPU cannot hold the entire model in its VRAM. There are three common ways to handle this:

    • Use a lower-bit quantized version, at the cost of potentially degraded output quality.
    • Enable CPU offload to run some layers in system memory, though speed will be affected by data transfer between the CPU and the GPU.
    • Use multiple GPUs to distribute the weights across several VRAMs.

    If you choose offloading, ensure you leave sufficient system RAM. The required memory depends on the number of offloaded layers and the context length. It is recommended to do a dry run with a small context size before formal deployment to observe the memory usage curve.

    2. Deployment Steps and Key Parameters

    The deployment process can be divided into four steps:

    1. Confirm the inference framework and its version, such as llama.cpp, Ollama, or vLLM. The version used must support the model architecture; otherwise, it may fail to load or produce abnormal outputs.
    2. Download the corresponding quantized file and record the file name and hash value for future reproducibility.
    3. Set key parameters: context length, batch size, thread count, and the number of layers placed on the GPU (e.g., n-gpu-layers in llama.cpp).
    4. Record VRAM usage (viewable via nvidia-smi) and generation speed (tokens/s). When benchmarking, keep the prompt length, generation length, and sampling parameters fixed.

    Common issues and troubleshooting directions:

    • Out of Memory (OOM): Reduce the context length, decrease the number of layers placed on the GPU, or switch to a lower-quantized version.
    • Slow speed: Check if a large number of layers are falling back to the CPU, which is usually the primary reason for speed drops.
    • Abnormal output or gibberish: Verify that the chat template and stop words match the model.

    3. Capability Tests: What to Observe and How to Verify

    3.1 Multimodal Prompt Generation

    This test requires the model to generate prompts for two paired images. The observation focus is whether the model separately plans the subject, scene, and style of image 1 and image 2 in its chain-of-thought (CoT).

    Quantifiable checks include whether the two sets of prompts share the same subject, tone, and scene elements, and whether there are contradictory descriptions. In some samples, the model maintained coherence between the two images, a behavior that can be described as “semantic alignment.” However, this was only observed in a few samples and cannot represent all scenarios. Compared to specially fine-tuned models, its output is more pragmatic, and its creative diversity may be weaker.

    3.2 Draft-style Chain-of-Thought

    In complex cultural analysis questions, the model’s CoT typically generates a complete draft first, then conducts self-review and polishing, and finally provides the finalized version.

    The text in the CoT does not necessarily fully reflect the model’s internal computation process, so it should not be used alone to judge reasoning quality. A more reliable approach is to check the factual statements in the final answer and compare them with credible sources to calculate the error rate.

    3.3 Writing, Rewriting, and Repetition

    When rewriting ideas provided by the user, the model rarely copies the original text verbatim. Instead, it extracts the core intent and adds transitional structures.

    One verification method is to calculate the n-gram repetition rate between the output and the input. A lower repetition rate indicates that the model is less likely to restate the original text. At the same time, you should check whether the key arguments are retained to avoid losing the original meaning just to reduce repetition.

    3.4 SVG Code Generation

    The first test requires drawing an SVG of an animal riding a bicycle, a common task for evaluating spatial composition and coding skills. The generated code was able to render the basic structure of the animal and the bicycle, with a posture that roughly met the requirements.

    The second test requires drawing a transparent glass fish tank containing water plants and fish. This type of task involves requirements like transparency, refraction, and layer occlusion, which differ from standard questions. The model’s CoT handled these instructions noticeably differently, specifically discussing transparency and layer order.

    The conclusions of these two tests have limitations. A single question cannot rule out the possibility of similar examples existing in the training data, so it cannot be concluded that the model hasn’t been optimized for specific test sets. A more reliable approach is to conduct blind tests with multiple questions, change the questions, and record failed samples.

    When reproducing SVG tests, it is recommended to record the following:

    • The complete original prompt;
    • Model version, quantized file, and inference framework version;
    • Decoding parameters such as temperature, top_p, and random seed;
    • Syntax validation results, e.g., using xmllint --noout to check if the XML is valid;
    • Browser rendering screenshots and manual verification results against the prompt requirements.

    4. Selection Advice

    The table below lists items to record during local deployment evaluations. Readers can use the same set of prompts to test dense models and MoE models separately, and then fill in the comparison.

    Item Details Purpose
    Hardware GPU model, VRAM, system RAM Judge if the model can fit
    Model & Quant Model name, quantization format, file size Ensure reproducibility
    Run Parameters Context length, batch size, threads, GPU layers Explain speed and VRAM differences
    Performance VRAM usage, generation speed (tokens/s) Compare deployment efficiency
    Quality Output score or error rate under fixed prompts Compare capability differences

    Based on use cases, consider the following guidelines:

    • If the primary need is low-latency short Q&A, compare smaller models first to avoid sacrificing response speed for parameter count.
    • If long context or high concurrency is required, a single consumer-grade GPU usually struggles to meet the demand. Consider general-purpose GPU cloud servers or container platforms to host the same model, and compare the results with local ones.
    • If handling user data or internal documents, local deployment can reduce data exfiltration, but you still need to check the data flow of logs, caches, and plugins.

    Combining edge and cloud is a common hybrid deployment strategy. Edge models handle high-frequency, low-latency tasks, while the cloud handles long-tail and high-concurrency requests. Costs depend on the GPU hourly rate, request volume, and average token count. This should be estimated based on actual request logs and should not directly adopt others’ conclusions.

    5. Conclusion

    Running a 35B-A3B model on a 16GB VRAM device usually requires a combination of one or more methods, such as lower quantization, CPU offload, or multi-GPU. The tests observed some noteworthy behavioral characteristics in writing assistance, chain-of-thought structure, and SVG generation, but these results depend on specific prompts, model versions, and decoding parameters. Readers should reproduce the tests based on the items listed in this article before deciding whether to adopt the model.