-
Notifications
You must be signed in to change notification settings - Fork 2k
[None][infra] Add LongBenchV1 to trtllm-eval. #10265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
📝 WalkthroughWalkthroughThis 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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 thepreferred_keyand returnsNoneif 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
📒 Files selected for processing (4)
requirements-dev.txttensorrt_llm/commands/eval.pytensorrt_llm/evaluate/__init__.pytensorrt_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__.pytensorrt_llm/evaluate/lm_eval.pytensorrt_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__.pytensorrt_llm/evaluate/lm_eval.pytensorrt_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
LongBenchV1import 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
LongBenchV1import 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), butLongBenchV1.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:
- Missing
--max_input_length/--max_output_lengthoptions (sampling controlled by lm-eval)- Missing
--fewshot_as_multiturnoption--apply_chat_templatedefaults toTrueinstead ofFalseThe 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_kwargsand TensorRT-LLM'sSamplingParams. The defaults (temperature=0, max_tokens=256) align with lm-eval conventions.
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
|
/bot run --disable-fail-fast |
|
PR_Github #29840 [ run ] triggered by Bot. Commit: |
|
PR_Github #29840 [ run ] completed with state
|
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
Signed-off-by: Bo Li <[email protected]>
|
/bot run --disable-fail-fast |
|
PR_Github #29920 [ run ] triggered by Bot. Commit: |
|
PR_Github #29920 [ run ] completed with state
|
Signed-off-by: Bo Li <[email protected]>
|
/bot run --disable-fail-fast |
|
PR_Github #30030 [ run ] triggered by Bot. Commit: |
|
PR_Github #30030 [ run ] completed with state
|
|
/bot run --reuse-test |
|
PR_Github #30041 [ run ] triggered by Bot. Commit: |
|
PR_Github #30041 [ run ] completed with state |
Summary by CodeRabbit
Add a unittest for Skip Softmax Attention on CI using LongBenchV1.
Dependencies
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 thestage-listparameter 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.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip 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-pipelineReuse 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.