Datasets:
Download README.md from lance-format/benchcad-lance: direct link, hf CLI and curl.
- Browser
- Download file 9.85 kB
-
https://huggingface.co/datasets/lance-format/benchcad-lance/resolve/refs%2Fpr%2F2/README.md
- Command line
-
hf download hf://datasets/lance-format/benchcad-lance@refs/pr/2/README.md
-
curl -L -o README.md https://huggingface.co/datasets/lance-format/benchcad-lance/resolve/refs%2Fpr%2F2/README.md
pretty_name: BenchCAD 1.0 in Lance
license: cc-by-4.0
task_categories:
- image-to-text
- text-generation
- question-answering
language:
- en
tags:
- lance
- cad
- cadquery
- 3d
- synthetic
- information-retrieval
size_categories:
- 10K<n<100K
configs:
- config_name: QA
default: true
data_files:
- split: QA
path: data/qa.lance/**
- config_name: code_gen
data_files:
- split: code_gen
path: data/code_gen.lance/**
- config_name: edit-bench
data_files:
- split: edit_bench
path: data/edit_bench.lance/**
BenchCAD 1.0 in Lance
Find BenchCAD parts by what their questions ask, then retrieve a matching render, its ground-truth CadQuery, and all questions for that part. This release covers all three BenchCAD 1.0 configurations.
Key features
- The QA table stores each composite PNG once alongside its 12 original questions.
- The code generation table preserves all five source PNGs and the CadQuery program for each part.
- The edit table preserves each instruction, both programs, and both original STEP models.
Splits
| Source config | Source split | Lance table | Source rows | Lance rows | Media |
|---|---|---|---|---|---|
QA |
QA |
qa |
2,400 questions | 200 parts | 200 composite PNGs |
code_gen |
code_gen |
code_gen |
17,900 parts | 17,900 parts | 89,500 PNGs |
edit-bench |
edit_bench |
edit_bench |
748 edits | 748 edits | 1,496 STEP models |
All 18 code-generation shards form one logical table. The QA table groups rows by stem after checking that every question assigned to that part shares identical metadata, code, and render. The auxiliary VLMEvalKit export maps one-to-one to those 2,400 questions. It supplies a separate level label for 2,042 questions, so both level labels are preserved. Release counts and configuration
Schema
| Table | Columns | Contents |
|---|---|---|
qa |
stem, family, standard, gt_code, composite_png |
Original part ID, metadata, program, and original PNG blob |
qa |
questions, qa_levels |
The original question ID, level, prompt, numeric answer, type, source, and raw JSON for each question. Each item also retains the VLMEvalKit index, level, and answer text |
qa |
question_embeddings |
Ordered list of 12 float32 vectors per part, aligned positionally to questions |
code_gen |
stem, family, variant, difficulty, base_plane, standard, code |
Original part ID, family and variants, and ground-truth CadQuery |
code_gen |
view_0_png through view_3_png, composite_png, part_embedding |
Original render blobs and one vector from the descriptive metadata |
edit_bench |
record_id, pos_id, family, edit_type, category, category_label, instruction, iou, orig_code, gt_code |
Original IDs, edit taxonomy and instruction, IoU, and both programs |
edit_bench |
orig_step, gt_step, instruction_embedding |
Original STEP model blobs and one vector from the edit instruction and family |
Pre-built indices
All three tables ship a cosine IVF_FLAT vector index and scalar indices on the source key and family. The QA table also indexes question levels. The code generation and edit tables index difficulty and edit category, respectively.
The release uses 384-dimensional Multilingual E5 small embeddings. It converts underscores in family and variant names to spaces for encoding. Each QA vector uses the family name and one original question. Each code-generation vector uses the family, variant, difficulty, base plane, and applicable standard. Each edit vector uses the family name and original edit instruction. The vectors describe these text inputs. Pinned model revision
Preprocessing adds passage: to each input and uses the model tokenizer with a 512-token cap, attention-masked mean pooling, and L2 normalization. Query text uses query: . With a single query vector, a QA part is scored by its closest question vector in cosine distance.
Why Lance?
- Random access fetches the renders for the returned part IDs.
- Part metadata, questions, image bytes, and vectors share one schema in each table.
- The index ships with the dataset, so a search can use it as soon as the table opens.
- A writable copy can gain new features without rewriting its original media.
- Indexed filters can select parts by family or QA level.
- Version tags keep the same examples accessible across evaluations.
Load with datasets.load_dataset
The Lance reader in datasets 5.2.0 expects a saved Hugging Face token. Run hf auth login before using this loader. The Lance and LanceDB examples below support anonymous access.
from datasets import load_dataset
rows = load_dataset(
"lance-format/benchcad-lance",
"QA",
split="QA",
streaming=True,
columns=["stem", "family"],
)
print(next(iter(rows)))
Load with LanceDB
LanceDB is the embedded retrieval library built on the Lance format. These examples open tables directly on the Hub. LanceDB documentation
import lancedb
db = lancedb.connect("hf://datasets/lance-format/benchcad-lance/data")
tbl = db.open_table("qa")
print(tbl.count_rows())
Load with Lance
import lance
ds = lance.dataset("hf://datasets/lance-format/benchcad-lance/data/qa.lance")
print(ds.count_rows(), ds.list_indices())
For repeated training or heavy random access, download the dataset once and open ./benchcad-lance/data locally.
hf download lance-format/benchcad-lance --repo-type dataset --local-dir ./benchcad-lance
Search
Which parts have benchmark questions about hole diameter? Search the question index to return one row per part. The example prints the closest question and saves the composite render for each of the three hits.
pip install lancedb==0.41.0 sentence-transformers==6.3.0
from pathlib import Path
import lancedb
import numpy as np
from sentence_transformers import SentenceTransformer
encoder = SentenceTransformer(
"intfloat/multilingual-e5-small",
revision="614241f622f53c4eeff9890bdc4f31cfecc418b3",
)
query = encoder.encode(
"query: what is the diameter of a hole through the part?",
normalize_embeddings=True,
)
db = lancedb.connect("hf://datasets/lance-format/benchcad-lance/data")
tbl = db.open_table("qa")
hits = (
tbl.search([query], vector_column_name="question_embeddings")
.metric("cosine")
.nprobes(1)
.select(["stem", "family", "questions", "question_embeddings", "_distance"])
.with_row_id(True)
.limit(3)
.to_list()
)
output = Path("benchcad-matches")
output.mkdir(exist_ok=True)
images = tbl.fetch_blob_files("composite_png", [hit["_rowid"] for hit in hits])
for hit, image in zip(hits, images, strict=True):
closest = int(np.argmax(np.asarray(hit["question_embeddings"]) @ query))
question = hit["questions"][closest]
(output / f"{hit['stem']}.png").write_bytes(image.read())
print(hit["stem"], question["qa_id"], question["question"])
Curate
Use a QA-level filter to collect parts for an evaluation focused on a publisher-defined difficulty level. The original questions remain attached to each candidate.
examples = (
tbl.search()
.where("array_has_all(qa_levels, ['L4'])")
.select(["stem", "family", "questions"])
.limit(20)
.to_list()
)
print([row["stem"] for row in examples])
Evolve
On a writable local subset, add the number of questions as a derived feature. Create qa_samples using the final section first.
local = lancedb.connect("./benchcad-local").open_table("qa_samples")
local.add_columns({"question_count": "array_length(questions)"})
Train
Use column projection to feed part descriptors and cached vectors into a PyTorch loop. Preserve the publisher’s benchmark split when designing an evaluation.
from lancedb.permutation import Permutation
from torch.utils.data import DataLoader
local = lancedb.connect("./benchcad-local").open_table("qa_samples")
features = Permutation.identity(local).select_columns(["stem", "question_embeddings"])
for batch in DataLoader(features, batch_size=16):
print(batch.keys())
break
Versioning
Pin the released QA table by version so that comparisons use the same question IDs, renders, and search index.
print(tbl.tags.list())
pinned = db.open_table("qa", version=5)
print(pinned.version, pinned.count_rows())
Materialize a subset
Copy only the required columns and parts into a writable local table for Evolve, Train, or Versioning.
batches = (
tbl.search()
.where("array_has_all(qa_levels, ['L4'])")
.select(["stem", "questions", "question_embeddings"])
.to_batches()
)
lancedb.connect("./benchcad-local").create_table("qa_samples", batches)
Source, license, and changes
BenchCAD 1.0 is by Haozhe Zhang, Kaichen Liu, Miaomiao Chen, Lei Li, Shaojie Yang, Cheng Peng, and Hanjie Chen. The authors release the benchmark records and their generated renders and geometry under CC BY 4.0. Publisher’s BenchCAD 1.0 page · Paper · License notice
The conversion used Hugging Face revision 5919f578ab09ec283603a082fab07c7639ab56eb. It groups QA rows by original part, folds in the auxiliary export’s fields, and adds text embeddings and Lance indices. Media and ground-truth code retain their original bytes or strings. The Hub reported 118,407 downloads in the preceding 30 days on November 18, 2026. Pinned upstream snapshot