humaneval-x-eval
CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X — Zheng et al. (2023) (arXiv:2303.17568, 2023)
What this evaluates
Evaluates multilingual code generation and code translation capabilities across five programming languages (C++, Java, JavaScript, Go, Python). It measures functional correctness by executing generated code against a suite of test cases for each problem.
Datasets
- HumanEval-X — total 820; splits: test (820)
Metrics
pass@k (primary) — range: [0, 1]
- Estimates the probability that at least one of k samples passes all test cases out of n total generations: pass@k = E[1 - C(n-c, k) / C(n, k)], where c is the number of samples passing all tests, n=200, and k∈{1, 10, 100}. Averaged over all problems.
Input / output format
Input: For code generation: function declaration and docstring. For code translation: function declaration in the target language and canonical solution in the source language.
Output: Generated function implementation in the target language.
Scoring recipe
def compute_pass_at_k(generations, test_cases, k=10, n=200):
passed = [1 if run_tests(gen, test_cases) else 0 for gen in generations]
c = sum(passed)
if n < k or c == n: return 1.0
return 1.0 - comb(n - c, k) / comb(n, k)
# Average single-problem pass@k over all problems in the dataset
Common pitfalls
- Using string similarity metrics like BLEU or CodeBLEU instead of functional correctness via test execution.
- Ignoring language-specific behaviors in test cases (e.g., rounding rules, string prefixes) which can cause false negatives if not handled per language.
- Failing to account for budget allocation when evaluating multilingual models across multiple languages simultaneously.
Evidence (verbatim from paper)
Metric. For both tasks, we use test cases to evaluate the exact functional correctness of the generated code, measuring the performance with pass@$k$ (Kulal et al., 2019), making it real-world useful and also completely different from the string similarity metrics like BLEU(Papineni et al., 2002), and CodeBLEU(Ren et al., 2020; Lu et al., 2021; Zhu et al., 2022). Specifically, we use the unbiased method to estimate pass@$k$ (Chen et al., 2021): pass@k:=E[1-(n-c k)/(n k)],n=200,k∈{1,10,100} where n is the total number of generation (n=200 in this work), k is the sampling budget (typically k∈{1, 10, 100}) and c is the number of samples that pass all test cases.
Citation
@misc{zheng2023codegeex,
title={CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X},
author={Zheng et al. (2023)},
year={2023},
note={arXiv:2303.17568}
}
1---2name: humaneval-x-eval3description: Evaluates multilingual code generation and code translation capabilities across five programming languages (C++, Java, JavaScript, Go, Python). It measures functional correctness by executing generated code against a suite of test cases for each problem. Use when the user wants to benchmark on HumanEval-X, or asks about evaluating this task. Reports pass@k.4---56# humaneval-x-eval78> CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X — Zheng et al. (2023) (arXiv:2303.17568, 2023)910## What this evaluates1112Evaluates multilingual code generation and code translation capabilities across five programming languages (C++, Java, JavaScript, Go, Python). It measures functional correctness by executing generated code against a suite of test cases for each problem.1314## Datasets1516- **HumanEval-X** — total 820; splits: test (820)1718## Metrics1920- `pass@k` **(primary)** — range: [0, 1]21 - Estimates the probability that at least one of k samples passes all test cases out of n total generations: pass@k = E[1 - C(n-c, k) / C(n, k)], where c is the number of samples passing all tests, n=200, and k∈{1, 10, 100}. Averaged over all problems.2223## Input / output format2425**Input**: For code generation: function declaration and docstring. For code translation: function declaration in the target language and canonical solution in the source language.2627**Output**: Generated function implementation in the target language.2829## Scoring recipe3031```python32def compute_pass_at_k(generations, test_cases, k=10, n=200):33 passed = [1 if run_tests(gen, test_cases) else 0 for gen in generations]34 c = sum(passed)35 if n < k or c == n: return 1.036 return 1.0 - comb(n - c, k) / comb(n, k)3738# Average single-problem pass@k over all problems in the dataset39```4041## Common pitfalls4243- Using string similarity metrics like BLEU or CodeBLEU instead of functional correctness via test execution.44- Ignoring language-specific behaviors in test cases (e.g., rounding rules, string prefixes) which can cause false negatives if not handled per language.45- Failing to account for budget allocation when evaluating multilingual models across multiple languages simultaneously.4647## Evidence (verbatim from paper)4849> Metric. For both tasks, we use test cases to evaluate the exact functional correctness of the generated code, measuring the performance with pass@$k$ (Kulal et al., 2019), making it real-world useful and also completely different from the string similarity metrics like BLEU(Papineni et al., 2002), and CodeBLEU(Ren et al., 2020; Lu et al., 2021; Zhu et al., 2022). Specifically, we use the unbiased method to estimate pass@$k$ (Chen et al., 2021): pass@k:=E[1-(n-c k)/(n k)],n=200,k∈{1,10,100} where n is the total number of generation (n=200 in this work), k is the sampling budget (typically k∈{1, 10, 100}) and c is the number of samples that pass all test cases.5051## Citation5253```bibtex54@misc{zheng2023codegeex,55 title={CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X},56 author={Zheng et al. (2023)},57 year={2023},58 note={arXiv:2303.17568}59}60```6162- arXiv: 2303.17568