Local Deployment of Small LLMs: A Practical Guide to Model Selection and Scenarios
This article examines how to choose and deploy small LLMs on a typical local development machine with 64 GB host memory, 32 GB memory allocated to the virtualized environment, and an 8 GB mobile GPU. It compares 4B-class lightweight text models, 8B-class general text models, efficient small multimodal models, and 12B-class multimodal models across daily text work, lightweight pipeline nodes, screenshot QA, chart explanation, and complex visual tasks. It covers cold-start versus warm-start behavior, VRAM and memory constraints, output length control, default template compatibility, multimodal preprocessing, cloud-edge routing, and pre-launch evaluation methods.
Local Deployment of Small LLMs: A Practical Guide to Model Selection and Scenarios
Selecting a small model is not just a matter of parameter count. Once a model is deployed on a local development machine, an edge device, or a lightweight pipeline, the real user experience is often determined by Chinese output stability, VRAM and memory usage, cold-start versus warm-start differences, default template compatibility, multimodal preprocessing cost, and patience for long outputs. This article uses a typical local development machine as the background and discusses the trade-offs among 4B-class lightweight text models, 8B-class general text models, efficient small multimodal models, and 12B-class multimodal models in different scenarios. It also provides reusable evaluation and deployment methods.
1. Evaluation Background and Machine Constraints
The evaluation environment can be abstracted as follows: 64 GB host memory, 32 GB memory allocated to the virtualized environment, 8 GB VRAM on a mobile GPU, and a general local inference runtime. This configuration represents the acceptable boundary for many individual developers and small teams: it can run small models, but it cannot load large models without careful planning; it can tolerate some cold-start cost, but it is not suitable for reloading the model on every task; it can support multimodal assistance, but image resolution and context length significantly affect latency.
Therefore, evaluation should not only record whether a model can run. It should record the following metrics:
- Cold-start time and first-token latency after warm start;
- Stable output speed and completion time for long outputs;
- Peak VRAM, peak memory, and whether swapping is triggered;
- Chinese generation stability, format-following ability, and repetition or truncation behavior;
- Usability of multimodal image understanding, including screenshot QA, chart explanation, and detail description;
- Default template compatibility, including system prompts, role markers, stop tokens, and structured output formats.
The same model may lead to completely different conclusions under different quantization levels, context lengths, batch sizes, and concurrency levels. The scenario-based recommendations below should be treated as starting points for model selection under default configurations, not as fixed rankings.
2. Conclusions First: How to Build a Default Combination
If only one daily text model is kept, an 8B-class general text model is more suitable as the default choice. Its Chinese output is usually more stable, its VRAM pressure remains acceptable on an 8 GB mobile GPU, and its response speed after warm start is sufficient for daily Q&A, code explanation, document summarization, and lightweight reasoning. It is not suitable for competing with larger models on complex reasoning depth, but in the position of a model that must be used every day, stability matters more than peak capability.
For lightweight classification, title generation, short-text rewriting, intent recognition, or small nodes in a pipeline, a 4B-class lightweight text model saves more resources. It is not suitable for complex reasoning, but it is well suited to high-frequency tasks with short inputs, short outputs, and a tolerable error rate. Placing a 4B-class model at the front of a pipeline can significantly reduce resident resource pressure and allow the 8B-class model to handle only tasks that truly require quality.
For image viewing, screenshot reading, and chart explanation, an efficient small multimodal model is more practical than expected. On an 8 GB VRAM machine, its speed is usually significantly better than that of a 12B-class multimodal model, and its image understanding results are already usable for daily assistance, such as screenshot content QA, simple chart trend explanation, and UI element localization. Its advantage is being readily available, rather than perfect in every detail.
The advantage of a 12B-class multimodal model is more detailed description, but its drawbacks are also direct: it is slow, cold start is noticeably slow, and long outputs are more likely to exhaust patience. It is suitable for occasional handling of more complex visual understanding, such as tasks that require more complete descriptions, finer-grained relationship judgments, or longer explanations. It is not suitable as a default call for every task.
3. Scenario-Based Decision Table
| Scenario | Recommended tier | Deployment notes | Main trade-off |
|---|---|---|---|
| Daily text Q&A, document summarization, code explanation | 8B-class general text model | Control context length, keep the model warm, enable streaming output | Balanced quality and speed, but complex reasoning remains limited |
| Lightweight classification, title generation, short-text rewriting | 4B-class lightweight text model | Fix prompt templates, limit maximum output length | Saves resources and offers high throughput, but complex reasoning is weak |
| Screenshot QA, chart explanation, UI assistance | Efficient small multimodal model | Preprocess image resolution, process long screenshots in chunks | Fast and practical for daily use, but detail description is limited |
| Complex visual description, fine-grained relationship judgment | 12B-class multimodal model | Load on demand, set timeouts and fallback strategies | More detailed descriptions, but cold start and long outputs are slow |
| High-frequency pipeline nodes | 4B-class lightweight text model | Batching, caching, retries, structured output validation | Low cost, but a certain error rate must be accepted |
| Low-frequency heavy tasks | 8B-class or 12B-class on demand | Task queue, timeout, result caching | Quality first, with greater latency and resource fluctuation |
The core idea of this table is layered routing: high-frequency light tasks go to small models, default text tasks go to medium models, and complex multimodal tasks are escalated on demand. Do not send every request to the largest model, and do not use the smallest model to handle complex reasoning.
4. Deployment Constraints with 8 GB VRAM
Under 8 GB VRAM, whether a model can run stably depends on quantization level, context length, batch size, concurrency, and whether CPU offloading is enabled. In actual deployment, three things should be prioritized:
- Fix a quantization and context baseline. First determine an acceptable quantization level and maximum context length, then measure first-token latency and peak VRAM. Doubling the context often puts more pressure on VRAM than doubling the parameter count.
- Separate cold start from warm start. Cold-start time affects the first-open experience, while warm-start latency affects continuous-use efficiency. Daily primary models should be kept resident or prewarmed as much as possible; low-frequency large models can be loaded on demand, with timeouts and fallback strategies.
- Limit long outputs. Long outputs amplify latency and VRAM usage. Set maximum output lengths for tasks such as summarization, title generation, and classification; for long documents, use segmented summarization followed by aggregation instead of generating extremely long text in one pass.
A practical routing pseudocode example is as follows:
TASK_ROUTE = {"long_text_reasoning": "text-8b-general","classify": "text-4b-light","title": "text-4b-light","short_rewrite": "text-4b-light","screenshot_qa": "vision-small-efficient","chart_explain": "vision-small-efficient","complex_visual_detail": "vision-12b-detailed",}def route(task):if task.has_image and task.needs_detail:return TASK_ROUTE["complex_visual_detail"]if task.has_image:return TASK_ROUTE["screenshot_qa"]if task.type in ("classify", "title", "short_rewrite"):return TASK_ROUTE["classify"]return TASK_ROUTE["long_text_reasoning"]
This pseudocode expresses an engineering principle: route first by task type and input modality, then escalate models based on quality requirements. Model identifiers should be replaced with the team’s actual internal configuration and should not be hard-coded in business logic.
5. Default Templates and Prompt Engineering
Small models are more sensitive to default templates. Chat templates, system prompt positions, role markers, stop tokens, and tool-calling formats differ across models. Applying the same prompt directly can easily lead to format drift, output truncation, repeated generation, or structured result parsing failures. Before launch, run a template checklist:
- Is the system prompt correctly placed in the corresponding role?
- Are stop tokens consistent with the inference runtime?
- Will the maximum context truncate key information in long-document scenarios?
- Does structured output have validation and retries?
- Do classification, title, and rewriting tasks limit output length and format?
- Does multimodal input have resolution, chunking, and OCR preprocessing?
It is recommended to maintain separate prompt templates for each task type and run regressions with a fixed test set. After template changes, re-measure Chinese stability, format-following rate, and failure rate instead of only checking a single example.
6. Layered Processing for Multimodal Tasks
Small multimodal models are suitable for quick assistance, not for pursuing fine-grained descriptions in every visual task. Screenshot QA, chart trend explanation, and UI element localization can prioritize efficient small multimodal models. When more complete relationship descriptions, complex chart details, or long-image understanding are required, escalate to a 12B-class multimodal model. Preprocessing is equally important: chunking long screenshots, extracting structured data from charts first, and enhancing low-quality images first are often more effective than simply switching to a larger model.
7. Cloud-Edge Collaboration and Cost Control
Local inference is suitable for high-frequency, lightweight, and privacy-sensitive tasks. The cloud is suitable for low-frequency heavy tasks, burst concurrency, and scenarios that require elastic scaling. When elastic scaling is needed, low-frequency heavy tasks can be placed in cloud capabilities such as a general-purpose container platform, object storage, logging, and monitoring/alerting. Teams using Baidu AI Cloud can use these capabilities to form a layered setup with local inference. This retains the advantage of local warm start while avoiding long-term occupation of development machine resources for occasional peaks.
8. Pre-Launch Evaluation Method
It is recommended to use a fixed gold set for regression, covering Chinese Q&A, classification, titles, short rewriting, screenshot QA, chart explanation, and long outputs. Record accuracy, format-following rate, first-token latency, total time, peak VRAM, and failure types for each task. After launch, monitor timeout rate, fallback rate, retry rate, and user feedback. The final model selection should be based on the team’s actual tests: an 8B-class general text model as the primary text model, a 4B-class lightweight model for pipeline nodes, an efficient small multimodal model for daily image assistance, and a 12B-class multimodal model for complex visual tasks on demand. This combination is usually more stable, more economical, and easier to maintain than choosing a single strongest model.
