Skip to content

Conversation

@bobboli
Copy link
Collaborator

@bobboli bobboli commented Dec 24, 2025

Summary by CodeRabbit

  • New Features
    • Added LongBench v1 evaluation capability, providing automated benchmarking of long-context task performance with subgroup score aggregation and detailed performance metrics.
    • Example usage:
  trtllm-eval --model Qwen/Qwen3-30B-A3B-Instruct-2507/ --max_batch_size 256 --max_num_tokens 160000 --kv_cache_free_gpu_memory_fraction 0.85 --extra_llm_api_options extra_llm_api_options.yaml  longbench_v1
  • Add a unittest for Skip Softmax Attention on CI using LongBenchV1.

  • Dependencies

    • Updated lm_eval package to version 0.4.9.2.
    • Added fuzzywuzzy 0.18.0 for string matching functionality.

Description

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@bobboli bobboli requested a review from a team as a code owner December 24, 2025 07:39
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 24, 2025

📝 Walkthrough

Walkthrough

This PR introduces LongBenchV1, a new evaluation module for handling LongBench group tasks via lm-evaluation-harness with aggregation logic. It includes dependency updates (lm_eval upgrade to 0.4.9.2 and fuzzywuzzy addition) and CLI integration across multiple files.

Changes

Cohort / File(s) Summary
Dependency updates
requirements-dev.txt
Updated lm_eval[api] from 0.4.8 to 0.4.9.2; added fuzzywuzzy==0.18.0
CLI integration
tensorrt_llm/commands/eval.py
Imported LongBenchV1 from tensorrt_llm.evaluate and registered its CLI subcommand in the main command group (two registration points)
Public API exports
tensorrt_llm/evaluate/__init__.py
Added LongBenchV1 to module imports from .lm_eval and included it in __all__ public exports
Core implementation
tensorrt_llm/evaluate/lm_eval.py
Introduced LongBenchV1 evaluator class inheriting from LmEvalEvaluator; added helper methods _flatten_task_dict and _get_group_score for nested task parsing and score extraction; implemented evaluate method for subgroup aggregation; added longbench_v1 CLI command with options for dataset path, sampling, and prompting

Sequence Diagram

sequenceDiagram
    participant CLI as CLI Command
    participant LBV1 as LongBenchV1<br/>Evaluator
    participant LmEval as LM-Eval<br/>Harness
    participant LLM as LLM Model
    participant Results as Result<br/>Aggregator

    CLI->>LBV1: evaluate(llm, sampling_params)
    activate LBV1
    
    rect rgb(220, 240, 255)
    Note over LBV1,LmEval: Initialization & Execution
    LBV1->>LmEval: run with wrapper<br/>(MultimodalLmEvalWrapper<br/>or LmEvalWrapper)
    activate LmEval
    LmEval->>LLM: generate predictions<br/>for each subtask
    activate LLM
    LLM-->>LmEval: predictions
    deactivate LLM
    LmEval-->>LBV1: results table
    deactivate LmEval
    end
    
    rect rgb(240, 220, 255)
    Note over LBV1,Results: Score Extraction & Aggregation
    LBV1->>Results: _flatten_task_dict()
    Results-->>LBV1: list of subtask names
    
    loop for each subtask
        LBV1->>Results: _get_group_score(metrics)
        Results-->>LBV1: numeric score
    end
    
    LBV1->>Results: compute mean
    Results-->>LBV1: final aggregate score
    end
    
    LBV1-->>CLI: float (mean score)
    deactivate LBV1
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ⚠️ Warning The PR description is largely incomplete—author provided only auto-generated CodeRabbit summary with new features and dependencies, but omitted all required template sections: explicit issue/solution explanation, test coverage details, and unchecked PR checklist items. Fill in the Description section explaining the issue and solution, list relevant test cases in Test Coverage, and verify/check all PR Checklist items before submission.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title '[None][infra] Add LongBenchV1 to trtllm-eval' directly and clearly summarizes the main change: adding LongBenchV1 evaluation support to the TRT-LLM eval infrastructure.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
tensorrt_llm/evaluate/lm_eval.py (2)

746-754: Unused helper method _flatten_task_dict.

This static method is defined but never called within the class. If it's intended for future use or debugging, consider documenting that purpose. Otherwise, it can be removed to reduce code clutter.

🔎 If unused, consider removing
-    @staticmethod
-    def _flatten_task_dict(task_dict: dict) -> List[str]:
-        names: List[str] = []
-        for k, v in task_dict.items():
-            if isinstance(v, dict):
-                names.extend(LongBenchV1._flatten_task_dict(v))
-            else:
-                names.append(k)
-        return names
-

756-773: Docstring/implementation mismatch in _get_group_score.

