[Feature]: trtllm-bench should set kv_cache_config.avg_seq_len from the dataset for hybrid Mamba models

Đang mở
#23,100 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, pytorch
Lĩnh vực
backend, performance

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

feature request
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) returns avg_seq_len when set; otherwise it logs a warning and uses max(1, max_seq_len // 2).
  • trtllm-bench (tensorrt_llm/bench/benchmark/utils/general.py::get_settings) derives max_seq_len from the dataset but never sets avg_seq_len.
  • #17825 infers avg_seq_len from fixed-length datasets, but only in the perf test harness (tests/integration/defs/perf/test_perf.py), not in trtllm-bench itself.
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-bench default differ from trtllm-serve, which can't know the request lengths. Is a bench-only default acceptable?
  • avg_seq_len is 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.
Ngôn ngữ chính
Python
Star
15.2k
Fork
3k
Merge trung bình
2 ngày 21 giờ
Pull request đã merge (30 ngày)
477

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NVIDIA/TensorRT-LLM

Tất cả issue của NVIDIA/TensorRT-LLM

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.