Large Model Deployment Guide: From Single-Machine Setup to High-Concurrent Team Serving
This guide walks through a practical path for deploying large language models, starting from scenario classification and ending with production observability. It covers lightweight single-machine setups, high-throughput inference engines for team sharing, model weight download and cache management, GPU memory and parallelism estimation, key server startup parameters, API verification and connectivity troubleshooting, and production hardening recommendations. Readers will learn how to match deployment choices to user count, concurrency, hardware budget, and latency requirements instead of copying startup commands blindly.
1. Start With the Scenario: Deployment Goals Drive Technology Choices
Deploying a large model is not a single action but an engineering problem shaped by four factors: number of users, concurrency, hardware budget, and response latency requirements. Many teams simply copy someone else’s startup command at the beginning, only to find it either will not run on a personal laptop or cannot support multiple simultaneous users on a multi-GPU server. The right approach is to classify the scenario first.
The first category is single-machine personal use. The typical traits are one or a few users, sporadic requests, almost zero concurrency, and hardware that is usually a laptop or a desktop. The core requirement here is fast setup, low resource usage, and a working service.
The second category is team sharing. The typical traits are a research group, a department, or an internal company team sharing one inference endpoint, with visible queuing during peak hours and hardware that is usually a workstation or server with multiple accelerator cards. The core requirement here is high throughput, stable concurrency, and horizontal scalability.
The two categories place completely different demands on the inference engine, so a single solution cannot handle both.
2. Lightweight Single-Machine Deployment: Choose a Solution With Controlled Resource Usage
For personal devices, an all-in-one lightweight model runtime is the recommended starting point. The value of such a solution is that it packages model download, format conversion, quantization, and the inference runtime together, so a single command brings up the service. It also reduces resident memory usage by default through mechanisms such as memory mapping, which is friendly to resource-constrained devices.
Practical points:
- Prefer quantized model weights to balance quality against resource usage;
- Control the context length, since long contexts significantly increase GPU and memory pressure;
- Shut down unnecessary background services so they do not compete with the inference process for memory;
- If the device only has integrated graphics, let inference fall back to the CPU, at the cost of lower speed.
It should be clear that this kind of lightweight solution has a natural ceiling on concurrency. Its design goal is ease of use and low resource usage, not high-concurrency throughput, so it is not suitable as a server for multiple users.
3. Team-Level High-Concurrency Deployment: Switch to a High-Throughput Inference Engine
When the service faces multiple users, the bottleneck is no longer whether the model runs, but how many tokens it can process per second and how many concurrent requests it can hold. At this point you should switch to a service-oriented high-throughput inference engine, whose core capabilities include continuous batching, paged memory management (PagedAttention-style mechanisms), tensor parallelism, and an OpenAI-compatible HTTP API.
Installation is usually done through a package manager, for example:
pip install vllm
If you need to build from source or get the latest features, obtain the source code from the official repository and build locally. For production, pin the version number to avoid incompatible changes introduced by automatic upgrades.
4. Model Acquisition and Cache Location Management
Model weights can easily reach tens of gigabytes, and download and cache management is an easily overlooked but extremely time-consuming part of deployment. Downloading through the command-line tool of a model hosting platform is recommended, for example:
modelscope download --model <organization>/<model-name>
By default, the weights land in a cache path under the user directory. In a team environment, explicitly specifying a shared directory is preferable, so multiple users can reuse the files and avoid repeated downloads:
export MODELSCOPE_CACHE=/your/target/pathmodelscope download --model <organization>/<model-name>
Engineering recommendations:
- Mount the model directory on a separate data disk so the system disk does not fill up;
- Use checksums to confirm download integrity; resuming a download saves more time than starting over;
- Mount the directory read-only for the inference process to prevent accidental deletion;
- Record the model version and download time to keep experiments reproducible.
5. Hardware and Parallelism Strategy Evaluation
Taking a 14B-parameter model with standard-precision weights as an example, the weights alone require tens of gigabytes of GPU memory, and adding KV Cache on top typically means 4 professional accelerator cards in the 24GB class or 2 cards in the 40GB/80GB class are needed for stable operation. A formula-based approach is recommended when evaluating:
- Weight memory ≈ parameter count × bytes per parameter;
- KV Cache memory ≈ number of layers × 2 × sequence length × hidden dimension × batch size × bytes per element;
- Total usage should reserve 10%–20% headroom for activations and fragmentation.
For parallelism, prefer tensor parallelism on a single machine with multiple GPUs, splitting the matrices of each layer across cards. If the number of cards exceeds the degree to which the model can be split, consider pipeline parallelism. The tensor parallelism degree must match the number of visible cards exactly, otherwise initialization will fail.
6. Key Configuration for Starting the Service
Before starting, declare the visible devices and runtime environment variables:
export CUDA_VISIBLE_DEVICES=0,1,2,3# Reduce memory fragmentation and improve utilizationexport PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True# Disable P2P under specific interconnect topologies, routing through host memory instead to avoid communication errorsexport NCCL_P2P_DISABLE=1
Then bring up a service compatible with the OpenAI protocol:
python -m vllm.entrypoints.openai.api_server \--model /path/to/models/Qwen3-14B \--trust-remote-code \--tensor-parallel-size 4 \--max-model-len 8192
The parameters need to be understood rather than memorized: --model points to the local weight directory; --trust-remote-code allows the model’s own custom code to run, and should only be enabled when the source is trusted; --tensor-parallel-size must equal the number of visible cards; --max-model-len determines the maximum context per request and directly affects memory usage and the concurrency ceiling.
If the model outputs a reasoning process by default but the business does not need it, disable it explicitly:
python -m vllm.entrypoints.openai.api_server \--model /path/to/models/Qwen3-14B \--trust-remote-code \--tensor-parallel-size 4 \--max-model-len 8192 \--enable-reasoning --reasoning-parser deepseek_r1
Once the log shows the service listening and the port is ready, the deployment is successful.
7. API Verification and Connectivity Troubleshooting
The acceptance criterion for a service deployment is that an external client can get results normally. Use curl to send a chat request (replace the address with the actual server IP):
curl -X POST "http://XX.XX.XX.XX:8000/v1/chat/completions" \-H "Content-Type: application/json" \-H "Authorization: Bearer EMPTY" \-d '{"model": "/path/to/models/Qwen3-14B","messages": [{"role": "user", "content": "Is elementary math olympiad training worth it"}],"stream": false}'
Common connectivity issues and the order in which to handle them:
- Connection refused: confirm the service process is alive and the port is not blocked by a firewall;
- Request timeout: usually caused by excessive concurrency and queuing, so lower
--max-model-lenor add more cards; - Out of memory: reduce context length and batch size, or increase the parallelism degree;
- Unexpected process exit: switch back to the corresponding virtual environment before restarting, and check kernel logs for OOM records.
8. Production Recommendations
In a real team environment, it is advisable to run the inference service in a container platform with unified orchestration, store weights in object storage, collect runtime logs with a logging service, and track memory and throughput metrics with monitoring and alerting. Distribute requests through an internal load balancer to avoid a single point of failure. General-purpose capabilities such as containers, storage, and monitoring offered by cloud providers like Baidu AI Cloud can serve as one of the foundation options for hosting such a self-built inference service.
Overall, the key to fast large model deployment is not memorizing a particular command, but building a complete chain: scenario classification, resource evaluation, weight management, parallelism configuration, API acceptance, and runtime observability. Start with a lightweight solution for personal use, and go straight to a high-throughput engine for team sharing, so the model service both runs fast and holds up under concurrency.
