Self-Hosting a 700B MoE Model on an 8-GPU Server: GPU Memory Planning and Troubleshooting
This guide covers self-hosting a 700B-parameter MoE model on an 8-GPU server. It explains how to compare FP8 and BF16 on your own codebase, estimate memory for weights, KV Cache, and overhead, check which GPU configurations can fit the model, and set up a starting vLLM configuration with container monitoring. It also includes a license and privacy checklist and troubleshooting steps for out-of-memory errors and higher latency.
1. Evaluate on Your Own Codebase First
Public leaderboards show only a rough measure of model capability. They cannot replace internal validation. Before choosing a model, draw 100 to 300 tasks from your team’s merged pull requests from the last three months. Cover task types such as code completion, bug fixing, and adding unit tests, with at least 30 tasks per type. After sampling, remove any samples that contain keys, customer data, or personal information. You can scan for secrets with gitleaks, and use regular expressions or Presidio to detect mobile phone numbers, email addresses, and national ID numbers. Then run a manual spot check.
Record each evaluation run with the template below:
| Field | Description | Example |
|---|---|---|
| task_id | Task ID | T-0123 |
| task_type | Completion, bug fix, or unit test | Bug fix |
| repo_lang | Repository and language | Internal service / Go |
| model_precision | Precision version | FP8 |
| passed | Whether automated tests pass. 1 means pass. | 1 |
| review_min | Manual rework time (minutes) | 12 |
| latency_s | End-to-end response time (seconds) | 8.4 |
| note | Failure reason or remarks | Missed an edge case |
FP8 and BF16 must use the same evaluation set, prompts, and evaluation script. Fix temperature at 0, and also fix max_tokens and top_p. Save the input, output, model version, vLLM version, and image tag for every run so results can be reproduced. Even with temperature set to 0, different batch sizes can cause slight output differences. Run each group at least twice and record the variation in results.
Use the following method to judge the results:
- Calculate the pass rate for each precision, the median manual rework time, and the p50 and p95 of latency_s.
- For the same task, run a paired test on the pass results of the two precisions, such as McNemar’s test.
- Set the threshold before the evaluation. For example: “Use FP8 if its pass rate is no more than 2 percentage points below BF16 and its p95 latency meets the target.” Do not adjust thresholds after seeing the results.
BF16 weights total about 1.4 TB, which may not fit on a single 8-GPU server. In that case, run the BF16 baseline on a larger cluster, or run it only on a sampled subset. If a full run is not possible, state this limitation in the report.
2. Memory Estimation: Calculate Weights First, Then the Cache
An MoE model activates only some of its experts during inference, so each forward pass requires less compute than a dense model with the same total parameter count. However, the weights of all experts must stay resident in GPU memory. Memory requirements therefore depend on the total parameter count, not the active parameter count.
Estimate memory in three parts.
1. Weight memory
Using decimal units, 1 GB equals 10^9 bytes. FP8 uses 1 byte per parameter, so 700B parameters need about 700 GB. BF16 uses 2 bytes per parameter, so it needs about 1.4 TB. Quantization scale factors and metadata add a small amount of extra storage. The actual size is the total size of the weight files.
2. KV Cache
The bytes per token are calculated as follows:
Bytes per token = 2 × layers × KV heads × head dimension × bytes per element
Assume the model has 60 layers, 8 KV heads, and a head dimension of 128, and that the KV Cache is stored in FP8 (1 byte per element). Each token then uses:
2 × 60 × 8 × 128 × 1 = 122,880 bytes, or about 0.12 MB.
This gives the following typical values:
| Context length per request | KV Cache usage (approx.) |
|---|---|
| 8K tokens | 1.0 GB |
| 128K tokens | 16.1 GB |
| 1M tokens | 128.8 GB |
These figures apply only to the layer count, KV head count, head dimension, and cache precision assumed above. Before deployment, read the actual values from the model’s config.json and substitute them into the formula. If the model compresses KV with MLA, use this formula instead:
Bytes per token = layers × (kv_lora_rank + qk_rope_head_dim) × bytes per element
Take kv_lora_rank and qk_rope_head_dim from the model configuration as well.
3. Activations and framework overhead
Reserve 10% to 20% of total memory for activations, communication buffers, and the framework itself. This range is an empirical value, so confirm it with load testing. Follow these steps:
- Send sustained requests at the target concurrency and target context length for at least 30 minutes.
- Record the memory usage of each GPU every 10 seconds, and note the peak.
- The gap between the peak and the theoretical value is the actual overhead. Convert that gap into a percentage of total memory, and use it to replace the empirical value.
3. Can an 8-GPU Server Run the Model?
The table below shows the results. The memory remaining after overhead equals total memory multiplied by 0.8, minus the weight footprint. The remainder is available for the KV Cache.
| Configuration | Total memory | Weight footprint | Remaining after 20% overhead | Conclusion |
|---|---|---|---|---|
| 8 × 80 GB (A100 or H100 80 GB) | 640 GB | About 700 GB | Insufficient | Not feasible |
| 8 × 96 GB | 768 GB | About 700 GB | 614 GB, below the weight size | Not feasible |
| 8 × 141 GB (H200) | 1128 GB | About 700 GB | About 202 GB | Feasible, but concurrency is limited |
| 16 × 80 GB | 1280 GB | About 700 GB | About 324 GB | Feasible |
Using 8 × H200 as an example, about 202 GB of KV space supports:
- About 12 concurrent requests at 128K context.
- About 200 concurrent requests at 8K context.
These are theoretical upper limits. They do not include activation peaks during the prefill stage, so determine actual concurrency through load testing.
For 80 GB GPUs, the minimum is 700 ÷ (80 × 0.8) ≈ 10.9, which rounds up to 11 GPUs. However, the tensor parallel and expert parallel degrees must evenly divide the model’s head count, KV head count, and expert count. In practice, deployments often use 16 GPUs. Confirm the specific constraints in the official model documentation.
