Local Deployment of Open-Source Multimodal LLMs on Non-Mainstream GPUs
This article documents a practical deployment of a roughly 320B-parameter open-source multimodal model on multiple 32GB-class non-flagship GPUs. It covers framework branch selection, quantization trade-offs, VRAM estimation, backend and layer-offload considerations for heterogeneous hardware, and common troubleshooting steps. The focus is on keeping data local, reducing long-term cost, and customizing the inference pipeline, using measured results from this specific hardware setup as the reference.
1. Why Deploy on Non-Mainstream Hardware
Recently, the open-source community has released several large native multimodal models that can process text, images, and video as unified inputs. Many developers want to run such models locally for three main reasons: data does not leave the machine, long-term usage cost is lower, and the inference pipeline can be customized.
Local deployment has two main challenges. First, inference frameworks often lag in supporting new models. Second, hardware ecosystems outside mainstream GPUs are fragmented, with large differences in drivers and backends. This article records an approach for running a roughly 320B-parameter model on multiple 32GB-class, non-flagship GPUs. The numbers here come from this one practice; a different hardware setup requires fresh measurements.
2. Three Decisions Before Deployment
2.1 Choose an Inference Framework Branch
When a new model is first released, the framework’s main branch often has not yet merged the corresponding support code. Support usually appears first in community experimental branches. Use the following steps to evaluate:
- Search the framework’s issues and pull requests (PRs) for the target model’s architecture name and confirm whether there is relevant discussion.
- Check the latest commit time of the support branch and whether core maintainers are involved.
- Prefer a branch that differs as little as possible from the main branch and has reports of successful runs.
Experimental branches may have interfaces and build options that differ from the main branch. It is advisable to clone a separate copy of the code and compile it in an isolated virtual environment to avoid polluting the main environment. Using llama.cpp as an example, enable the build option for the hardware backend:
git clone <inference-framework-repo-url> llm-expcd llm-expgit checkout <branch-or-commit-hash-supporting-the-target-model># NVIDIA GPUscmake -B build -DGGML_CUDA=ON# Non-NVIDIA GPUs with Vulkan supportcmake -B build -DGGML_VULKAN=ON# Use CPU only when no usable GPU backend is availablecmake -B buildcmake --build build -j
After compilation, record the branch name and commit hash. They are needed to reproduce the deployment later.
2.2 Choose a Quantization Scheme
FP16 uses 16 bits per parameter. The FP16 weights of a 320B-parameter model are about 640 GB. Compressed to 2-bit, the theoretical size is one-eighth of FP16, about 80 GB, which is the lower bound for pure weights. Actual files are larger because mixed bit widths, quantization metadata, and some retained high-precision layers all take up space. The file measured in this article is about 110 GB, corresponding to an average bit width of about 2.75 bits: 320B × 2.75 bits ÷ 8 ≈ 110 GB.
The trade-offs between quantization levels are as follows:
- 2-bit level: Smallest size, which is key to fitting on an ordinary multi-GPU workstation, but quality loss is noticeable.
- 3-bit and 4-bit levels: Better output quality, but weight size and VRAM requirements increase significantly.
Documentation often uses the term “dynamic quantization,” but allocating bit widths by layer sensitivity is more accurately called mixed-precision quantization or importance-aware quantization. In some frameworks, “dynamic quantization” refers to dynamically determining the range of activations at runtime; the two are not the same. Refer to the documentation of the framework in use for the exact meaning.
The vision module is usually stored separately in an mmproj file and generally kept at F16 precision, with a size of about 1 to 2 GB. It has a major impact on image understanding. Do not omit it, and do not quantize it arbitrarily.
2.3 Estimate VRAM
Using the measurement in this article as an example: the language model weights are about 110 GB, plus about 1.1 GB for mmproj, for a total of about 111 GB. Four 32GB GPUs provide 128 GB in total.
After reserving 10% to 15% headroom, usable VRAM is 128 × 0.85 ≈ 108.8 GB to 128 × 0.9 ≈ 115.2 GB. The 111 GB required by the weights falls within this range, so the headroom is essentially consumed by the weights. KV Cache, activations, and inter-GPU communication buffers must all come from the remaining space.
KV Cache usage grows linearly with context length and can be roughly estimated with the following formula:
KV Cache bytes per token ≈ layers × KV heads × dimension per head × 2 (K and V) × bytes per element
Assume a model has 60 layers, 8 KV heads, and a dimension of 128 per head, with KV Cache stored in FP16. Each token takes about 245 KB, and a 32K context takes about 8 GB. For an actual model, use the values in the model configuration file.
The conclusion is that 128 GB of total VRAM can theoretically hold the weights, but only about a dozen GB remain. Short contexts and small batches can run. Long contexts require reducing the number of layers placed on GPUs, offloading some layers to system memory, or adding more VRAM. Also check actual usage on each card individually, because weights may not be split evenly across GPUs.
3. Adapting to Heterogeneous and Non-Mainstream Hardware
- Backend selection: The same inference framework usually supports backends such as CUDA, Vulkan, SYCL, ROCm, and CPU-only. Vulkan has broad compatibility and is suitable as a first attempt for non-mainstream GPUs. SYCL is often used for Intel GPUs, and ROCm for AMD GPUs; both require matching kernel drivers and runtime versions. Generic backends usually perform below vendor-native backends, and the gap must be measured.
- Layer offloading: The
--n-gpu-layersparameter controls how many layers are placed on the GPU. Layers that do not fit fall back to CPU and system memory for computation. This trades speed for feasibility; the more layers offloaded, the slower decoding becomes. - Multi-GPU splitting: Layer-based splitting (pipeline) has lower requirements for inter-GPU bandwidth. Tensor parallelism requires high-bandwidth interconnect and offers limited benefit over PCIe connections. If inter-GPU bandwidth is weak, prefer layer-based splitting.
- Speed estimation: A 2-bit model does not demand much compute; decoding speed is mainly limited by VRAM or memory bandwidth. Older platforms have lower bandwidth and will decode more slowly. First confirm that the model runs with a small batch and short context, then tune gradually.
4. Common Issues and Troubleshooting
| Symptom | Possible cause | Handling |
|---|---|---|
| Out of memory at startup, or “failed to allocate” in logs | Weights plus KV Cache exceed VRAM | Shorten context, reduce GPU layers, check VRAM allocation on each card |
| Image input errors or garbled output | Missing mmproj file, or mmproj does not match the language model version | Confirm both come from the same baseline version |
| Noticeable drop in output quality | Quantization level too low, or the quantization file comes from a different source | Compare different quantization versions and check the model card |
| Very slow decoding | Many layers fall back to CPU | Increase GPU layers, or adjust the splitting method |
In addition, pay attention to the following during deployment:
- File verification: After downloading, use
sha256sumto check the hash of the quantization file against the value published on the release page. - Version records: Record the framework branch, commit hash, build options, and model file hash for reproducibility.
- Rollback preparation: Keep a working older binary and model file so you can recover quickly if a new branch has problems.
- Scale up gradually: First verify output correctness with a short context, then gradually increase context length and batch size.
5. Conclusion
Running large multimodal models locally depends on three things: choosing a framework branch that supports the target model, choosing the right quantization level, and planning VRAM for all weights—including the vision module—and runtime overhead. Using the 320B model in this article as an example, four 32GB GPUs can hold the weights, but there is very little headroom; long-context scenarios require additional layer offloading or VRAM. Base deployment decisions on measured results, verify with a short context first, and then scale up gradually.
