遇见数据集

McGill-NLP/CHASE-Code

收藏
Hugging Face2025-02-21 更新2025-04-12 收录
官方服务:

资源简介:

--- license: mit task_categories: - text2text-generation size_categories: - n<1K tags: - code --- <h1 align="center"> CHASE: Challenging AI with Synthetic Evaluations </h1> <p align="center"> <a href="https://arxiv.org/pdf/2502.14678"><img src="http://img.shields.io/badge/Paper-PDF-red.svg"></a> </p> <p style="text-align: justify;"> The pace of evolution of Large Language Models (LLMs) necessitates new approaches for rigorous and comprehensive evaluation. Traditional human annotation is increasingly impracticable due to the complexities and costs involved in generating high-quality, challenging problems. In this work, we introduce **CHASE**, a unified framework to synthetically generate challenging problems using LLMs without human involvement. For a given task, our approach builds a hard problem in a bottom-up manner from simpler components. Moreover, our framework decomposes the generation process into independently verifiable sub-tasks, thereby ensuring a high level of quality and correctness. We implement CHASE to create evaluation benchmarks across three diverse domains: (1) document-based question answering, (2) repository-level code completion, and (3) math reasoning. The performance of state-of-the-art LLMs on these synthetic benchmarks lies in the range of 40-60% accuracy, thereby demonstrating the effectiveness of our framework at generating challenging problems. </p> <h2 align="center"> <img align="center" src="./chase_fig.svg" alt="..." width="700"> </h2> Code: https://github.com/McGill-NLP/CHASE # Setup Install VirtualEnv using the following (optional): ```shell $ [sudo] pip install virtualenv ``` Create and activate your virtual environment (optional): ```shell $ virtualenv -p python3 chasenv $ source chasenv/bin/activate ``` Depending on your machine, you may have to do: ```shell $ python3 -m venv chasenv $ source chasenv/bin/activate ``` ## Dependencies - compatible with python 3 - dependencies can be installed using `CHASE/requirements.txt` - Works best with CUDA 12.5 (otherwise you may have to struggle with installation of individual libraries) Install all the required packages: at `CHASE/:` ```shell $ pip install -r requirements.txt ``` # Usage for CHASE-Code ## A. Generating CHASE-Code Note: Executing the generation or solving files may create some noise files in the directory such as "sandbox*" directories or random data files. These can be deleted after the execution is over. ### Generate helper functions We shall use GPT-4o-mini to generate helper functions (each iteration attempts to generate 5) for the 'data pre-processing' domain. Note that many iterations will fail because of parsing errors or if the generated helper function fails to execute. At `code/`: ```shell $ python generator.py -exp_type helper_functions -prompt_type helper_functions -model_type chat -model gpt-4o-mini -domain data_preprocessing -num_iters 5 ``` This will create a new json file within `CHASE/code/helper_functions/generated` with the name `[domain]_new.json` which will store the model generated helper functions. If there already exist helper functions of this domain previously generated/used in a `[domain].json` file, then just manually transfer the newly generated data points from the new file to the old one. If not, just remove `_new` from the name. The next step will expect all helper functions in `[domain].json` file. ### Generate problem statement and answer code We shall use GPT-4o-mini to generate pairs of (problem statement, answer code) (each iteration attempts to generate 1 pair) for the 'data pre-processing' domain. Our default prompt urges the model to use at least 4 helper functions (out of 10 randomly sampled) in the answer code. Note that many iterations will fail because of parsing errors or if the generated answer code fails to execute. At `code/`: ```shell $ python generator.py -exp_type problem_statement -prompt_type problem_statement -model_type chat -model gpt-4o-mini -domain data_preprocessing -num_iters 30 -run_name gpt-4o-mini-problems ``` This will create a new directory within `CHASE/code/generation_outputs` with the name `gpt-4o-mini-problems` which will store the model generated problems in a `problems.tsv` file. ### Generate test code for the problems We shall use GPT-4o-mini to generate test codes for the problems we generated. The number of iterations reflects the number of attempts (inference calls) to generate a test code for each problem. At `code/`: ```shell $ python generator.py -exp_type test -prompt_type test -model_type chat -model gpt-4o-mini -domain data_preprocessing -num_iters 10 -problems_name gpt-4o-mini-problems -run_name gpt-4o-mini-tests ``` This will create a new directory within `CHASE/code/generation_outputs` with the name `gpt-4o-mini-tests` which will store the model generated problems and corresponding tests in a `tested_problems.tsv` file. ### Verify correspondence of problem specification with answer code We shall use GPT-4o to check if the problem statement correctly specifies the answer code, when provided with the correct set of relevant helper functions. At `code/`: ```shell $ python generator.py -exp_type verify_problems -prompt_type verify_problems -model_type chat -model gpt-4o -domain data_preprocessing -num_iters 2 -tested_name gpt-4o-mini-tests -run_name gpt-4o-mini-verified ``` This will create a new directory within `CHASE/code/generation_outputs` with the name `gpt-4o-mini-verified` which will store the verified problems and corresponding tests in a `verified_problems.tsv` file. ### Get final data with large repository contexts For each problem, we shall create a large repository context across multiple files by sampling 10 random helper functions for each relevant helper function. At `code/`: ```shell $ python generator.py -exp_type final_data -domain data_preprocessing -verified_name gpt-4o-mini-verified -run_name gpt-4o-mini-final -extra_fns 10 ``` This will create a new directory within `CHASE/code/generation_outputs` with the name `gpt-4o-mini-final` which will store the final data file: `final_data.tsv`. ## B. Solving CHASE-Code We will show an example of using the Llama-3.3-70B model to solve the CHASE-Code examples. Host the Llama model locally using [vllm](https://github.com/vllm-project/vllm) (Assuming 2 A100s): ```shell $ CUDA_VISIBLE_DEVICES=0,1 python -m vllm.entrypoints.openai.api_server --model meta-llama/Llama-3.3-70B-Instruct --download-dir YOUR_DOWNLOAD_DIR --tensor-parallel-size 2 --max_model_len 16000 --gpu_memory_utilization 0.95 ``` Then query the hosted model. At `code/`: ```shell $ python solver.py -data chase_code_dp.tsv -prompt_type basic -model_type vllm -model meta-llama/Llama-3.3-70B-Instruct -run_name chase_code_llama ``` The output logs and predictions will be stored in the `outputs/chase_code_llama` folder. ## C. Viewing CHASE-Code If you want to manually review say the "5th" example from CHASE-Code, At `code/`: ```shell $ python convert_files.py -data_dir data/ -data chase_code_dp -path readable_data/ -example 5 ``` This will create a new directory `readable_data` with a txt file where you will be more easily able to parse the example. You can also set `-example all` to convert the entire dataset into readable txt files. # Citation If you use our data or code, please cite our work: ``` @misc{patel2025llmgeneratechallengingproblems, title={How to Get Your LLM to Generate Challenging Problems for Evaluation}, author={Arkil Patel and Siva Reddy and Dzmitry Bahdanau}, year={2025}, eprint={2502.14678}, archivePrefix={arXiv}, primaryClass={cs.CL}, url={https://arxiv.org/abs/2502.14678}, } ``` For any clarification, comments, or suggestions please contact [Arkil](http://arkilpatel.github.io/).

