mbpp-lance / README.md
tsmithv11's picture
Publish mbpp in Lance format (#1)
dac5fc7
|
Raw History Blame Contribute Delete
4.06 kB
---
pretty_name: Mostly Basic Python Problems (MBPP) in Lance
license: cc-by-4.0
language:
- en
task_categories:
- text-generation
tags:
- lance
- vector-search
- python
- code-generation
- benchmark
size_categories:
- 1K<n<10K
configs:
- config_name: full
data_files:
- split: train
path: viewer/full/train-00000-of-00001.parquet
- split: validation
path: viewer/full/validation-00000-of-00001.parquet
- split: test
path: viewer/full/test-00000-of-00001.parquet
- split: prompt
path: viewer/full/prompt-00000-of-00001.parquet
- config_name: sanitized
data_files:
- split: train
path: viewer/sanitized/train-00000-of-00001.parquet
- split: validation
path: viewer/sanitized/validation-00000-of-00001.parquet
- split: test
path: viewer/sanitized/test-00000-of-00001.parquet
- split: prompt
path: viewer/sanitized/prompt-00000-of-00001.parquet
---
# Mostly Basic Python Problems (MBPP) in Lance
Search English descriptions of entry-level Python exercises and identify matching benchmark tasks by their original IDs. [Original dataset at the converted revision](https://huggingface.co/datasets/google-research-datasets/mbpp/tree/4bb6404fdc6cacfda99d4ac4205087b89d32030c)
## Data and splits
The `full` configuration has 974 rows. The `sanitized` configuration preserves 427 reviewed versions of tasks from the full benchmark. Both retain the original split membership, row order, code, and test fields. The `prompt` split contains few-shot examples.
| Configuration | Train | Validation | Test | Prompt |
|---|---:|---:|---:|---:|
| `full` | 374 | 90 | 500 | 10 |
| `sanitized` | 120 | 43 | 257 | 7 |
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 original English task description in `text` (full) or `prompt` (sanitized). 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 = "Given a list of strings, find the longest prefix shared by every string."
vector = encoder.encode_query(query, normalize_embeddings=True)
tasks = lance.dataset("hf://datasets/lance-format/mbpp-lance/data/full/test.lance")
hits = tasks.to_table(
columns=["task_id", "text", "_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['text']}")
```
## Attribution and license
Credit Google Research, Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, and Charles Sutton. The source and this release are distributed under [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/). 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/google-research/google-research/tree/master/mbpp) · [Benchmark paper](https://arxiv.org/abs/2108.07732)