Local Vibe Coding Inference Stack for a Single 24GB GPU: Quantization Tiers and Compose Deployment
A complete Docker Compose blueprint covering 4-bit/FP8 model memory budgets, KV Cache context allocation, and an OpenAI-compatible API gateway

Completion Score
Overall completion is 89%. The AI excels in VRAM budget calculation, Docker orchestration syntax generation, and quantization parameter recommendations, but manual verification is still required for handling extreme edge cases in hardware-specific fine-tuning.
Dimension breakdown
vLLM's high throughput and low latency perfectly support FIM streaming, ensuring IDE plugins can render completion results in real-time.
7B-class models perform stably in single-file logical loops, accurately understanding file structure and generating unit tests.
Due to 24GB VRAM limitations, KV Cache allocation requires fine-tuning. 64K context may trigger OOM in complex multi-file scenarios.
Using vLLM's PagedAttention technology, a single GPU can efficiently handle 2-4 concurrent requests, meeting the needs of small team collaboration.
Human checkpoint
Before deployment, you must manually verify that the `MODEL_ID` path in `docker-compose.yml` matches your local disk space and confirm that the NVIDIA driver version supports the Flash Attention backend required by vLLM.
Upgrade / downgrade path
If VRAM is tight, you can downgrade to a 3-bit quantized model or reduce `GPU_MEMORY_FRACTION`. For higher concurrency, consider introducing multi-GPU distributed inference or increasing vLLM's `tensor-parallel-size`.
When to use & prerequisites
Target users are independent developers or small teams with an NVIDIA RTX 4090 or equivalent 24GB GPU. The environment requires pre-installed Docker and NVIDIA drivers. It is suitable for scenarios requiring local private deployment, low-latency code generation, and long-document code review.
Ready-to-copy configs
定义包含 vLLM 推理服务、OpenAI 兼容代理及本地 IDE 插件的 Docker 编排配置
version: '3.8'
services:
vllm-inference:
image: vllm/vllm-openai:latest
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
environment:
- VLLM_WORKER_MULTIPROC_METHOD=spawn
- VLLM_ATTENTION_BACKEND=FLASH_ATTN
- MAX_MODEL_LEN=32768
- GPU_MEMORY_FRACTION=0.75
- MAX_NUM_BATCHED_TOKENS=4096
volumes:
- ./models:/models
- ./cache:/cache
ports:
- "8000:8000"
command: >
vllm serve ${MODEL_ID:-Qwen/Qwen2.5-7B-Instruct}
--tensor-parallel-size 1
--trust-remote-code
--served-model-name local-vibe
--dtype auto
--max-model-len 32768
openai-proxy:
image: ghcr.io/mckaywrigley/vllm-openai-proxy:latest
environment:
- OPENAI_API_KEY=sk-vibe-coding-local
- VLLM_API_BASE=http://vllm-inference:8000/v1
- MAX_TOKENS=32768
ports:
- "11434:11434"
depends_on:
- vllm-inference
ollama-bridge:
image: ollama/ollama:latest
volumes:
- ollama-data:/root/.ollama
ports:
- "11435:11434"
environment:
- OLLAMA_HOST=0.0.0.0
volumes:
- ./models:/models
volumes:
ollama-data:
cache:
models:
存储本地推理栈的环境变量,包括模型 ID、API 密钥及显存限制配置
# Model Configuration
MODEL_ID=${MODEL_ID:-Qwen/Qwen2.5-7B-Instruct}
MODEL_QUANTIZATION=${MODEL_QUANTIZATION:-4-bit}
# API & Proxy Configuration
OPENAI_API_KEY=${OPENAI_API_KEY:-sk-vibe-coding-local}
VLLM_API_BASE_URL=${VLLM_API_BASE_URL:-http://localhost:8000/v1}
OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL:-http://localhost:11434}
# Context & Performance Tuning
MAX_CONTEXT_LENGTH=${MAX_CONTEXT_LENGTH:-32768}
GPU_MEMORY_FRACTION=${GPU_MEMORY_FRACTION:-0.75}
MAX_BATCH_PREFILL_TOKENS=${MAX_BATCH_PREFILL_TOKENS:-4096}
# IDE Integration
IDE_PLUGIN_ENABLED=${IDE_PLUGIN_ENABLED:-true}
FIM_ENABLED=${FIM_ENABLED:-true}
# Security (Do not commit secrets)
# API_KEY=${YOUR_SECURE_API_KEY}
AI Vibe Coding in 4 steps
- 1
Initialize Docker Network and Volume Mounts
Goal: Ensure correct mapping of model files, cache directories, and container internals to avoid permission errors
PromptPlease generate a Docker Compose network configuration including a vLLM service and a proxy service. Requirements: 1. Mount the local models directory to /models in the container; 2. Mount the cache directory to /cache; 3. Configure NVIDIA GPU resource reservation; 4. Use v3.8 syntax.Verify:
Run `docker-compose config` to check YAML syntax, and execute `docker-compose up -d` to observe the container startup logs for successful GPU allocation messages. - 2
Configure Model Quantization and VRAM Budget
Goal: Set appropriate quantization parameters to prevent OOM based on the 24GB VRAM limit
PromptFor an RTX 4090 with 24GB VRAM, please recommend a 4-bit quantized Qwen2.5-7B-Instruct model ID and generate the corresponding vLLM startup command, setting `GPU_MEMORY_FRACTION=0.75` and `MAX_MODEL_LEN=32768`.Verify:
Check container logs to confirm the startup command includes `--dtype auto` and there are no VRAM overflow errors. Use `nvidia-smi` to observe that VRAM usage is around 18GB. - 3
Deploy OpenAI-Compatible Proxy Gateway
Goal: Establish a standard API bridge between the local IDE and the vLLM inference service
PromptGenerate a Docker configuration for an OpenAI-compatible proxy service listening on port 11434, pointing to vLLM's port 8000, and setting the environment variable `OPENAI_API_KEY` to `sk-vibe-coding-local`.Verify:
Execute `curl http://localhost:11434/v1/models` on the host; it should return a JSON response containing `local-vibe` model information. - 4
Integrate IDE Plugin and FIM Testing
Goal: Verify that the local model can provide real-time code completion in the IDE
PromptPlease write a test script using Python's `requests` library to call the local proxy (http://localhost:11434), send a FIM-format completion request (prefix: 'def hello():', suffix: 'return True'), and print the output.Verify:
Run the script and confirm that the terminal output includes the completed code snippet and the response time is less than 2 seconds.
Pitfalls & fixes
- OOM Crash: If the model is not quantized or VRAM usage is too high, the container will exit due to OOMKilled. Solution: Lower `GPU_MEMORY_FRACTION` in `.env` or switch to a smaller parameter model.
- Missing Flash Attention: vLLM startup fails with a message indicating missing CUDA support. Solution: Ensure the Docker image is built on NVIDIA CUDA 12.x and install the `flash-attn` library.
- Context Truncation: Long text generation is truncated midway. Solution: Check `MAX_CONTEXT_LENGTH` settings and ensure `MAX_NUM_BATCHED_TOKENS` does not exceed the VRAM capacity limit.
FAQ
How to run this stack without NVIDIA drivers?
This solution relies on GPU acceleration. Without drivers, you must run vLLM in CPU mode, which will be 10-20 times slower and does not support Flash Attention. It is recommended for debugging only.
Can vLLM and Ollama run simultaneously?
Yes, but this solution recommends using vLLM as the unified backend, exposing interfaces via an OpenAI proxy to avoid VRAM waste caused by Ollama loading models redundantly.
How to adjust concurrency to support more users?
vLLM's PagedAttention has already optimized concurrency. If more concurrency is needed, try increasing `MAX_NUM_BATCHED_TOKENS` or deploying multiple instances with load balancing.


