tsmithv11's picture
Publish openai-humaneval in Lance format (#1)
ebe97d9
|
Raw History Blame Contribute Delete
3.38 kB
---
pretty_name: OpenAI HumanEval in Lance
license: mit
language:
- en
task_categories:
- text-generation
tags:
- lance
- vector-search
- python
- code-generation
- benchmark
size_categories:
- n<1K
configs:
- config_name: openai_humaneval
data_files:
- split: test
path: viewer/openai_humaneval/test-00000-of-00001.parquet
---
# OpenAI HumanEval in Lance
Search the natural-language descriptions of Python programming problems and identify matches by their original task IDs and function names. [Original dataset at the converted revision](https://huggingface.co/datasets/openai/openai_humaneval/tree/7dce6050a7d6d172f3cc5c32aa97f52fa1a2e544)
## Data and splits
The original `openai_humaneval` configuration has one test split with all 164 problems in their original order. Each row retains its task ID, complete prompt, canonical solution, test source, and entry point.
| Configuration | Train | Validation | Test | Prompt |
|---|---:|---:|---:|---:|
| `openai_humaneval` | — | — | 164 | — |
Open each split at `data/<configuration>/<split>.lance`. Hugging Face Data Studio uses byte-identical copies of the original Parquet files in `viewer/`. The [conversion metadata](meta/conversion.json) records every split's path, row count, columns, and checksum.
## Search in Python
This release generated normalized 256-dimensional float32 vectors from the English problem description extracted from the entry-point function's first standalone string in the original `prompt` field. The encoder is `sentence-transformers/static-retrieval-mrl-en-v1` at revision `f60985c706f192d45d218078e49e5a8b6f15283a`. The code uses the compatible query encoder and an exact cosine search over the chosen split. It prints cosine similarity and identifying fields for five matches. [Pinned encoder](https://huggingface.co/sentence-transformers/static-retrieval-mrl-en-v1/tree/f60985c706f192d45d218078e49e5a8b6f15283a)
```bash
pip install pylance==14.0.3 sentence-transformers==6.3.0
```
```python
import lance
from sentence_transformers import SentenceTransformer
encoder = SentenceTransformer(
"sentence-transformers/static-retrieval-mrl-en-v1",
revision="f60985c706f192d45d218078e49e5a8b6f15283a",
truncate_dim=256,
device="cpu",
)
query = "Split a string of nested parentheses into separate balanced groups."
vector = encoder.encode_query(query, normalize_embeddings=True)
tasks = lance.dataset("hf://datasets/lance-format/openai-humaneval-lance/data/openai_humaneval/test.lance")
hits = tasks.to_table(
columns=["task_id", "entry_point", "_distance"],
nearest={"column": "task_embedding", "q": vector, "k": 5, "metric": "cosine"},
).to_pylist()
for hit in hits:
print(f"{1.0 - hit['_distance']:.4f}\t{hit['task_id']}\t{hit['entry_point']}")
```
## Attribution and license
Credit OpenAI, Mark Chen, Jerry Tworek, Heewoo Jun, and the authors of *Evaluating Large Language Models Trained on Code*. The source and this release are distributed under [MIT](https://github.com/openai/human-eval/blob/master/LICENSE). The conversion adds the Lance format and description embeddings. The published Parquet copies preserve the source bytes. The release retains the [original dataset card](source/README.md) and [license text](LICENSE.txt). [Project repository](https://github.com/openai/human-eval) · [Benchmark paper](https://arxiv.org/abs/2107.03374)