CHASE (Challenging AI with Synthetic Evaluations) is a unified framework for synthetically generating challenging problems for Large Language Models (LLMs) without human involvement. The framework decomposes the generation process into independently verifiable sub-tasks, ensuring high quality and correctness of the generated problems. CHASE is applied across three diverse domains: document-based question answering, repository-level code completion, and math reasoning.

提供机构:
McGill-NLP
搜集汇总
数据集介绍
构建方式
在大型语言模型迅猛演进的背景下,传统人工标注因成本高昂且难以生成高难度问题而日益受限。为此,CHASE框架应运而生,旨在无需人工介入的情况下,利用语言模型自底向上合成挑战性问题。针对代码补全领域,CHASE-Code数据集的构建遵循一套严谨的流水线:首先生成可独立执行的辅助函数,随后基于这些函数合成问题陈述与答案代码,接着自动生成测试代码以验证答案的正确性,再通过高阶模型核查问题描述与答案代码的一致性,最后为每个问题注入包含多个文件的仓库级上下文,从而模拟真实开发场景。
特点
CHASE-Code数据集的核心特征在于其高度结构化的自洽性与生态真实性。每个问题均以自底向上的方式从原子化的辅助函数逐步构建,确保任务逻辑的清晰与可验证性。生成过程中嵌入了多轮自动校验机制,包括代码执行测试与描述一致性审查,从而有效规避了合成数据中常见的错误累积问题。此外,通过为每个问题配备一个包含随机采样辅助函数的多文件仓库上下文,数据集在保持问题挑战性的同时,精准复现了开发者面对跨文件代码补全时的复杂认知负荷,使得当前最先进模型在该基准上的准确率仅徘徊于40%至60%之间。
使用方法
CHASE-Code数据集的使用主要涵盖生成、求解与查看三个维度。研究者可通过运行generator.py脚本,依次指定辅助函数生成、问题合成、测试编写、验证核查及最终数据构建等阶段,并自由调节迭代次数与模型后端(如GPT-4o-mini)以适配不同需求。求解时,可利用solver.py配合本地部署的vLLM服务(如Llama-3.3-70B)对数据集进行推理,输出结果自动存储于指定目录。此外,convert_files.py工具支持将结构化数据转换为可读的文本格式,便于人工审查特定样例或整体评估数据质量,从而为代码智能领域的评估研究提供灵活而坚实的支撑。
背景与挑战
背景概述
CHASE-Code数据集由McGill-NLP团队于2025年创建,旨在应对大语言模型在代码补全任务中面临的评估困境。随着LLMs能力的飞速提升,传统人工标注方法因成本高昂且难以生成足够复杂的问题而逐渐失效。该数据集聚焦于仓库级别的代码补全,通过自底向上的合成方法,从简单组件逐步构建复杂问题,并引入可独立验证的子任务机制来保证生成质量。其核心研究问题在于如何在不依赖人类参与的前提下,自动生成能够有效区分模型性能的高难度评估基准。CHASE-Code的发布为代码智能领域提供了一种全新的评估范式,促使研究者重新审视现有模型在真实开发场景中的代码理解与生成能力。
当前挑战
当前CHASE-Code面临的主要挑战包括:1)领域问题层面,仓库级代码补全要求模型不仅理解局部代码片段,还需把握跨文件的全局上下文依赖关系,这对LLMs的长程语义建模能力构成严峻考验。2)构建过程中,合成数据虽避免了人工标注瓶颈,但如何确保生成问题的难度稳定且可调节、如何避免模型在自验证环节产生虚假关联,仍是技术难点。此外,数据集规模较小(不足1000条),可能限制其在模型能力边界探测上的统计显著性。未来需进一步扩展领域覆盖范围并提升问题多样性,以应对快速演进的LLMs评估需求。
常用场景
经典使用场景
在代码智能与软件工程领域,CHASE-Code数据集被广泛用于评估大型语言模型在仓库级别的代码补全能力。该数据集通过自底向上的合成方法,从简单组件构建出具有挑战性的编程问题,并模拟真实开发环境中的多文件仓库上下文,要求模型在理解跨文件依赖关系的基础上生成正确的代码片段。研究者常将其作为基准测试,衡量模型对复杂代码逻辑、函数调用链及API使用规范的掌握程度,尤其关注模型在需要整合多个辅助函数时的表现。
解决学术问题
CHASE-Code数据集着力解决传统代码补全评估中任务难度不足与人工标注成本过高的问题。现有基准多聚焦于单文件或短序列补全,难以反映模型处理真实仓库级协作开发的瓶颈。该数据集通过自动生成包含多步推理与依赖约束的编程问题,系统性地测试模型在长上下文理解、函数复用与代码正确性验证方面的能力,为量化LLM在代码生成任务中的上限提供了可靠工具,推动了代码智能评估范式的革新。
衍生相关工作
围绕CHASE-Code数据集衍生了一系列探索性工作,包括利用其合成框架改进其他领域(如文档问答与数学推理)的评估基准。研究者借鉴其自底向上的问题生成策略,构建了更具区分度的代码理解任务,并尝试将验证子任务机制引入代码修复与测试生成场景。此外,该数据集催生了关于LLM在代码生成中依赖捕获能力的研究,推动了诸如上下文增强检索与多步推理增强等方法的提出,为构建更鲁棒的代码智能系统提供了理论支撑。
以上内容由遇见数据集搜集并总结生成
二维码
社区交流群
二维码
科研交流群
商业服务