Enterprise Intranet LLM Local Deployment: A Complete Guide
This guide walks through the full process of deploying open-source large language models on-premises within an enterprise intranet, with a focus on keeping inference services stable enough for day-to-day engineering use. It covers hardware planning, environment checks, model preparation, deploying the inference engine through a visual management panel, launch parameter breakdowns, service verification, performance monitoring, and troubleshooting. Key parameters such as GPU memory budget, context length, tensor parallelism, and batch scheduling are explained in terms of how they affect service stability, along with practical configuration recommendations.
Enterprise Intranet LLM Local Deployment: A Complete Guide
Introduction: The Goal Is Sustainable Use, Not Just Getting It to Start
When deploying a large language model on an enterprise intranet, the core objective is not simply to get an open-source model running. It is to make the model’s inference service reliably support an engineering team’s daily work. This is especially true for AI coding assistant scenarios: code completion, code explanation, unit test generation, and API documentation all depend on keeping both the model and the code inside the enterprise network. Model weights, inference processes, and service endpoints must all run within a controllable data boundary to satisfy compliance, isolation, and development efficiency requirements.
Using a GPU server running an open-source, high-performance inference engine as the example, this article walks through the complete process of localizing large model deployment on an enterprise intranet, including hardware selection, environment checks, model preparation, visual panel configuration, launch parameter analysis, service verification, performance monitoring, and common troubleshooting. It focuses on how key parameters—GPU memory budget, context length, tensor parallelism, and batch scheduling—affect service stability, and offers practical configuration recommendations.
1. Before Deploying on the Intranet: Clarify Requirements and Hardware Resources
1.1 Where Does the Value of On-Premises Deployment Lie?
Deploying a large model on an enterprise intranet typically delivers value in several areas:
- Data control: Source code, requirement documents, logs, and API descriptions move only between internal services and development tools, without depending on external networks.
- Offline availability: Development networks are often isolated from the internet, and a local inference service can be deployed alongside the intranet environment.
- Customization: Through system prompts, model fine-tuning, and retrieval augmentation from a knowledge base, outputs can be made to align more closely with the enterprise’s tech stack and coding standards.
- Predictable cost: Once GPU resources are planned centrally by the enterprise, the cost model shifts from “pay per call” to “plan by resource capacity.”
1.2 The Overall Architecture Has Five Layers
An enterprise intranet LLM inference service can generally be divided into five layers:
- Compute layer: GPU servers provide compute power and GPU memory resources.
- Driver layer: The GPU driver and compute runtime manage the hardware and provide device access to containers.
- Container layer: The container runtime mounts GPUs to inference containers through a device plugin.
- Service layer: The inference engine or visual management panel creates and manages inference instances and exposes HTTP interfaces.
- Application layer: AI coding plugins, code Q&A tools, and internal knowledge base tools call the model through a unified interface.
The inference engine is critical because it typically provides two important mechanisms:
- Paged attention: Inspired by the virtual memory concept in operating systems, it splits the key-value (KV) cache into fixed-size blocks that are allocated on demand, reducing GPU memory fragmentation and improving concurrent throughput.
- Continuous batching: On each decode iteration, it dynamically admits new requests and evicts completed ones, avoiding the situation where new requests must wait for an entire batch to finish.
Combined, these two mechanisms allow a single GPU server to potentially support the concurrent requests of a whole engineering team.
1.3 Environment Planning: Confirm GPU Memory First, Then Everything Else
When planning the environment, prioritize checking the number of GPUs, per-card GPU memory, and memory bandwidth. The reference baseline is as follows:
| Category | Requirement | Notes |
|---|---|---|
| GPU | 4 identical accelerator cards, no less than 24 GB per card, at least 96 GB total GPU memory recommended | Cards must be the same model; otherwise, after tensor-parallel sharding, the load will be uneven |
| GPU and system memory | At least 24 GB per card; system memory should be no less than total GPU memory | Insufficient memory can cause model weight loading to fail |
| CPU and disk | At least 16 physical cores; at least 3x the model size in free space on local NVMe SSD | Used for weights, container images, and cache respectively |
| OS | A mainstream enterprise Linux distribution | Long-term support releases recommended; kernel 5.x or newer |
| Container runtime | Container runtime with GPU container support components | Used to mount GPU devices into unprivileged containers |
| GPU driver | A stable driver release from the compute platform vendor | Must be compatible with the compute runtime bundled in the inference image |
Note that if total GPU memory is only 48 GB but you use four 24 GB cards, the actual total GPU memory is close to 96 GB. If resources are only at the 48 GB level, you should reduce the concurrency scale, shorten the context length, or choose a model with fewer parameters. The baseline above is for reference only; the actual figures should be based on the target model’s compute precision, context length, and concurrency scale.
2. Pre-Deployment Checks: Are the Driver, Containers, and Offline Resources Ready?
2.1 Check GPU Driver Status
First, run:
nvidia-smi
Normal output should include:
- GPU model and driver version;
- The bundled compute runtime version;
- Each card’s total GPU memory, used memory, temperature, and power status.
Confirm the following:
- All GPUs are recognized;
- There are no dropped cards, ECC errors, or abnormal temperatures;
- The driver version meets the inference image’s requirements.
2.2 Verify That Containers Can Access the GPU
A working GPU driver does not guarantee that containers can use the GPU. You also need to confirm that the container GPU support components are installed correctly. Test with a lightweight image:
docker run --rm --gpus all <gpu-runtime-base-image:tag> nvidia-smi
If the output inside the container matches the native command, the device mounting and driver injection chain are working correctly. If it reports a missing command or cannot access the device, check the following in order:
- Whether the container runtime is configured with GPU support;
- Whether the device plugin is installed;
- Whether the device is blocked by resource limits or scheduling policies.
2.3 Prepare Offline Resources
Intranet environments usually cannot access the public internet directly, so you need to download resources in a connected environment and then copy them to the intranet servers:
- Model weights: Download from a public model repository, or distribute them through an internal mirror repository or object storage;
- Inference image: Export it to an image archive in a connected environment, then import it into the internal container image registry;
- Dependencies: If the model directory contains custom inference code, it needs to be imported as well.
2.4 Model Directory Structure and Verification
It is recommended to create a dedicated directory for the model and map it into the container through a mount, so that data is not lost when the container is recreated:
/opt/models/└── <model-name>/├── config.json├── generation_config.json├── tokenizer.json├── tokenizer_config.json└── model-0000x-of-0000y.safetensors
The role of each file is as follows:
config.json: Defines the network structure, number of layers, number of attention heads, vocabulary size, maximum context length, and so on;tokenizer*.json: The tokenizer and its configuration, which determine how text maps to tokens;*.safetensors: Sharded weight files, usually in a zero-copy format for faster and safer loading;generation_config.json: Default generation parameters such as temperature, top-p sampling probability, and stop markers.
After downloading or copying, it is recommended to verify the file count, the continuity of shard numbering, and the official checksum values. You can use sha256sum to verify key files:
sha256sum /opt/models/<model-name>/model-0000x-of-0000y.safetensors
If files are truncated, shards are missing, or checksums do not match, model loading may fail.
3. Deploying the Inference Engine Through a Visual Panel
3.1 Enter the Deployment Portal
In the visual management panel, go to AI → Models, switch to the inference engine tab, and click [Create] to enter the instance configuration form.
The panel’s role is to encapsulate complex container orchestration actions into form operations, such as:
- Automatically pulling images;
- Mapping ports;
- Mounting the model directory;
- Allocating GPU devices;
- Assembling the launch command;
- Viewing logs, resource usage, and starting, stopping, and restarting instances.
For teams lacking container orchestration experience, the visual panel significantly lowers the deployment barrier.
3.2 Key Form Configuration Points
| Configuration Item | Example Value | Notes |
|---|---|---|
| Instance name | local- |
For identification only; does not affect calls |
| Number of GPUs | 4 | Must match --tensor-parallel-size |
| Model mount directory | /opt/models/<model-name> → /models/<model-name> |
Host path mapped to a container path |
| Port mapping | 8000:8000 |
The host port must not conflict with the panel or other services |
| Launch parameters | See the launch command below | Enter all parameters except --model and --port |
| Auto-restart | Enabled | Automatically restarts the process if it exits abnormally |
3.3 Complete Launch Command Example
--model /models/<model-name> \--served-model-name <model-name> \--port 8000 \--quantization fp8 \--gpu-memory-util 0.9 \--max-num-batched-tokens 8192 \--max-model-len 65536 \--block-size 64 \--dtype float16 \--enforce-eager \--trust-remote-code \--disable-log-requests \--enable-prefix-caching \--enable-prompt-tokens-details \--enable-auto-tool-choice \--tool-call-parser <parser-name> \--tensor-parallel-size 4
Replace <model-name> and <parser-name> with the actual model. In the example, --max-model-len 65536 is a relatively conservative setting. Even if the model natively supports a 262144 context, it is not recommended to copy that value directly under all hardware conditions, because a long context significantly increases KV cache usage. If a 256K context is truly required, you should add more GPUs, reduce the concurrency scale, or re-evaluate the precision and GPU memory budget.
3.4 How Should You Fill In the Model Path and Name?
--model /models/<model-name>: The model directory the inference engine loads. The container path must match the mount point. An incorrect path is one of the most common causes of deployment failure.--served-model-name <model-name>: The name the model is exposed under. Themodelfield in the client request body must match this, or the service will return that the model does not exist.--port 8000: The port the service listens on.
3.5 How Do You Choose Precision and Hardware Configuration?
--quantization fp8: Specifies the weight quantization precision.- Compared with FP16/BF16, FP8 reduces weight usage and is suitable for GPU memory-constrained scenarios;
- Whether FP8 can be used depends on whether the GPU natively supports FP8 compute. Hardware that does not support it should switch to INT8 or another available quantization scheme;
- After quantization, you should combine this with a precision evaluation to confirm whether code completion quality meets business requirements.
--dtype float16: The data type for non-quantized compute.- If the hardware and model favor BF16, you can change it to
bfloat16; - The specific value should match the model version, inference engine version, and GPU architecture.
- If the hardware and model favor BF16, you can change it to
--tensor-parallel-size 4: The tensor parallelism degree, indicating that the computation of each model layer is split across 4 cards to run cooperatively.- This value must divide the model’s number of attention heads, and usually needs to match the model’s structure such as the number of layers and KV heads;
- This value cannot exceed the number of physical GPUs;
- Multi-card tensor parallelism typically relies on multiple processes or a distributed executor, so it cannot simply be understood as “tensor parallelism across 4 cards still working after disabling multiple processes.” If you want to reduce inter-process communication overhead, you should prioritize single-card deployment, lowering the tensor parallelism degree, or optimizing inter-card interconnect, rather than mistaking
--enforce-eagerfor a multi-process switch.
3.6 How Do You Estimate GPU Memory and Context Length?
Two key parameters are:
--gpu-memory-util 0.9: The upper limit of the GPU memory ratio the inference engine can occupy. On startup, the engine reserves GPU memory at this ratio for weight loading and the KV cache pool. When an instance exclusively owns a GPU, it can generally be set to 0.85–0.95; if sharing GPU memory with other processes, it should be lowered accordingly.--max-model-len 65536: The maximum context length for a single request, i.e., the token limit for the prompt plus generated content. It cannot exceed the model’s native supported length. If the model supports longer context through positional encoding extrapolation, refer to the solution published by the model provider.
GPU memory usage can be roughly estimated as:
- Weight memory ≈ number of parameters × bytes per parameter;
- Per-request KV cache ≈ 2 × number of layers × number of KV heads × head dimension × bytes per element × sequence length.
For example, a model with 80 layers, 8 KV heads, head dimension 128, and a KV cache stored in FP16 uses about 320 KB per token. A 32K context needs about 10 GB, 64K about 20 GB, and 128K about 40 GB. This shows that long contexts consume GPU memory rapidly. In a scenario with 4×24 GB GPUs, it is not recommended to max out the context to 256K without load testing; instead, set it to 32K or 64K first, then adjust gradually based on concurrency and remaining GPU memory.
3.7 How Should You Set Scheduling and Caching Parameters?
--max-num-batched-tokens 8192: The maximum total number of tokens processed in a single iteration, applying to prefill and decode batching.- A larger value may reduce first-token latency for long requests, but increases the compute load of a single iteration;
- A smaller value may reduce throughput, and long requests are more likely to be split;
- Common values range from 8192 to 32768. Before increasing it, confirm that GPU memory can support more concurrent sequences.
--block-size 64: The number of tokens contained in each KV cache block in the paged attention mechanism.- Larger blocks mean lower metadata management overhead;
- Smaller blocks mean finer GPU memory utilization;
- 64 suits long-context, large-batch scenarios, but can be adjusted based on the model structure and load test results.
--enable-prefix-caching: Prefix caching. The system reuses identical prefixes shared across different requests, such as system prompts, project coding standards, and code repository descriptions. Shared prefixes are common in AI coding scenarios, and enabling this usually reduces redundant computation.
3.8 How Do You Understand Run Mode and Executor?
--enforce-eager: Forces eager execution mode, i.e., disables CUDA graph capture.- CUDA graph capture can freeze a sequence of GPU computations into a reusable execution graph, reducing kernel launch overhead and usually benefiting decode performance;
- However, graph capture requires additional GPU memory and longer initialization time;
- If GPU memory is tight, startup fails, or certain custom operators do not support graph capture, you can keep this parameter;
- If resources are ample and you want higher decode throughput, you can remove this parameter to let the engine use graph capture.
A special clarification is needed: --enforce-eager is not a switch that disables multi-process execution. For tensor parallelism, especially --tensor-parallel-size 4, the inference engine typically requires multiple workers or a distributed executor to work together. Do not try to use --enforce-eager to disable multiple processes as a solution. If performance is insufficient, investigate from the angles of GPU memory, batching, graph capture, inter-card communication, and concurrency strategy.
3.9 How Should You Handle Security and Observability Parameters?
--trust-remote-code: Allows execution of custom code bundled in the model directory.- Some open-source models depend on custom operators or modeling logic, and not enabling this may cause loading to fail;
- This parameter executes code in the model directory, which poses security risks, and is only suitable for intranet environments with trusted model sources and verified files;
- Before upgrading the model or changing the model directory, it is recommended to back up the old weights first and record the version number and checksum.
--disable-log-requests: Disables per-request logging. AI coding scenarios have high request volumes, and fully recording requests and responses would generate enormous logs and performance overhead. After disabling this, you should still rely on engine metrics, monitoring alerts, and access auditing for observability.--enable-prompt-tokens-details: Returns input token detail statistics in the response, making it easier to analyze prompt composition, prefix cache hits, and context truncation effects.--enable-auto-tool-choice+--tool-call-parser <parser-name>: Enables automatic tool-call parsing for the model. The parser type must match the model’s capabilities. If a plugin reports that tool calls do not work, first confirm whether the model supports tool calling and whether the parser is configured correctly.
4. After Launch, How Do You Verify the Inference Service Is Available?
4.1 Check the Startup Logs
After startup, first confirm in the panel logs:
- All model weight shards loaded successfully;
- KV cache blocks were allocated according to actual GPU memory;
- There are no errors such as insufficient GPU memory, wrong parallelism, or model structure mismatch.
If GPU memory is insufficient, first lower:
--gpu-memory-util;--max-model-len;--max-num-batched-tokens;
and, if necessary, switch to a lower-precision or smaller model.
4.2 Health Check
Once the health check endpoint returns 200 OK, the service is usually ready.
4.3 Call the Inference Endpoint
You can send a test request using /v1/chat/completions, which is compatible with the mainstream chat interface specification:
curl http://127.0.0.1:8000/v1/chat/completions \-H "Content-Type: application/json" \-H "Authorization: Bearer <API_KEY>" \-d '{"model": "<model-name>","messages": [{"role": "user", "content": "Implement a thread-safe LRU cache in Python"}],"stream": false}'
<API_KEY> should be injected through an environment variable and should not be hard-coded in scripts or command history.
4.4 Verification Dimensions
It is recommended to verify at least the following metrics:
- First-token latency: Affected by prompt length, prefill strategy, and prefix cache hits;
- Decode throughput: Affected by tensor parallelism degree, precision, execution mode, and graph capture;
- Concurrency: Use an internal load testing tool to simulate multiple concurrent users and observe latency distribution;
- Resource metrics: Collect GPU utilization, GPU memory usage, request queue length, wait time, and so on.
The inference engine usually provides a Prometheus-format metrics endpoint, which can be configured for scraping in a Grafana-style monitoring system for long-term observation.
5. Common Issues: How Do You Quickly Locate the Cause of Anomalies?
| Symptom | Possible Cause | Resolution |
|---|---|---|
| Out-of-memory error at startup | GPU memory reservation ratio too high, context length too large, or batch too large | Lower --gpu-memory-util, --max-model-len, or --max-num-batched-tokens |
| Startup hangs at weight loading | Missing weight shards, corrupted files, or wrong path | Verify the mount path, shard numbering, and checksums |
| Client reports model not found | The caller’s model field does not match the exposed name |
Unify on the value specified by --served-model-name |
| Multi-card error, heads not divisible | Parallelism does not match the model’s head count | Adjust --tensor-parallel-size, or change the model parallel configuration |
| Tool calls do not work | Parsing not enabled or parser mismatch | Confirm --enable-auto-tool-choice and the parser parameter |
| Slow decoding | Graph capture not enabled, insufficient GPU memory headroom, or inter-card communication bottleneck | When resources are ample, remove --enforce-eager to enable graph capture; also check GPU utilization and batching settings |
| Unstable 4-card tensor parallelism performance | High inter-process or distributed executor communication overhead | Check inter-card interconnect, executor backend, and topology; do not treat --enforce-eager as a multi-process switch |
6. Operations and Security Recommendations: Keeping Local LLMs Stable Long-Term
- Unified entry point: Provide a single address through an internal load balancer to make horizontal scaling of multiple instances easier.
- Traffic separation by team: Completion requests are latency-sensitive with short inputs, while long-document analysis requests have long contexts and take longer. It is recommended to configure different context limits or separate instances for these two scenarios to avoid resource contention.
- Security boundary: Have the inference service listen only on internal addresses, connect to unified identity authentication through a reverse proxy, enable access authentication, bring call keys into a key management service, and rotate them regularly.
- Risk isolation: When using
--trust-remote-code, load only models from trusted sources; before upgrading the model or modifying the mount directory, back up the weights and verify file integrity. - Version management: Keep a version number or checksum in the model directory, back up old weights before upgrades, and switch smoothly through aliases.
- Monitoring and alerts: Bring the inference service into the enterprise’s existing monitoring system, focusing on GPU memory, throughput, latency, queue length, and error rate.
Conclusion: The Key to Local Deployment Is Balancing Resources, Precision, Context, and Concurrency
For local deployment of large models on an enterprise intranet, the challenge is not whether it can be installed, but tuning hardware resources, precision strategy, context length, and concurrency scheduling to the right point for your own business. Feature switches in the launch parameters—GPU memory ratio, batch size, tensor parallelism, graph capture, and prefix caching—all affect the final service performance.
After deployment, you should also integrate health checks, metrics monitoring, a unified access gateway, and key management to bring the inference service into the enterprise’s existing operations system. Only then can a local large model truly become stable, controllable, and scalable infrastructure within the development workflow.