The docstring states it will "otherwise accept any score,<filter> key" as a fallback, but the implementation only checks for the preferred_key and returns None if not found. Consider either updating the docstring to match the current behavior, or implementing the fallback logic:

🔎 Option: Implement the documented fallback behavior
     @staticmethod
     def _get_group_score(metrics: Dict[str, Any],
                          *,
                          preferred_filter: str = "none") -> Optional[float]:
         """
         lm-eval stores group metrics as "<metric>,<filter>" (e.g., "score,none").
         Prefer "score,none" (matches printed table), otherwise accept any
         "score,<filter>" key.
         """
         if not isinstance(metrics, dict):
             return None

         preferred_key = f"score,{preferred_filter}"
         v = metrics.get(preferred_key, None)
         if isinstance(v, (int, float)):
             return float(v)

+        # Fallback: accept any "score,<filter>" key
+        for key, val in metrics.items():
+            if key.startswith("score,") and isinstance(val, (int, float)):
+                return float(val)
+
         return None
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ecea71c and eae3f91.

📒 Files selected for processing (4)
  • requirements-dev.txt
  • tensorrt_llm/commands/eval.py
  • tensorrt_llm/evaluate/__init__.py
  • tensorrt_llm/evaluate/lm_eval.py
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Code developed for TensorRT-LLM should conform to Python 3.8+
Indent Python code with 4 spaces. Do not use tabs
Always maintain the namespace when importing in Python, even if only one class or function from a module is used
Python files should use snake_case naming: some_file.py
Python classes should use PascalCase naming: class SomeClass
Python functions and methods should use snake_case naming: def my_awesome_function():
Python local variables should use snake_case naming: my_variable = ...
Python variable names that start with a number should be prefixed with 'k': k_99th_percentile = ...
Python global variables should use upper snake_case with prefix 'G': G_MY_GLOBAL = ...
Python constants should use upper snake_case naming: MY_CONSTANT = ...
Avoid shadowing variables declared in an outer scope in Python
Initialize all externally visible members of a Python class in the constructor
For Python interfaces that may be used outside a file, prefer docstrings over comments
Python comments should be reserved for code within a function, or interfaces that are local to a file
Use Google style docstrings in Python for classes and functions, which can be parsed by Sphinx
Python attributes and variables can be documented inline with type and description
Avoid using reflection in Python when functionality can be easily achieved without reflection
When using try-except blocks in Python, limit the except to the smallest set of errors possible
When using try-except blocks in Python to handle multiple possible variable types (duck-typing), keep the body of the try as small as possible, using the else block for logic

Files:

  • tensorrt_llm/evaluate/__init__.py
  • tensorrt_llm/evaluate/lm_eval.py
  • tensorrt_llm/commands/eval.py
