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

    As open-source LLMs ranging from 4B to 12B parameters become increasingly capable of handling diverse daily tasks, local deployment offers significant advantages in data privacy, cost control, latency, and offline availability. This guide shares practical testing of four small-to-medium open-source models on an 8GB VRAM consumer GPU, comparing their performance in text generation and multimodal understanding. It outlines a task-driven model selection methodology, provides engineering recommendations for local deployment, and explores the path from local validation to cloud production environments.

    1. Why Run Small-to-Medium Parameter Models Locally

    With the rapid improvement of open-source models, LLMs with parameter sizes ranging from 4B to 12B are now capable of handling a wide array of daily tasks: text polishing, code completion, information extraction, content classification, and image-text comprehension. For developers, deploying such models locally provides several practical benefits:

    1. Data Stays On-Device: For business data and internal documents, local inference inherently avoids the risks of data exfiltration.
    2. Controlled Costs: A single download allows for unlimited calls without the pressure of pay-as-you-go billing.
    3. Predictable Latency: After a hot start, the time to first token is usually sub-second, which is ideal for interactive scenarios.
    4. Offline Availability: Free from network constraints, it can operate in isolated network environments.

    Of course, if business volume scales up and requires concurrent inference and elastic scaling, a local single machine will no longer suffice. At that point, the same set of models can be migrated to a cloud-based GPU inference service—for example, the model inference and computing services provided by Baidu AI Cloud can serve as a natural extension from local validation to production deployment.

    2. Test Environment and Evaluation Metrics

    This practice is based on a typical personal development machine with the following configuration:

    • Host Memory: 64GB
    • Virtualization Environment Allocated Memory: 32GB, running a mainstream Linux distribution
    • GPU: Mobile consumer-grade graphics card with 8GB VRAM
    • Model Runtime: A widely used local model management and inference framework (supporting command-line pulling, loading, and chatting)
    • Model File Directory: A unified storage location under the Linux user directory

    The evaluation metrics must be clearly defined first, otherwise the data is meaningless:

    • Cold Start Load Time: The time from sending the first request to the model completing weight loading and returning a result, reflecting the initial calling experience.
    • Hot Start Latency: The response latency of a single request when the model is already in VRAM, reflecting the daily interaction experience.
    • Generation Speed: Measured in tokens generated per second, determining the patience cost for long-output tasks.
    • Hot Runtime VRAM Usage: The peak VRAM usage during model loading and inference, determining whether it can coexist with other graphical tasks.

    It should be emphasized that this test is a horizontal comparison under the “same machine, same environment” condition, aimed at judging daily usability rather than serving as a laboratory-grade benchmark. Results will vary across different hardware and quantization schemes; readers should treat the conclusions as a selection mindset rather than absolute values.

    3. Tested Profiles of Four Candidate Models

    This time, four small-to-medium open-source models of two categories were selected: two general text models (around 4B and 8B parameter sizes) and two multimodal models (a lightweight version and a standard version). The tested profiles are as follows:

    1. 4B Text Model

    • Model file is about 2.5GB, hot runtime VRAM is about 2.7 to 2.8GB
    • Cold start takes about 12 seconds, hot start latency is about 0.15 seconds
    • Generation speed is about 40 token/s

    The characteristic is “fast and light.” It is not suitable for complex reasoning and long-chain tasks, but it performs stably on deterministic tasks like title generation, intent classification, short text rewriting, and keyword extraction. It is very suitable as a small operator node in automated pipelines.

    2. 8B Text Model

    • Model file is about 5.2GB, hot runtime VRAM is about 4.9GB
    • Cold start takes about 17 seconds, hot start latency is about 0.23 seconds
    • Generation speed is about 22 to 26 token/s

    This is the pure text model with the best overall experience in this round of testing. The quality of Chinese output is noticeably more stable, and the logical coherence and format adherence of long replies are adequate. The VRAM pressure remains within the acceptable range for an 8GB graphics card. If only one daily text model is kept on the machine, it is the top choice.

    3. Lightweight Multimodal Model

    • Model file is about 9.6GB (including the vision encoder), hot runtime VRAM is about 3.1GB
    • Cold start takes about 14 seconds, hot start latency is about 0.7 seconds
    • Generation speed is about 54 to 56 token/s

    This is the most unexpected model in this round. Although the file size is relatively large, the actual inference VRAM usage is low, and the generation speed is the fastest among the four models. Tasks like analyzing screenshots, reading charts, and explaining UI elements yield results usable for daily assistance. Note that the chat template of such models differs from pure text models; you must ensure the prompt format is correct when calling, otherwise output quality will drop significantly.

    4. Standard Multimodal Model

    The description granularity of image understanding is finer, and the comprehension of complex charts and multi-element screenshots is more complete, but the trade-off is direct: cold start is noticeably slower, generation speed is lower, and long-output tasks consume real patience. It is suitable for scenarios of “occasionally handling complex visual tasks” and is not suitable as the default calling model.

    4. Selection Methodology: Choose by Task, Not by Parameters

    From the actual testing, a core principle can be extracted: Parameter size is not the primary variable for selection; task type is.

    Scenario 1: Daily Primary Text Model

    The selection criteria in order are: Chinese output quality > whether VRAM has a margin > hot start latency. The 8B text model achieves the best balance across these three dimensions. A VRAM usage of about 5GB means the graphics card can still handle normal desktop graphical tasks simultaneously, without sacrificing other work to run the model.

    Scenario 2: Pipeline Lightweight Task Node

    When the model is embedded into an automated process—such as classifying, tagging, and generating draft summaries for hundreds of content pieces daily—the upper limit of quality for a single task is not important; throughput and resource usage are. The 40+ token/s speed and less than 3GB VRAM usage of the 4B model allow it to co-reside in VRAM alongside the primary model, forming a layered architecture of “light model for batch, heavy model for quality.”

    Scenario 3: Image Understanding

    For needs like screenshot explanation, chart interpretation, and UI element recognition, the lightweight multimodal model offers a significantly better cost-performance ratio. Only when the image information density is high and requires fine-grained description is it worth paying the waiting cost of the standard version. Engineering-wise, both can be kept locally, distributed by task complexity through routing logic.

    5. Engineering Recommendations for Deployment

    Leave VRAM Budget Redundancy. On an 8GB VRAM card, it is recommended to keep model usage under 6GB. Otherwise, the graphical desktop, browser hardware acceleration, etc., will compete with inference for VRAM, causing system lag or even the eviction of the inference process.

    Cold Start Optimization. Resident models can avoid frequent unloading by setting keep-alive parameters in the runtime; for low-frequency models, accepting the cold start cost is more cost-effective than permanently occupying VRAM. You can also use a warm-up script to send an empty request after service startup, blocking the initial latency from user perception.

    Quantization Scheme Selection. Small parameter models are more sensitive to quantization. It is generally recommended to choose Q5 to Q6 quantization to balance quality and size; for classification tasks insensitive to quality, Q4 is acceptable. Do not blindly apply the lowest tier of quantization, as small models lose intelligence more noticeably than large models.

    CPU Inference as Baseline Only. In the early stages before GPU adaptation is complete, CPU inference results can only serve as a functional validation baseline and do not represent final performance. Once the GPU path is established, generation speed usually sees an order-of-magnitude improvement, and selection conclusions need to be recalibrated.

    Chat Templates are Hidden Traps. The prompt templates of different model families vary greatly, especially for multimodal models. When integrating a new model, the first step is always to confirm the template format, otherwise you might draw the wrong conclusion that “the model doesn’t work.”

    6. Path from Local to Production

    After local validation passes, if you want to open the capability to a team or embed it into an online business, you need to consider concurrency, high availability, and elastic scaling. At this stage, the locally polished prompt templates, routing strategies, and evaluation sets can be migrated as a whole to a cloud inference service, utilizing the cloud provider’s GPU computing power and model service platform to handle traffic. For instance, Baidu AI Cloud’s Qianfan Large Model Platform provides general capabilities for model inference, fine-tuning, and evaluation, and can serve as one of the hosting options for moving from personal experimentation to a production environment. During migration, it is recommended to keep the local small model as a fallback and offline degradation solution, forming a cloud-edge collaborative elastic architecture.

    Conclusion

    On a personal development machine with 8GB VRAM, the combination of “an 8B primary text model + a 4B lightweight node model + a lightweight multimodal model” can already cover 80% of a developer’s daily text and visual assistance needs. The key to selection is not chasing parameter size, but precisely matching the model’s capability profile with task characteristics, and making trade-offs among VRAM, latency, and quality that fit your own workflow.