optimum-neuron / vllm
AGENTS.md270 starsChanged 10 months agoApache-2.0View on GitHub
This guide covers the Optimum Neuron vLLM backend. For project-wide workflows see AGENTS.md. Key files: - optimum/neuron/vllm/runner.py - optimum/neuron/vllm/model_loader.py Key files: - optimum/neuron/vllm/server_manager.py — spawns and manages vLLM server subprocesses with Neuron core pinning. - optimum/neuron/vllm/reverse_proxy.py — round-robin proxy with aggregated /health. Do NOT use start_new_session=True on vLLM server subprocesses. vLLM already cleans up its own EngineCore workers on SIGTERM. Isolating servers in separate process groups makes them unreachable by the parent's signal handlers and test fixture teardown, causing Neuron…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- optimum/neuron/cache/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/backend/modules/attention/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/gemma3/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/granite/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/llama4/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/llama/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/mixtral/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/phi3/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/qwen2/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/qwen3/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/qwen3_moe/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/smollm3/AGENTS.mdAGENTS.md
- optimum/neuron/models/inference/smolvlm/AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- optimum/neuron/cache/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/gemma3/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/granite/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/llama4/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/llama/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/mixtral/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/phi3/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/qwen2/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/qwen3/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/qwen3_moe/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/smollm3/CLAUDE.mdCLAUDE.md
- optimum/neuron/models/inference/smolvlm/CLAUDE.mdCLAUDE.md
- optimum/neuron/vllm/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Only NxD backend with continuous_batching: true is supported.
- Distinctive: line 24
If the model isn’t pre-compiled, vLLM searches the hub cache for a compatible config:
- Very specific: line 32
When --data-parallel-size N is passed (N > 1), optimum-cli neuron serve spawns N independent vLLM servers behind an aiohttp round-robin …
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Optimum Neuron vLLM Guide
This guide covers the Optimum Neuron vLLM backend. For project-wide workflows see AGENTS.md.
Architecture Overview
- Runner:
OptimumNeuronModelRunnermanages execution and batch state. - Batch management:
OptimumNeuronCachedBatchmaps requests to KV cache slots. - Model wrapper:
OptimumNeuronModelForCausalLMadapts Neuron models to vLLM. - Only NxD backend with
continuous_batching: trueis supported.
Key files:
- optimum/neuron/vllm/runner.py
- optimum/neuron/vllm/model_loader.py
Request Lifecycle
- Prompt (context encoding) and decode (token generation) are executed on different graphs.
- Finished requests are removed from the cached batch to free KV cache slots.
Temperature Conversion
vLLM uses temperature=0.0 for greedy decoding, but Neuron requires top_k=1:
- Implemented in optimum/neuron/vllm/runner.py.
Model Export Detection
If the model isn’t pre-compiled, vLLM searches the hub cache for a compatible config:
select_hub_cached_entries()in optimum/neuron/vllm/model_loader.py- Falls back to on-the-fly export when no match is found.
CLI
- Launch server via
optimum-cli neuron serve(see optimum/commands/neuron/serve.py).
Data-Parallel Serving
When --data-parallel-size N is passed (N > 1), optimum-cli neuron serve spawns N independent vLLM servers behind an aiohttp round-robin reverse proxy.
Key files:
- optimum/neuron/vllm/server_manager.py — spawns and manages vLLM server subprocesses with Neuron core pinning.
- optimum/neuron/vllm/reverse_proxy.py — round-robin proxy with aggregated
/health.
Process Lifecycle (important)
vLLM servers are spawned without start_new_session=True — they inherit the parent's process group. On shutdown, optimum-cli sends SIGTERM to each server via proc.terminate(), and vLLM handles its own EngineCore child cleanup gracefully.
Do NOT use start_new_session=True on vLLM server subprocesses. vLLM already cleans up its own EngineCore workers on SIGTERM. Isolating servers in separate process groups makes them unreachable by the parent's signal handlers and test fixture teardown, causing Neuron core leaks that poison subsequent tests.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

