Local Deployment and Model Selection Practices for Small-to-Medium Open-Source LLMs

    As open-source large language models (LLMs) with small-to-medium parameter sizes (4B to 12B) become increasingly popular for local AI development, balancing model capability, inference speed, and resource consumption on limited hardware is crucial. This article explores the deployment baselines, model selection strategies, and performance benchmarks for running these models in environments with restricted resources, such as 8GB VRAM consumer GPUs. It also discusses hybrid cloud architectures for scaling compute when local resources peak.

    With the rapid iteration of large language model (LLM) technology, small-to-medium parameter open-source models (4B to 12B) have gradually become the preferred choice for individual developers and small teams building AI capabilities in local environments. However, under restricted hardware conditions—such as consumer-grade mobile GPUs with 8GB of VRAM—balancing model capability, inference speed, and resource consumption is the key to determining whether a local toolchain can truly be put into daily production. This article explores the deployment baselines, selection strategies, and performance of such models in resource-constrained environments from a general technical perspective, independent of specific brands.

    I. Local Deployment Environment and Baseline Construction

    Deploying LLMs with limited hardware resources requires setting up an efficient local inference framework. Taking a common development machine configuration as an example, an architecture combining a host machine with a Linux subsystem is typically adopted.

    1. Hardware and System Layer: A typical test environment includes 64GB of host RAM, with 32GB allocated to the Linux subsystem. The GPU is a mobile device with 8GB of VRAM. In this environment, the system must correctly recognize the GPU device so that the inference engine can invoke its compute power.
    2. Inference Engine Selection: To ensure compatibility and ease of use, mainstream local model runtime frameworks are generally used to pull and manage model files. For the underlying inference engine, a CPU build can be used initially for baseline testing, followed by an accelerated version optimized for a specific GPU architecture. It is worth noting that the presence of underlying compilation toolchains (such as the CUDA Toolkit) does not directly affect the inference functionality of certain wrapper frameworks, but it will impact the process of developers compiling customized inference engines themselves.

    II. Model Selection Strategies for Core Scenarios

    Blindly pursuing large parameter sizes for different business requirements is unwise. Below are selection recommendations for four typical parameter scales in specific scenarios:

    1. Daily Text Processing Mainstay: 8B Parameter Text Models

    If the goal is to retain an interactive text model for daily use, 8B-level models are often the most cost-effective choice. These models offer relatively stable Chinese output and have an acceptable resource footprint on 8GB VRAM devices. After a hot start, their response speed is sufficient for daily tasks such as code completion, long-text summarization, and email drafting. During deployment, by reasonably configuring the context window size, the VRAM usage can be kept around 5GB, leaving enough space to ensure the stable operation of the system’s graphical interface and other processes.

    2. Lightweight Pipeline Node: 4B Parameter Text Models

    When building complex AI application pipelines, lightweight tasks such as intent recognition, title generation, and short-text rewriting are often required. Here, 4B-level pure text models demonstrate high resource efficiency. Due to their small size, not only is the cold start fast, but the VRAM usage during hot runtime is typically less than 3GB. These models are not suitable for deep logical reasoning, but as backend microservice nodes running silently, they can provide a stable high throughput rate, significantly lowering the resource threshold of the overall architecture.

    3. Multimodal Visual Understanding: 4B Parameter Multimodal Models

    When business requires image recognition, screenshot parsing, or chart explanation, lightweight multimodal models often perform beyond expectations. Despite their small parameter size, their inference speed on 8GB VRAM devices is highly impressive. Such models can maintain extremely high generation speeds during hot runtime, and the image understanding results already possess practical value for assisting decision-making, making them the preferred cost-effective choice for local multimodal tasks.

    4. High-Precision Visual Reasoning: 12B Parameter Multimodal Models

    For complex visual understanding tasks requiring highly detailed descriptions, 12B-level multimodal models can provide more delicate outputs. However, this comes at the cost of performance degradation: their cold start is noticeably slow, and long-text generation can easily test user patience. Therefore, this type of model is more suitable as an “on-demand” backup force to handle occasional high-difficulty image analysis, rather than being triggered in every request as a default API.

    III. Performance Benchmark and Resource Consumption Analysis

    Conducting an initial usability test on the aforementioned models within the same runtime environment can intuitively reflect their real-world performance under resource constraints. The following data are not rigorous laboratory benchmarks but rather usability-oriented practical records:

    • 4B Text Model: Local size ~2.5GB, cold start load ~12.3s, hot start load only 0.13 to 0.16s. Generation speed reaches 38-43 tok/s, with hot runtime VRAM usage at ~2.7GB. Overall performance is “fast and economical,” suitable for light tasks.
    • 8B Text Model: Local size ~5.2GB, cold start ~16.8s, hot start ~0.23s. Generation speed ~22-26 tok/s, hot runtime VRAM ~4.9GB. Performance is “stable and heavy,” suitable as the daily Chinese text mainstay.
    • 4B Multimodal Model: Local size ~9.6GB (including vision encoder), cold start ~14.4s, hot start 0.66 to 0.72s. Generation speed up to 54-56 tok/s, hot runtime VRAM ~3.1GB. Performance offers “high visual cost-effectiveness.”

    Several key engineering conclusions can be drawn from the data:

    1. Significant Difference Between Cold and Hot Starts: The initial loading of a model requires reading from disk to memory and VRAM, with the time consumed limited by disk I/O. In actual engineering, a heartbeat keep-alive mechanism should be used to keep the model resident in memory, avoiding frequent cold starts.
    2. Specifics of Multimodal Models: Although multimodal models have a larger total size, because their language model component is relatively small, the generation speed during the pure text decoding phase may actually be higher than that of larger pure text models.
    3. Breaking the VRAM Bottleneck: When hot runtime VRAM approaches the hardware limit, the system triggers swapping between VRAM and system memory (Offloading), which leads to a cliff-drop in generation speed. The context length must be strictly limited.

    IV. Engineering Extension and Cloud Collaboration Recommendations

    When the compute or capacity of a local 8GB VRAM device cannot meet business peak demands, introducing a cloud-native architecture for elastic scaling is an inevitable choice. In this regard, a hybrid deployment architecture can be constructed leveraging the general compute capabilities of Baidu AI Cloud:

    1. Elastic Inference Containers: Encapsulate heavy-load models (such as 12B multimodal) in containers and deploy them on a cloud GPU container service platform. When local compute is insufficient or complex inference tasks are encountered, route requests to the cloud via an API gateway to achieve on-demand elastic scaling.
    2. Object Storage and Model Distribution: Large model files can easily reach several gigabytes. Object storage services (BOS) can be utilized to centrally manage model weights of different versions. Local development machines or edge nodes pull models through high-speed intranet channels, ensuring version consistency and reducing distribution latency.
    3. Monitoring and Log Analysis: During the hybrid scheduling of local and cloud resources, use log services and monitoring/alerting components to collect metrics such as inference duration, VRAM peaks, and concurrency queues, providing data support for subsequent optimization.

    V. Conclusion

    Selecting LLMs in resource-constrained local environments hinges on “scenario matching” and “resource restraint.” 4B models focus on lightweight, high-frequency tasks; 8B models stabilize daily text interactions; 4B multimodal models balance efficiency and vision; and 12B multimodal models serve as high-precision backups. Through reasonable local framework configuration, cold and hot start management, and by leveraging the cloud-native general capabilities of Baidu AI Cloud for compute overflow when necessary, developers can fully build an efficient, stable, and economical LLM application toolchain.