[Feature]: Report the cross-attention KV cache pool in the Triton backend metrics and in the JSON iteration stats
Maintainers usually reply within 1 day
@Epsilon006 is already working on this.
Since Nov 13, 2026.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend-api-design, observability
Research direction
Start with the stats loop in triton_backend/inflight_batcher_llm/src/model_instance_state.cc, the metric definitions in custom_metrics_reporter.{h,cc}, and the IterationStats serializer in cpp/tensorrt_llm/executor/jsonSerialization.cpp. Read the existing kvCacheStats handling and check related tests for both output paths. Done means cross-attention stats are reported separately when present and omitted for decoder-only engines.
Written by the indexing model from the issue text.
Description
The feature, motivation and pitch
For an encoder-decoder engine the executor creates two paged KV cache pools, one for self-attention and one for cross-attention (trtGptModelInflightBatching.cpp, the useCrossAttention() branch of the constructor). For those engines getCurrentIterationStats fills the optional IterationStats::crossKvCacheStats next to kvCacheStats. For a decoder-only engine there is no cross-attention pool and the field stays empty.
The Python bindings expose the field (cross_kv_cache_stats). The two paths that leave the process do not:
- Triton backend. The stats loop in
triton_backend/inflight_batcher_llm/src/model_instance_state.ccreadsstat.kvCacheStatsonly. Sonv_trt_llm_kv_cache_block_metricsdescribes the self-attention pool alone, and nothing describes the cross-attention pool. - JSON iteration stats. The
IterationStatsserializer incpp/tensorrt_llm/executor/jsonSerialization.cpplistskvCacheStatsand notcrossKvCacheStats. Soto_json_str()and the/metricsroute oftrtllm-servedo not carry it.
Why it matters for an encoder-decoder engine:
- A request holds its encoder output in the cross-attention pool for its whole life. That pool can be the one that runs out first. When it does, the only exported cache metric describes the other pool and can read nearly empty.
- Each pool is sized as the smaller of
max_tokens_in_paged_kv_cacheand its share of free GPU memory at load. The cross-attention pool can come out smaller than configured, and its capacity is not reported anywhere.
Request: when crossKvCacheStats has a value, report it on both paths.
A sketch, not compiled:
- In
model_instance_state.cc, next to the existingkvCacheStatsblock, append the same fields fromstat.crossKvCacheStatsunder distinct keys. - In
custom_metrics_reporter.{h,cc}, add a metric family for them with the samekv_cache_block_typelabel values. A separate family leaves the existing one unchanged, and it is simply absent for decoder-only engines. - In
jsonSerialization.cpp, addcrossKvCacheStatsto theIterationStatsserializer.
Alternatives
- Reading
cross_kv_cache_statsthrough the Python bindings. That works only for code inside the process that owns the executor, so not for a Triton deployment. - Inferring a full cross-attention pool from the request metrics (
activeagainstscheduled). That shows a symptom and not which pool caused it. - Adding the cross-attention values as extra
kv_cache_block_typelabel values on the existing family. That changes what the existing family means for anyone who aggregates it.
Additional context
- Code references are to v1.2.1. The backend's stats loop is the same in v1.3.0rc1.
- Dominant language
- Python
- Stars
- 15.2k
- Forks
- 3k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 477
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NVIDIA/TensorRT-LLM
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xPossibly taken @NimaVaziri claimed this today. OpenPytorch
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainers usually reply within 1 day
-
Inference runtime Windows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
NVIDIA/TensorRT-LLM#23394 ·
Maintainers usually reply within 1 day
-
[Bug]: MMLU subsampling changes when evaluators are interleavedPossibly taken @LeNeLeNeWo claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NVIDIA/TensorRT-LLM#23273 ·
Maintainers usually reply within 1 day
-
Trace-replay Pareto window includes the drain when sessions finish out of admission orderPossibly taken @sbeierle claimed this 3 days ago. OpenTesting
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
NVIDIA/TensorRT-LLM#23077 ·
Maintainers usually reply within 1 day
-
LongBench V2 blog command breaks on inline comments after continuationsPossibly taken @ddlw claimed this 25 days ago. OpenDoc
Difficulty 1/5 Under an hour Newbie friendliness 91/100
NVIDIA/TensorRT-LLM#21879 ·
Maintainers usually reply within 1 day
All issues in NVIDIA/TensorRT-LLM
Similar issues
-
[Resource]: SpaicelyOpenresource-submission validation-passed
Difficulty 1/5 Under an hour Newbie friendliness 68/100
hesreallyhim/awesome-claude-code#3875 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
bvis/aegis-hass#725 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
#1643 unrecoverable split: 1 digest with a 403 — two earlier captures of the same URL are real 200sOpen
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Robin-IA/Congressional-Letters-Dev#1684 ·
Maintainers usually reply within 1 day