Datasets:
File size: 4,637 Bytes
1e8c11a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | ---
license: mit
task_categories:
- text-generation
language:
- en
- code
tags:
- code-review
- benchmark
- code-generation
- software-engineering
size_categories:
- 10K<n<100K
configs:
- config_name: code-editing
data_files:
- split: train
path: data/code-editing/train/*.parquet
- split: test
path: data/code-editing/test/*.parquet
- split: validation
path: data/code-editing/validation/*.parquet
- config_name: comment-generation
data_files:
- split: train
path: data/comment-generation/train/*.parquet
- split: test
path: data/comment-generation/test/*.parquet
- split: validation
path: data/comment-generation/validation/*.parquet
- config_name: default
data_files:
- split: train
path: data/code-editing/train/*.parquet
- split: test
path: data/code-editing/test/*.parquet
- split: validation
path: data/code-editing/validation/*.parquet
---
# CodeReview-Bench
A benchmark for evaluating models on two code review tasks, curated from [ronantakizawa/github-codereview](https://huggingface.co/datasets/ronantakizawa/github-codereview).
## Tasks
### 1. Code Editing
Given code and a reviewer comment, apply the requested change.
- **Input**: `before_code`, `reviewer_comment`, `language`, `diff_context`
- **Target**: `after_code`
```python
from datasets import load_dataset
ds = load_dataset("ronantakizawa/codereview-bench", "code-editing")
example = ds["test"][0]
prompt = f"""Apply the following review comment to the code.
Review: {example['reviewer_comment']}
Code:
{example['before_code']}
Updated code:"""
```
### 2. Comment Generation
Given a code diff, generate the review comment a human reviewer would write.
- **Input**: `before_code`, `after_code`, `diff_context`, `language`
- **Target**: `reviewer_comment`
```python
ds = load_dataset("ronantakizawa/codereview-bench", "comment-generation")
example = ds["test"][0]
prompt = f"""Review the following code change and provide feedback.
Before:
{example['before_code']}
After:
{example['after_code']}
Review comment:"""
```
## Filtering Criteria
This benchmark is a quality-filtered subset of the full dataset:
| Filter | Threshold |
|--------|-----------|
| Positive examples only | `is_negative = False` |
| Quality score | >= 0.5 |
| Comment length | >= 50 characters |
| Code context | >= 10 lines (before and after) |
| Comment types | bug, security, performance, refactor, suggestion |
Excluded: nitpick, style, question, and negative examples.
## Schema
### Code Editing
| Column | Type | Role |
|--------|------|------|
| `before_code` | string | Input |
| `reviewer_comment` | string | Input |
| `language` | string | Input |
| `diff_context` | string | Input |
| `after_code` | string | Target |
| `repo_name` | string | Metadata |
| `file_path` | string | Metadata |
| `comment_type` | string | Metadata |
| `quality_score` | float | Metadata |
### Comment Generation
| Column | Type | Role |
|--------|------|------|
| `before_code` | string | Input |
| `after_code` | string | Input |
| `diff_context` | string | Input |
| `language` | string | Input |
| `reviewer_comment` | string | Target |
| `repo_name` | string | Metadata |
| `file_path` | string | Metadata |
| `comment_type` | string | Metadata |
| `quality_score` | float | Metadata |
## Evaluation
### Code Editing
- **CodeBLEU**: Measures structural and syntactic similarity of generated code
- **Exact match**: Percentage of outputs matching the target exactly
- **Edit similarity**: Normalized edit distance between generated and target code
### Comment Generation
- **BERTScore**: Semantic similarity between generated and reference comments
- **ROUGE-L**: Longest common subsequence overlap
- **Human evaluation**: Recommended for final assessment — automated metrics correlate poorly with review quality
## Splits
| Split | Description |
|-------|-------------|
| train | Training data (90%) |
| test | Held-out evaluation (5%) |
| validation | Development/tuning (5%) |
Splits are repo-deterministic — no repo appears in multiple splits.
## Citation
```bibtex
@dataset{takizawa2026codereviewbench,
title={CodeReview-Bench: A Benchmark for Review-Driven Code Changes},
author={Takizawa, Ronan},
year={2026},
publisher={Hugging Face},
url={https://huggingface.co/datasets/ronantakizawa/codereview-bench}
}
```
|