**/*.{cpp,h,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

All TensorRT-LLM Open Source Software code should contain an NVIDIA copyright header that includes the year of its latest meaningful modification

Files:

  • tensorrt_llm/evaluate/__init__.py
  • tensorrt_llm/evaluate/lm_eval.py
  • tensorrt_llm/commands/eval.py
🧠 Learnings (5)
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
Repo: NVIDIA/TensorRT-LLM PR: 6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.

Applied to files:

  • tensorrt_llm/commands/eval.py
📚 Learning: 2025-08-26T09:37:10.463Z
Learnt from: jiaganc
Repo: NVIDIA/TensorRT-LLM PR: 7031
File: tensorrt_llm/bench/dataclasses/configuration.py:90-104
Timestamp: 2025-08-26T09:37:10.463Z
Learning: In TensorRT-LLM's bench configuration, the `get_pytorch_perf_config()` method returns `self.pytorch_config` which is a Dict[str, Any] that can contain default values including `cuda_graph_config`, making the fallback `llm_args["cuda_graph_config"]` safe to use.

Applied to files:

  • tensorrt_llm/commands/eval.py
📚 Learning: 2025-08-26T09:37:10.463Z
Learnt from: jiaganc
Repo: NVIDIA/TensorRT-LLM PR: 7031
File: tensorrt_llm/bench/dataclasses/configuration.py:90-104
Timestamp: 2025-08-26T09:37:10.463Z
Learning: In TensorRT-LLM, the `get_pytorch_perf_config()` method returns `self.pytorch_config` which can contain default `cuda_graph_config` values, so `llm_args` may already have this config before the extra options processing.

Applied to files:

  • tensorrt_llm/commands/eval.py
📚 Learning: 2025-09-09T09:40:45.658Z
Learnt from: fredricz-20070104
Repo: NVIDIA/TensorRT-LLM PR: 7645
File: tests/integration/test_lists/qa/llm_function_core.txt:648-648
Timestamp: 2025-09-09T09:40:45.658Z
Learning: In TensorRT-LLM test lists, it's common and intentional for the same test to appear in multiple test list files when they serve different purposes (e.g., llm_function_core.txt for comprehensive core functionality testing and llm_function_core_sanity.txt for quick sanity checks). This duplication allows tests to be run in different testing contexts.

Applied to files:

  • tensorrt_llm/commands/eval.py
📚 Learning: 2025-08-06T13:58:07.506Z
Learnt from: galagam
Repo: NVIDIA/TensorRT-LLM PR: 6487
File: tests/unittest/_torch/auto_deploy/unit/singlegpu/test_ad_trtllm_bench.py:1-12
Timestamp: 2025-08-06T13:58:07.506Z
Learning: In TensorRT-LLM, test files (files under tests/ directories) do not require NVIDIA copyright headers, unlike production source code files. Test files typically start directly with imports, docstrings, or code.

Applied to files:

  • tensorrt_llm/commands/eval.py
🧬 Code graph analysis (2)
tensorrt_llm/evaluate/__init__.py (1)
tests/integration/defs/accuracy/accuracy_core.py (3)
  • GSM8K (334-349)
  • MMMU (386-403)
  • mmlu (713-742)
tensorrt_llm/evaluate/lm_eval.py (2)
tests/unittest/_torch/modeling/test_modeling_out_of_tree.py (1)
  • sampling_params (58-59)
tensorrt_llm/evaluate/interface.py (1)
  • evaluate (85-114)
🪛 Ruff (0.14.10)
tensorrt_llm/evaluate/lm_eval.py

806-808: Avoid specifying long messages outside the exception class

(TRY003)


821-823: Avoid specifying long messages outside the exception class

(TRY003)


858-858: Unused lambda argument: ctx

(ARG005)


858-858: Unused lambda argument: param

(ARG005)

🔇 Additional comments (5)
tensorrt_llm/commands/eval.py (1)

23-25: LGTM!

The LongBenchV1 import and CLI command registration follow the established pattern used by other evaluators in this file. Clean integration.

Also applies to: 185-186

tensorrt_llm/evaluate/__init__.py (1)

18-19: LGTM!

The LongBenchV1 import and __all__ export follow the existing module patterns and maintain proper alphabetical ordering.

Also applies to: 25-25

tensorrt_llm/evaluate/lm_eval.py (3)

775-829: Verify score normalization behavior difference from parent class.

The parent LmEvalEvaluator.evaluate() normalizes scores to 0-100 range (lines 425-429), but LongBenchV1.evaluate() returns raw scores without normalization. This appears intentional since lm-eval's LongBench scores are already in the expected range, but please confirm this is the desired behavior for consistency in reporting.


831-882: CLI command differs from sibling evaluators - verify intentional.

Notable differences from other evaluator commands:

  1. Missing --max_input_length / --max_output_length options (sampling controlled by lm-eval)
  2. Missing --fewshot_as_multiturn option
  3. --apply_chat_template defaults to True instead of False

The comment on line 878 explains the sampling approach. Please confirm the other differences are intentional for LongBench's long-context nature.


103-124: LGTM!

The enhanced documentation clearly explains the relationship between lm-eval's gen_kwargs and TensorRT-LLM's SamplingParams. The defaults (temperature=0, max_tokens=256) align with lm-eval conventions.

@bobboli
Copy link
Collaborator Author

bobboli commented Dec 24, 2025

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29840 [ run ] triggered by Bot. Commit: d6890c9

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29840 [ run ] completed with state SUCCESS. Commit: d6890c9
/LLM/main/L0_MergeRequest_PR pipeline #22943 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@bobboli
Copy link
Collaborator Author

bobboli commented Dec 25, 2025

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29920 [ run ] triggered by Bot. Commit: 14785d2

@tensorrt-cicd
Copy link
Collaborator

PR_Github #29920 [ run ] completed with state SUCCESS. Commit: 14785d2
/LLM/main/L0_MergeRequest_PR pipeline #23010 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@bobboli
Copy link
Collaborator Author

bobboli commented Dec 27, 2025

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30030 [ run ] triggered by Bot. Commit: 37b854b

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30030 [ run ] completed with state SUCCESS. Commit: 37b854b
/LLM/main/L0_MergeRequest_PR pipeline #23108 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@bobboli
Copy link
Collaborator Author

bobboli commented Dec 28, 2025

/bot run --reuse-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30041 [ run ] triggered by Bot. Commit: 37b854b

@tensorrt-cicd
Copy link
Collaborator

PR_Github #30041 [ run ] completed with state SUCCESS. Commit: 37b854b
/LLM/main/L0_MergeRequest_PR pipeline #23118 completed with status: 'SUCCESS'

@bobboli bobboli enabled auto-merge (squash) December 28, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants