ClassEval / README.md
ilintar's picture
Add dataset card documenting the six patches
90982f1 verified
|
Raw
History Blame Contribute Delete
5.52 kB
---
license: cc-by-nc-4.0
task_categories:
- text-generation
language:
- en
tags:
- code-generation
- benchmark
- classeval
pretty_name: ClassEval (modernised)
size_categories:
- n<1K
---
# ClassEval (modernised)
A lightly patched fork of [FudanSELab/ClassEval](https://huggingface.co/datasets/FudanSELab/ClassEval),
the 100-task class-level Python code generation benchmark, fixed so that it
still runs correctly on a current Python and a current NumPy.
**The benchmark itself is unchanged.** Every patch either repairs a test that no
implementation could pass, or repairs the reference solution. No task was made
easier, no prompt (`skeleton`) was touched, and nothing about what a model is
asked to write has changed.
| | upstream | this fork |
|---|---:|---:|
| classes whose reference solution passes all its tests | 96 / 100 | **100 / 100** |
| test methods passed by the reference solutions | 2182 / 2196 | **2196 / 2196** |
Measured on CPython 3.13 and 3.14, NumPy 2.x, in a network-isolated sandbox.
## What was changed
Six edits across five tasks. Schema, task ids and field names are identical to
upstream.
### Tests that no implementation could pass
- **ClassEval_17** (`CalendarUtil`) — a time bomb. `get_upcoming_events()`
filters on `event['start_time'] >= datetime.now()`, but the test hard-codes a
2024-01-02 event as the "upcoming" one, so the task became unpassable once the
wall clock passed that date. The event now sits at `datetime.now().year + 1`;
the companion 2023 event, which must stay in the past, is untouched.
- **ClassEval_31** (`DataStatistics4`) — `assertEqual` on a Pearson correlation
coefficient. NumPy 2.x returns `0.9819805060619655` against a recorded
`0.9819805060619659`: a 4-ULP difference, the same number to 15 significant
figures. Now `assertAlmostEqual`.
- **ClassEval_48** (`IpUtil`) — asserted that a reverse DNS lookup of `0.0.0.0`
returns `'LAPTOP-2CS86KUM'`, the dataset author's own machine name. This could
never pass on any other computer. The assertion now expects `None`, which is
what the lookup yields when it fails. This is the one patch that genuinely
weakens a test: no portable replacement asserting a *successful* reverse
lookup exists.
### Reference solutions only (models are unaffected)
- **ClassEval_51** (`KappaCalculator`) — two independent NumPy 2.0 breakages:
`np.mat` was removed (now `np.asmatrix`, at both call sites), and
`float()` on a 1×1 matrix is no longer allowed (now indexes `[0, 0]`
explicitly). The second only surfaces once the first is fixed.
- **ClassEval_58** (`MinesweeperGame`) — the reference `generate_mine_sweeper_map`
drew mine coordinates without checking for collisions, so two mines could land
on the same cell and the board would contain fewer than `k` mines. It failed
its own test about 30% of the time (measured: 21/30 passes across 30 runs).
Now retries on collision, with a guard against looping on a full board.
## Known remaining quirks
Not patched, because fixing them would change what the model is shown or is
metadata rather than content:
- **ClassEval_69**'s `methods_info` maps `merge_pdfs` to `TestPDFHandler`, a
fixture-only class with zero test methods. This caps upstream's method-level
metric at 409/410 for any submission, including ground truth.
- **ClassEval_22 / _43 / _46** have malformed skeletons. That is prompt text —
patching it would change the task.
- **ClassEval_44** selects its parser by string (`BeautifulSoup(html, 'lxml')`),
so `lxml` is a hard dependency that appears in no import statement and is
absent from upstream's `requirements.txt`. Install it or that task drops from
23/23 to 7/23.
- **ClassEval_69**'s test imports `PdfFileReader` from `PyPDF2`, a name the
successor package `pypdf` removed. `PyPDF2` cannot be substituted.
## Running it
Reproduced by `llama-eval` in llama.cpp, which executes generated classes in a
sandboxed venv (no Docker) and reports class-level and method-level scores:
```bash
python3 llama-eval.py --server http://localhost:8033 --model my-model \
--dataset classeval --n_predict 4096 --temperature 0
```
Notes for anyone building their own runner:
- **Do not execute as uid 0.** ClassEval_50 asserts that writing to a `chmod
0444` file fails; root bypasses permission bits, so it silently scores 14/16.
- Give each task its own working directory — 15 tasks write files, all
cwd-relative, and the names collide.
- Seed the global RNG before each test if you want reproducible verdicts.
- `gensim` publishes no wheel past cp313. Only two pure-Python APIs are used
(`utils.decode_htmlentities`, `matutils.unitvec`), so a small shim covers 3.14.
- NLTK needs exactly `punkt_tab`, `averaged_perceptron_tagger_eng` and
`wordnet` (~33 MB). These are the modern names; the dataset asks for the
renamed `punkt` / `averaged_perceptron_tagger`.
## Licence and attribution
Original work: [FudanSELab/ClassEval](https://github.com/FudanSELab/ClassEval),
from *"ClassEval: A Manually-Crafted Benchmark for Evaluating LLMs on
Class-level Code Generation"* ([arXiv:2308.01861](https://arxiv.org/abs/2308.01861)).
Upstream distributes the code under MIT and **the data under
[CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/)**; this modified
dataset is redistributed under the same CC BY-NC 4.0 terms.
This is a **modified** version. For the unmodified benchmark, use
[FudanSELab/ClassEval](https://huggingface.co/datasets/FudanSELab/ClassEval).