agentleFS
Hugging FaceKnown publisherhuggingface/optimum-neuron/optimum/neuron/vllm/AGENTS.md

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…

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
  1. Very specific:

    Only NxD backend with continuous_batching: true is supported.

    line 9
  2. Distinctive:

    If the model isn’t pre-compiled, vLLM searches the hub cache for a compatible config:

    line 24
  3. Very specific:

    When --data-parallel-size N is passed (N > 1), optimum-cli neuron serve spawns N independent vLLM servers behind an aiohttp round-robin …

    line 32

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Optimum Neuron vLLM Guide

This guide covers the Optimum Neuron vLLM backend. For project-wide workflows see AGENTS.md.

Architecture Overview

  • Runner: OptimumNeuronModelRunner manages execution and batch state.
  • Batch management: OptimumNeuronCachedBatch maps requests to KV cache slots.
  • Model wrapper: OptimumNeuronModelForCausalLM adapts Neuron models to vLLM.
  • Only NxD backend with continuous_batching: true is 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.