Open-Source Code LLMs: Selection Criteria and Cloud Deployment Guide

    Choosing and deploying an open-source code LLM starts with three questions: does the license cover your use case, can your GPU memory handle the parameter size, and is the task code completion, conversational Q&A, or repository-level analysis. This guide walks through licensing checks, capability boundaries, hardware sizing with DeepSeek Coder as an example, benchmark evaluation, and a step-by-step cloud deployment using vLLM with an OpenAI-compatible API, plus IDE/CI integration, monitoring, risks, and a pre-launch checklist.

    Key Takeaways First

    Before selecting a model, answer three questions: Does the model license cover your intended use? Can your team’s GPU memory handle the target parameter count? Is the task code completion, conversational Q&A, or repository-level analysis? The sections below address each question and provide directly executable deployment steps.

    1. Verify Licenses and the Scope of “Open Source”

    In the LLM context, “open source” refers to several distinct artifacts. Model weights, training data, training code, and inference code each have different levels of openness, governed by separate licenses. For example, the DeepSeek Coder code repository uses the MIT license, while the model weights are covered by a separate DeepSeek model license agreement that permits commercial use with usage restrictions. CodeLlama is based on the Llama 2 Community License, which imposes additional conditions on very large organizations. Qwen2.5-Coder sizes may carry different licenses.

    Before going live, review the model card and the LICENSE file in the repository for each model, and have legal counsel confirm the terms. License differences matter most when providing external services, redistributing weights, or commercializing fine-tuned derivatives.

    2. Capability Boundaries: Generation, Debugging, and Data Analysis

    The three core capabilities of code LLMs each have well-defined limits.

    1. Code generation: Models can complete functions, classes, and boilerplate, and can generate full business logic from natural-language descriptions. Generated output must be compiled and validated by running it; never merge it directly into a codebase.
    2. Debugging and refactoring: Models can infer likely causes from error stack traces and suggest refactorings, but they produce both false positives and false negatives. Combine model output with static analysis tools (linters, SAST scanners), unit tests, and human review. Do not treat model conclusions as confirmed defects.
    3. Data analysis: Models can generate SQL, Pandas cleaning scripts, and visualization code. Generated SQL should first be executed under a read-only account to avoid write operations against production databases.

    3. Parameter Count and Hardware Sizing

    The table below uses the DeepSeek Coder series as an example. The VRAM figures cover model weights only, excluding KV cache and runtime overhead; reserve at least 20% headroom in production.

    Parameters Typical Model Weight VRAM (FP16/BF16) Weight VRAM (INT4 Quantized) Suitable Scenarios
    1.3B deepseek-coder-1.3b-base ~2.6 GB ~1 GB Real-time local IDE completion, latency-sensitive
    6.7B deepseek-coder-6.7b-instruct ~13.4 GB ~3.5 GB Private team assistant; runs on a single 24 GB GPU
    33B deepseek-coder-33b-instruct ~66 GB ~17 GB Complex algorithms and longer contexts; needs an 80 GB-class GPU or multiple GPUs

    Selection guidance:

    • 1.3B: Best for local completion. Capability is limited, and success rates on complex tasks are clearly lower than larger models.
    • 6.7B: Suitable for centralized deployment by small and mid-sized teams. The FP16 version runs on a single 24 GB GPU, but longer contexts require more reserved memory.
    • 33B: Suited to complex logic and longer contexts. FP16 requires an 80 GB-class GPU or multi-GPU parallelism. After INT4 quantization it can handle shorter contexts on a 24 GB GPU, but quantization degrades quality—confirm with an internal evaluation set.

    Base models and instruction-tuned models serve different purposes. Base models are pretrained only; they excel at continuing code from context, support fill-in-the-middle completion, and work well as foundations for continued pretraining or domain-specific fine-tuning. Instruction-tuned models undergo alignment training and are suited to conversational coding assistants and Q&A. Teams typically need both: the Base model for completion and the instruction-tuned model for chat.

    4. Benchmarks and Multilingual Capability

    HumanEval contains 164 handwritten programming problems. Each provides a function signature and docstring; the model generates the function body, and unit tests determine correctness. The common metric is pass@1—the proportion of problems solved on the first generation. Sampling temperature and prompt formats vary across papers, so confirm methodology before comparing scores. Refer to official model cards or technical reports for specific numbers.

    Benchmark scores reflect performance on standardized problems, not real-world results in an enterprise codebase. Build an internal evaluation set of 50–200 real tasks covering your team’s frameworks, naming conventions, and historical defects, and record both pass rates and human ratings. Multilingual capability should also be sampled by the languages you actually use—if your team works mainly in Java and Go, Python scores alone are not a sufficient basis for decisions.

    5. Cloud Deployment Steps

    This guide uses a GPU cloud server on Baidu AI Cloud as the example; the steps are essentially the same on other cloud platforms or in your own data center.

    5.1 Prepare Resources

    • GPU instance: Choose based on the VRAM requirements in Section 3. A 6.7B model needs a 24 GB or larger GPU; a 33B model needs an 80 GB-class GPU or a multi-GPU instance.
    • Disk: The 33B model’s FP16 weights are about 66 GB. Provision at least 150 GB of data disk to hold extracted files and backups.
    • Drivers: Install an NVIDIA driver matching the CUDA version required by the inference image, plus the NVIDIA Container Toolkit. First run nvidia-smi on the host to confirm the GPU is visible, then run docker run --rm --gpus all <CUDA test image> nvidia-smi to confirm GPU access inside containers.

    5.2 Download and Pin the Model Version

    1. pip install -U "huggingface_hub[cli]"
    2. huggingface-cli download deepseek-ai/deepseek-coder-6.7b-instruct \
    3. --revision <commit_hash> \
    4. --local-dir /data/models/deepseek-coder-6.7b-instruct

    Set --revision to a specific commit hash so every deployment loads identical weights. After downloading, verify the file list and checksums.

    5.3 Launch the vLLM Inference Service

    1. export VLLM_API_KEY="<random string generated in your secrets manager>"
    2. docker run -d --name code-llm --gpus all \
    3. --ipc=host \
    4. -p 8000:8000 \
    5. -v /data/models/deepseek-coder-6.7b-instruct:/models/deepseek-coder-6.7b-instruct:ro \
    6. vllm/vllm-openai:v0.6.3 \
    7. --model /models/deepseek-coder-6.7b-instruct \
    8. --served-model-name deepseek-coder-6.7b \
    9. --max-model-len 16384 \
    10. --gpu-memory-utilization 0.90 \
    11. --api-key "$VLLM_API_KEY" \
    12. --port 8000

    Parameter notes:

    • --ipc=host: Shares the host’s IPC memory with the container, avoiding shared-memory shortages during multi-process inference.
    • -p 8000:8000: In production, bind only to an internal address; do not expose the port publicly.
    • vllm/vllm-openai:v0.6.3: Example version. Before launch, confirm the tag exists in the registry and pin a validated version.
    • --max-model-len 16384: Matches the model’s training context length; check the model card for the exact value.
    • --gpu-memory-utilization 0.90: Reserves headroom for KV cache and runtime overhead.
    • --api-key: When enabled, every request must carry an Authorization: Bearer header.

    This example does not add --trust-remote-code. DeepSeek Coder uses the standard Llama architecture, which vLLM supports natively, so no custom Python code from the model repository needs to execute. Only add this flag when a model genuinely depends on custom code—and review the Python files in the repository first while pinning the revision. The flag allows the service to download and execute arbitrary Python code from the model repository and should be treated as high-risk in production.

    5.4 Verify the Service

    1. curl http://127.0.0.1:8000/v1/chat/completions \
    2. -H "Content-Type: application/json" \
    3. -H "Authorization: Bearer $VLLM_API_KEY" \
    4. -d '{
    5. "model": "deepseek-coder-6.7b",
    6. "messages": [{"role": "user", "content": "Write a Python function that checks whether a string is a palindrome."}],
    7. "temperature": 0.2,
    8. "max_tokens": 512
    9. }'

    The response should contain the generated code. Then run unit tests against that code to confirm it works correctly.

    5.5 Networking and Access Control

    • Do not expose the service directly to the public internet. Access it through an internal network, VPC, or API gateway, and enforce authentication, rate limiting, and access auditing at the gateway layer.
    • Code and prompts may contain secrets and customer data. Never embed credentials in prompts, and redact request content in logs.

    6. Integrating with IDEs and CI Pipelines

    Most mainstream IDE plugins support OpenAI-compatible endpoints—just replace the service URL with your internal address. To call the model directly during development, use the following Python example.

    1. import os
    2. from openai import OpenAI
    3. client = OpenAI(
    4. base_url="http://10.0.0.8:8000/v1", # Replace with your actual internal address
    5. api_key=os.environ["VLLM_API_KEY"],
    6. )
    7. resp = client.chat.completions.create(
    8. model="deepseek-coder-6.7b",
    9. messages=[{"role": "user", "content": "Check the following code for SQL injection risks:\n..."}],
    10. temperature=0.2,
    11. max_tokens=512,
    12. )
    13. print(resp.choices[0].message.content)

    In a CI pipeline, you can call the model at the merge-request stage to generate review comments and attach them to the request. Treat model feedback as advisory only—not as a merge blocker. Blocking conditions should be determined by static scanning and unit tests.

    7. Monitoring Metrics and Alerts

    vLLM exposes Prometheus-format metrics via the /metrics endpoint. Monitor at least the following:

    Metric Meaning Purpose
    Request rate (QPS) Requests per second Capacity planning and anomaly detection
    Time to first token (TTFT) P95 Time from request to first token Reflects interactive experience
    End-to-end latency P95 Total response time Assesses quality for long-output tasks
    Generation throughput (tokens/s) Tokens generated per second Evaluates per-GPU capacity
    GPU utilization and memory usage Compute and VRAM consumption Decides scaling up or down
    Queued requests Requests waiting for scheduling Sustained growth indicates insufficient capacity
    Error rate Share of non-2xx responses Surfaces auth failures, OOM, and other faults

    Set alert thresholds against load-test baselines—for example, trigger an alert when P95 latency exceeds twice the baseline for five minutes. Run load tests with the internal evaluation set from Section 4, simulating realistic concurrency and output lengths.

    8. Risks and Precautions

    1. Correctness of model output: Generated code and review comments may contain errors or nonexistent APIs. Everything must pass compilation, testing, and human review before use.
    2. Security vulnerabilities: Models may produce code with injection flaws, broken access control, or hardcoded secrets. Route model output through your existing code security scanning process.
    3. Data leakage: Internal deployment reduces risk, but you still need to restrict who can access the service and audit call records regularly.
    4. License changes: Model publishers may revise license terms. Re-verify the license each time you upgrade a model version.
    5. Capability limits: A 1.3B model suits completion, not complex reasoning. Base selection on internal evaluation results rather than parameter count alone.

    9. Future Directions

    Code LLM applications are shifting from single-file generation toward repository-level understanding. Some newer models support longer contexts and can read multiple files at once. Another direction is tool calling, where the model decides to invoke compilers, test frameworks, or code search tools and continues based on the returned results. These applications demand more VRAM for long contexts and require sandboxed environments to isolate tool execution, preventing model mistakes from affecting production systems. Refer to each model’s official technical report for specific capabilities.

    10. Pre-Launch Checklist

    • Licenses for model weights, code, and data reviewed and confirmed by legal
    • Parameter size and quantization method selected per VRAM requirements, with 20%+ headroom
    • Model commit hash and inference image version pinned
    • Service restricted to internal access, with API key and gateway authentication enabled
    • Benchmarking completed on the internal evaluation set, with pass rates recorded
    • Monitoring and alerting configured for latency, throughput, GPU, and error rate
    • Policy established that model output requires compilation, testing, and human review before use