Running Ultra-Large Parameter Models Locally: Quantization, Memory, and Inference Practices
This article explores the practical aspects of running ultra-large parameter models, such as Mixture of Experts (MoE) models with 744 billion total and 40 billion active parameters, on local workstations. It covers the differences between total and active parameters, the impact of KV Cache on memory, and the core role of low-bit quantization (ranging from 1-bit to 8-bit). Additionally, it provides guidelines for hardware evaluation (memory capacity, bandwidth, storage), general deployment workflows, inference parameter tuning, and security practices to help developers balance output quality, generation speed, and resource constraints.
As the scale of open models continues to expand, models with tens or even hundreds of billions of parameters are no longer restricted to centralized data centers. Thanks to Mixture of Experts (MoE) architecture, low-bit quantization, and memory offloading technologies, some ultra-large models can now be run on local workstations. However, “being able to run locally” does not equate to “running smoothly on an average PC.” The actual deployment outcome is typically determined not by whether the model file can be downloaded, but by memory capacity, bandwidth, storage space, inference framework compatibility, and context length matching.
This article uses a MoE model with approximately 744 billion total parameters, 40 billion active parameters per inference, and a million-level context window as an example to introduce key issues to consider during local deployment. It is not tied to any specific vendor, model platform, or software brand; the commands provided are solely for illustrating the general deployment process.
1. Distinguish Between “Total Parameters” and “Active Parameters”
Ultra-large models typically adopt the MoE architecture. Although the model saves hundreds of billions of total parameters, it does not invoke all parameters when processing a single token. Instead, it uses a routing mechanism to select a subset of experts for computation.
Therefore, it is necessary to distinguish between two concepts:
- Total Parameters: The full scale of parameters included in the model’s weight files, primarily affecting disk usage and the memory required for full loading.
- Active Parameters: The scale of parameters actually involved in computation during a single inference process, primarily affecting computational load and generation speed.
Take a model with 744 billion total parameters and about 40 billion active parameters as an example. Its computational cost may be close to that of a tens-of-billions parameter model, but its weight storage still faces the massive space demands brought by hundreds of billions of parameters. In other words, the MoE architecture reduces single-inference computational pressure but does not entirely eliminate model loading and storage pressure.
Furthermore, a million-level context window significantly increases the Key-Value (KV) Cache. Even if the model weights fit into memory, the cache can become a new memory bottleneck as the context grows. Therefore, during actual deployment, you must not only consider the model file size but also reserve space for runtime cache, system processes, and the inference framework.
2. Quantization is the Core Technology for Local Deployment
The basic idea of quantization is to represent model weights with lower-bit data, thereby reducing storage space and memory usage. Common precisions include 1-bit, 2-bit, 4-bit, 8-bit, and higher-precision formats.
In test data for this type of ultra-large model, the following resource references can be obtained:
| Quantization Version | Approximate File Size | Recommended Total Memory | Relative to Original Size |
|---|---|---|---|
| 1-bit | 217 GB | 223 GB+ | Reduced by ~86% |
| 2-bit | 239 GB | 245 GB+ | Reduced by ~84% |
| 4-bit | Several hundred GB | 372–475 GB | Depends on specific format |
| 8-bit | ~810 GB | 810 GB+ | High usage |
The “total memory” here can be understood as the sum of system memory and VRAM; if the device uses a unified memory architecture, refer directly to the unified memory capacity. The model file size does not equal the actual runtime requirement. During loading, you must also consider indexing, temporary buffers, runtime cache, and OS usage. Therefore, it is not recommended to configure the device based on the assumption that “file size exactly equals memory capacity.”
1. 1-bit Quantization
The advantage of the 1-bit version is its minimal size, which has relatively low memory requirements, making it suitable for scenarios where resources are extremely limited but users still want to try ultra-large models. The downside is more noticeable precision loss, especially in mathematical reasoning, code generation, long-text consistency, and complex factual Q&A, which may result in a higher probability of errors.
Test results show that the Top-1 accuracy of the 1-bit version is approximately 76.2%. This value should only be used as a general trend reference and cannot be directly equated to actual accuracy across all tasks. For tasks like chitchat, summarization, and simple information extraction, low-bit quantization may still be usable; for rigorous reasoning tasks, careful evaluation is required.
2. 2-bit Quantization
The 2-bit version is usually a more realistic compromise between resource usage and output quality. Its model file is about 239 GB, and it is recommended to prepare at least 245 GB of available total memory. For a workstation with 256 GB of unified memory, it can theoretically run, but it requires closing unnecessary background programs and appropriately limiting the context length.
If the device only has a compute card with about 24 GB of VRAM, a “VRAM plus system memory” offloading method can be adopted: placing some computation and weights in VRAM while keeping the rest in system memory. In this case, performance will be affected by memory bandwidth and data exchange speed, and the generation speed is usually significantly lower than a solution fully placed in high-bandwidth VRAM.
3. 4-bit and Above Quantization
The distribution differences in 4-bit and 5-bit versions are usually closer to the original model, and the KLD metrics in some evaluations are already near lossless, making them suitable for scenarios with higher requirements for output stability and task accuracy. However, the trade-off is a significant increase in memory demand, which is difficult for an ordinary single machine to meet.
Although the 8-bit version has more robust precision performance, the model file may approach or exceed 800 GB. Unless using a large-memory server, multi-card equipment, or specialized memory expansion solutions, it is not suitable as the first choice for personal local deployment.
3. Hardware Evaluation: Beyond VRAM
Before deployment, it is recommended to check the following aspects.
1. Memory Capacity
First, confirm the device’s available total memory rather than the nominal capacity. For example, a machine with 256 GB of memory might only have about 240 GB of space actually available for the model after system startup. If the model itself is close to 239 GB, adding runtime overhead, the risk of startup failure is very high.
A more prudent approach is to:
- Prepare at least 256 GB of total memory for the 2-bit model;
- Reserve additional space even for the 1-bit model;
- Further increase the memory margin when using long contexts;
- Close browsers, virtual machines, and compilation tasks that consume a lot of memory.
2. Memory Bandwidth
Memory capacity determines “whether it can be loaded,” while memory bandwidth affects “how fast it runs.” When partial model weights are stored in system memory, the inference process frequently reads data. Even if capacity is sufficient, low bandwidth may result in a very limited number of tokens generated per second.
3. Storage Space
When downloading the model, reserve at least twice the size of the model file. Reasons include:
- Temporary files may be needed during the download process;
- Intermediate files are generated during decompression or conversion;
- Different quantization versions may be retained simultaneously;
- Logs, caches, and session data will also occupy space.
For a 239 GB quantized file, it is recommended to prepare at least 500 GB of high-speed solid-state storage and avoid using storage devices with insufficient space or low read/write performance.
4. Compute Devices and Offloading Strategies
If you have a compute card, you can place some layers in VRAM and the remaining layers in system memory. The larger the VRAM, the more beneficial it usually is for reducing data exchange overhead. However, for models at the scale of hundreds of GB, a single compute card cannot fully accommodate them; you must use layered loading, multi-card splitting, or memory offloading.
4. General Deployment Workflow
Step 1: Prepare the Environment
It is recommended to use a relatively new 64-bit operating system and prepare an inference runtime that supports low-bit weight formats. Linux, Windows-compatible environments, and desktop systems with unified memory can usually serve as the deployment foundation.
During installation, prioritize using official installation scripts or trusted package sources. The general format is as follows:
curl -fsSL <installation_script_url> | sh
In a Windows command-line environment, you can also use the corresponding script installation method:
irm <installation_script_url> | iex
Before actual operation, ensure the script source is trusted and try to execute it in an isolated environment. For enterprise devices, a security audit is recommended first; do not directly execute unverified remote scripts.
Step 2: Launch the Local Management Interface
Many inference runtimes provide a browser management interface, which can be used to select models, configure quantization versions, adjust context, and view resource status. The general startup format is as follows:
model-runtime studio --host 0.0.0.0 --port 8888
After startup, access the corresponding local port via a browser. First-time access usually requires setting an access password. If external network access is needed, use secure tunnels, access controls, identity authentication, and encrypted transmission. Do not directly expose the management port to the public internet.
Step 3: Select the Right Quantization File
In the model search interface, prioritize the following information:
- Quantization bits;
- File size;
- Whether it supports the target inference runtime;
- Whether it uses dynamic quantization;
- Whether it contains complete weights;
- Whether there is a corresponding checksum;
- Whether it is suitable for long-context operation.
For 256 GB-level unified memory devices, the 2-bit version is usually more realistic than the 4-bit version. If the device memory is smaller, first evaluate whether it is worth adopting the 1-bit version, as reducing the quantization bits reduces usage but may also bring noticeable quality degradation.
Step 4: Verify Model Functionality
After the model download is complete, do not immediately test with a million-level context. It is recommended to verify progressively in the following order:
- Use short prompts for simple Q&A;
- Test Chinese, English, and code generation;
- Gradually increase the context length;
- Observe memory usage and swapping;
- Record the tokens generated per second;
- Check for repetition, truncation, or logical drift in long texts.
If the system frequently stutters after startup, it usually indicates insufficient memory or excessive disk swapping. At this point, reduce the context length, disable thinking mode, decrease concurrent requests, or switch to a lower-usage quantization version.
5. Thinking Mode and Inference Parameters
Some inference runtimes support thinking mode. This mode generates a longer internal reasoning process before the final answer, suitable for math, code, planning, and multi-step analysis tasks, but it increases response time and token consumption.
It can generally be divided into three categories:
- Thinking Disabled: Suitable for daily Q&A, rewriting, summarization, and simple information extraction;
- High-Intensity Thinking: Suitable for tasks requiring multi-step analysis;
- Maximum-Intensity Thinking: Suitable for complex reasoning, but with higher resource consumption and latency.
In the command line, thinking mode can be disabled via template parameters:
--chat-template-kwargs '{"enable_thinking":false}'
The recommended initial parameters can be set to:
temperature: 1.0top_p: 0.95max_context: 1048576
However, a million-level context should not be enabled from the start. The longer the context, the higher the KV Cache usage, and speed may also drop. In practical applications, set the context to 8K, 16K, or 32K first, and gradually increase it after confirming stability.
6. Balancing Quality, Speed, and Resources
When deploying ultra-large models locally, you cannot solely pursue maximum precision. A more reasonable approach is to choose configurations based on the task:
- General Conversation: Prioritize 2-bit quantization and disable thinking mode;
- Code Assistance: Choose 2-bit or 4-bit and retain a longer context;
- Mathematical Reasoning: Prioritize 4-bit and enable higher thinking intensity;
- Long Document Analysis: Control concurrency and gradually increase context;
- Offline Batch Processing: Speed can be sacrificed for higher precision;
- Multi-user Shared Services: Limit context and concurrency to prevent memory from being instantly exhausted.
It should also be noted that the evaluation metrics of quantized models are only average results. Before going live, it is best to prepare a test set relevant to the actual business and compare the differences in accuracy, format adherence, factual consistency, and response speed among the 1-bit, 2-bit, and 4-bit versions.
7. Security and Operations Recommendations
Running locally does not mean inherently safe. Especially when accessing the management interface via network, you should at least:
- Set strong passwords and change them regularly;
- Do not directly expose unencrypted ports;
- Restrict accessible IP ranges;
- Check the type and size of uploaded documents;
- Clean up session logs containing sensitive information;
- Monitor memory, VRAM, disk, and system load;
- Save checksums for model files to prevent corruption or replacement.
For internal enterprise use, the applicable boundaries of model outputs should also be clarified. Low-bit quantization may cause factual errors, code defects, or unstable reasoning. Critical business processes still require manual review, result verification, and access control.
Overall, the local execution of ultra-large parameter models has moved from “theoretically feasible” to a stage with “certain practical conditions.” 2-bit quantization is currently the most easily achievable balance point, but its hardware threshold remains high; 1-bit quantization can further reduce resource requirements but requires accepting more noticeable precision loss. During deployment, evaluate memory, bandwidth, storage, and context requirements first, and then decide on the quantization version and runtime method, rather than making judgments based solely on the model file size.
