feat/Add CL-bench (tencent/CL-bench) benchmark#1191
feat/Add CL-bench (tencent/CL-bench) benchmark#1191Yunnglin merged 5 commits intomodelscope:mainfrom
Conversation
Summary of ChangesHello @XChen-Zero, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive support for the CL-bench benchmark into the EvalScope framework. It establishes a new adapter to seamlessly integrate the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for the CL-bench benchmark, which is a valuable addition. The implementation is well-structured, including a new data adapter and utility functions. My review focuses on improving maintainability and robustness. I've identified an opportunity to simplify the load method in CLBenchAdapter, which is currently more complex than necessary and contains unreachable code. Additionally, I've suggested a more robust implementation for the extract_json_block utility function to better handle variations in LLM-generated output. These changes should make the new benchmark integration more reliable and easier to maintain.
| def extract_json_block(result_text: str) -> Optional[str]: | ||
| # Remove code block wrapper if present | ||
| if result_text.startswith('```json'): | ||
| result_text = result_text[7:] | ||
| if result_text.startswith('```'): | ||
| result_text = result_text[3:] | ||
| if result_text.endswith('```'): | ||
| result_text = result_text[:-3] | ||
| result_text = result_text.strip() | ||
|
|
||
| return result_text |
There was a problem hiding this comment.
The current implementation of extract_json_block is not very robust. It uses a series of if statements instead of elif, which could lead to unexpected behavior. It also makes fragile assumptions about the input string (e.g., no surrounding text, no spaces in ````json`), which might not hold true for all LLM outputs. A more robust approach using regular expressions, similar to the official CL-bench evaluation script, would be better. This would handle variations in code block formatting and extract the JSON content more reliably.
Please also add import re at the top of the file to support this change.
| def extract_json_block(result_text: str) -> Optional[str]: | |
| # Remove code block wrapper if present | |
| if result_text.startswith('```json'): | |
| result_text = result_text[7:] | |
| if result_text.startswith('```'): | |
| result_text = result_text[3:] | |
| if result_text.endswith('```'): | |
| result_text = result_text[:-3] | |
| result_text = result_text.strip() | |
| return result_text | |
| def extract_json_block(result_text: str) -> Optional[str]: | |
| """Extracts a JSON block from a string.""" | |
| text = result_text.strip() | |
| # First, attempt to find a JSON block enclosed in triple backticks | |
| match = re.search(r'```(?:json)?\s*([\s\S]*?)\s*```', text) | |
| if match: | |
| return match.group(1).strip() | |
| # If no backticks, try to find content between the first '{' and the last '}' | |
| first_brace_index = text.find('{') | |
| last_brace_index = text.rfind('}') | |
| if first_brace_index != -1 and last_brace_index > first_brace_index: | |
| return text[first_brace_index:last_brace_index + 1] | |
| # As a last resort, return the stripped text, assuming it might be a raw JSON string. | |
| return text |
| def load(self): | ||
| last_error = None | ||
| original_split = self.eval_split | ||
| candidate_splits = [original_split] # only eval on the original split, but or subsequent adaptation, if needed | ||
| seen = set() | ||
| for split in candidate_splits: | ||
| if not split or split in seen: | ||
| continue | ||
| seen.add(split) | ||
| try: | ||
| self.eval_split = split | ||
| return super().load() | ||
| except Exception as exc: | ||
| last_error = exc | ||
| logger.warning(f'Failed to load CL-bench split "{split}": {exc}') | ||
| if original_split: | ||
| self.eval_split = original_split | ||
| if last_error: | ||
| raise last_error | ||
| return super().load() |
There was a problem hiding this comment.
The load method's implementation is overly complex for its current functionality. The candidate_splits list contains only one element, making the loop and the seen set redundant. Furthermore, the final return super().load() statement is unreachable under normal circumstances, which can be confusing. The logic can be greatly simplified to a try-except block, which would be more readable and maintainable.
| def load(self): | |
| last_error = None | |
| original_split = self.eval_split | |
| candidate_splits = [original_split] # only eval on the original split, but or subsequent adaptation, if needed | |
| seen = set() | |
| for split in candidate_splits: | |
| if not split or split in seen: | |
| continue | |
| seen.add(split) | |
| try: | |
| self.eval_split = split | |
| return super().load() | |
| except Exception as exc: | |
| last_error = exc | |
| logger.warning(f'Failed to load CL-bench split "{split}": {exc}') | |
| if original_split: | |
| self.eval_split = original_split | |
| if last_error: | |
| raise last_error | |
| return super().load() | |
| def load(self): | |
| try: | |
| return super().load() | |
| except Exception as exc: | |
| logger.warning(f'Failed to load CL-bench split "{self.eval_split}": {exc}') | |
| raise |
|
More results +---------+-----------+----------+----------+-------+---------+---------+
| Model | Dataset | Metric | Subset | Num | Score | Cat.0 |
+=========+===========+==========+==========+=======+=========+=========+
| gpt-5.1 | cl_bench | mean_acc | default | 100 | 0.17 | default |
+---------+-----------+----------+----------+-------+---------+---------+ |
|
Thank you for your PR, could you fix the lint issues? Run the following command: pip install pre-commit
pre-commit install
pre-commit run --all-files |
Yunnglin
left a comment
There was a problem hiding this comment.
I fixed the Lint issues, avoided the handling of quotes, and added relevant documentation. Thank you for your PR, it can be merged.
This PR adds CL-bench support to EvalScope by registering cl_bench and loading tencent/CL-bench from HuggingFace, running inference from the dataset’s OpenAI-style messages and reporting rubric-based mean_acc via LLM-as-a-judge. I tested with gpt-5.1 on 10 samples (limit=10) and got mean_acc = 0.10 on the default subset.
Test config (TaskConfig):
Result summary: