RustEvo²
收藏RustEvo² 数据集概述
数据集简介
- 来源:基于论文《RustEvo²: An Evolving Benchmark for API Evolution in LLM-based Rust Code Generation》构建
- 目的:为基于LLM的Rust代码生成提供API演化基准测试
数据集构成
数据收集阶段(Phase I)
- 数据来源:官方Rust仓库和15个第三方crate
- 分析内容:变更日志、文档和实现变更
- API变更分类:
- Stabilizations(稳定化,31.3%)
- Signature Changes(签名变更,31.5%)
- Behavioral Changes(行为变更,33.2%)
- Deprecations(弃用,4.1%)
数据集构建阶段(Phase II)
- 总数量:588个API变更(380个来自Rust标准库,208个来自第三方crate)
- 版本范围:Rust 1.71.0至1.84.0
- 任务结构:
- API变更信息
- 编程查询
- 函数签名
- 参考解决方案
- 测试程序
数据集格式示例
json { "task_idx": 39, "query": "In a performance-critical application...", "function_signature": "fn update_collection<T: Clone>(target: &mut Vec<T>, source: &Vec<T>)", "code": "fn update_collection<T: Clone>(target: &mut Vec<T>, source: &Vec<T>) {...}", "test_program": "..." }
使用说明
环境准备
-
创建Python环境: bash conda create -n RustEvo python=3.8 conda activate RustEvo pip install -r requirements.txt
-
安装Rust工具链: bash curl --proto =https --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup toolchain install 1.71.0 1.72.0 ... 1.84.0
数据集构建
-
API变更收集: bash python scripts/rust_api_analyzer.py --repo ./rust-repo --output ./reports --start 1.72.0 --end 1.84.0 python scripts/crate_analyzer.py --crates_num 15 --start_date 2024-01-01 --end_date 2025-02-21
-
任务生成: bash python scripts/generate_query.py --input ./reports/rust_api_changes.json --output ./data/queries/queries_rust.json python scripts/generate_code.py --input ./data/queries/queries_rust.json --output ./data/codes/codes_rust.json python scripts/generate_test.py --input_file ./data/codes/codes_rust.json --output_file ./data/test_programs/test_programs_rust.json
评估结果
模型性能对比
| 模型 | Pass@1 (%) | API使用准确率 (%) | 覆盖率 (%) |
|---|---|---|---|
| Claude-3.7-Sonnet | 65.3 | 78.2 | 83.6 |
| o1-mini | 57.5 | 70.4 | 85.2 |
| GPT-4o | 55.4 | 68.4 | 77.2 |
按变更类型分类性能
| 变更类型 | 平均Pass@1 (%) |
|---|---|
| Stabilizations | 65.8 |
| Signature Changes | 58.2 |
| Behavioral Changes | 38.0 |
| Deprecations | 40.4 |




