Skip to main content

Nerdsking HumanEval Benchmark for llama.cpp (GGUF)

A strict, auditable HumanEval benchmark runner for GGUF models served via llama.cpp, using its OpenAI-compatible HTTP API.

This project focuses on correct execution semantics and reproducibility:

  • Prompts are preserved verbatim (no stripping or truncation).
  • Only fenced Python code is accepted.
  • Each task is executed using strict HumanEval semantics.
  • Full outputs and failure reasons are saved for auditing.

Key Features

✅ Correct HumanEval Semantics (Strict)

For every task, execution follows exactly:

  1. Execute the original prompt (function signature + docstring)
  2. Execute the model-generated code
  3. Execute the test harness
  4. Call check(entry_point)

✅ Prompt Integrity

  • HumanEval prompts are used verbatim
  • No stripping, rewriting, or truncation
  • Only a minimal instruction header is prepended
  • Raw prompts are stored in the output JSON

✅ Strict Code Extraction

Only code inside a single fenced block is accepted:

```python
# code here

If no such block exists → **automatic failure (`no_code`)**.

---

### ✅ Full Failure Attribution
Each failed task records:
- `error_type`
- `error_detail`
- `full_response`
- `generated_code`

---

### ✅ llama.cpp Native Support
- Automatic server start/stop **or** reuse an existing server
- Uses `/v1/completions` OpenAI-compatible API
- Streaming-safe and timeout-safe
- **GGUF-only by design**

---

## Repository Structure

. ├── benchmark.py ├── HumanEval.jsonl ├── LICENSE ├── README.md └── eval_utils/ ├── init.py ├── bench_config.json └── code_bench.py


---

## Dependencies

### Required
- Python 3.10+
- llama.cpp (with server support)
- GGUF model

### Python packages
```bash
pip install requests datasets

Building llama.cpp

git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
mkdir -p build && cd build
cmake .. -DLLAMA_CUBLAS=ON
cmake --build . --config Release

Usage

Automatic server management

python benchmark.py --model model.gguf --server-path /path/to/llama.cpp/build/bin

Use existing server

python benchmark.py --server-url http://127.0.0.1:8080 --no-server

Use local HumanEval

python benchmark.py --humaneval-jsonl HumanEval.jsonl

Output

A JSON file is generated containing:

  • Full configuration
  • Per-task results
  • Raw model outputs
  • Error attribution
  • Timing metrics

License / citation

-If you use this code in research or benchmarking, please cite:

https://github.com/nerdskingcom/gguf_benchmark, IMNECHO / Nerdsking.com

Metadata

Release files for gguf-humaneval-benchmark 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gguf-humaneval-benchmark 0.1.0
File Size Uploaded Provenance Actions
gguf_humaneval_benchmark-0.1.0.tar.gz 22.4 kB Without provenance Details for gguf_humaneval_benchmark-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gguf-humaneval-benchmark 0.1.0
File Interpreter ABI Platform Actions
gguf_humaneval_benchmark-0.1.0-py3-none-any.whl Python 3 none any Details for gguf_humaneval_benchmark-0.1.0-py3-none-any.whl

Total release size: 49.3 kB

Release files / gguf_humaneval_benchmark-0.1.0.tar.gz

Download URL gguf_humaneval_benchmark-0.1.0.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6b163f765d820501d76199a226a192c06c88421056a73b850e18b1a0473db870
BLAKE2b-256 checksum
How to use checksums
885aa1626bc17c5cecb8cd98d66f4cf1b3b03e339f9fbde38967066bb7f0ce4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / gguf_humaneval_benchmark-0.1.0-py3-none-any.whl

Download URL gguf_humaneval_benchmark-0.1.0-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f41263c4015edfd806d23e888edcdae15087f1d63dd25bf8507b045461d42c48
BLAKE2b-256 checksum
How to use checksums
e68edb38ac8b35fc9dd00bcb931681d764be8b1fd7d60cbb69baec39d4270d2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Security for gguf-humaneval-benchmark 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page