[Feature]: trtllm-bench should set kv_cache_config.avg_seq_len from the dataset for hybrid Mamba models
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- backend, performance
Research direction
Read get_settings() in tensorrt_llm/bench/benchmark/utils/general.py and the avg_seq_len handling in MambaHybridCacheManagerV2._get_typical_request_capacity in tensorrt_llm/_torch/pyexecutor/kv_cache/mamba_cache_manager/mamba_cache_manager_v2.py. Check how dataset metadata provides avg_isl and avg_osl, then review the perf harness precedent in tests/integration/defs/perf/test_perf.py. Done means the bench default follows the proposal only when neither avg_seq_len nor a pool ratio is set, with a unit test; the open questions need a decision.
Written by the indexing model from the issue text.
Description
Summary
For hybrid Mamba / linear-attention models, trtllm-bench never sets kv_cache_config.avg_seq_len, so the cache pool is sized with the max_seq_len // 2 fallback. In a fixed-length throughput benchmark every request reaches max_seq_len, so the pool holds about half the requests the user expects, and large batches stall.
Where
MambaHybridCacheManagerV2._get_typical_request_capacity(tensorrt_llm/_torch/pyexecutor/kv_cache/mamba_cache_manager/mamba_cache_manager_v2.py) returnsavg_seq_lenwhen set; otherwise it logs a warning and usesmax(1, max_seq_len // 2).trtllm-bench(tensorrt_llm/bench/benchmark/utils/general.py::get_settings) derivesmax_seq_lenfrom the dataset but never setsavg_seq_len.- #17825 infers
avg_seq_lenfrom fixed-length datasets, but only in the perf test harness (tests/integration/defs/perf/test_perf.py), not intrtllm-benchitself.
What we saw
Qwen3.5-397B-A17B NVFP4 on 4× GB200, trtllm-bench throughput mode, ISL/OSL 256/256, attention DP, TensorRT-LLM 1.4.0rc4:
- Without
avg_seq_len, batches above about 512 requests per rank ran short of cache and throughput fell; 1,024 per rank collapsed. - With
kv_cache_config.avg_seq_len: 512(= ISL + OSL), 640–896 requests per rank fit, for up to +20% output throughput at the same settings otherwise.
Proposal
In get_settings(), when the user sets neither kv_cache_config.avg_seq_len nor a pool ratio, default avg_seq_len to avg_isl + avg_osl from the dataset metadata (a small change plus a unit test). I'm happy to send a PR if this direction is welcome.
Open questions
- This would make the
trtllm-benchdefault differ fromtrtllm-serve, which can't know the request lengths. Is a bench-only default acceptable? avg_seq_lenis marked as a prototype field. Is it stable enough to set by default?- The collapse at 1,024 per rank might also involve the scheduler (possibly related to #15462). I haven't reproduced it on current
main.
- 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