Datasets:
File size: 9,794 Bytes
60d5188 3a0426d 60d5188 3a0426d 60d5188 3a0426d 60d5188 3a0426d 60d5188 6b6df26 60d5188 6b6df26 60d5188 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | ---
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: "viewer/QA/QA.parquet"
- config_name: code_gen
data_files:
- split: code_gen
path: "viewer/code_gen/code_gen.parquet"
- config_name: edit-bench
data_files:
- split: edit_bench
path: "viewer/edit-bench/edit_bench.parquet"
---
# 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.
## Browse on Hugging Face
Browse every QA part, code-generation part, and edit. The QA and code-generation views show the original composite render for each part. The edit configuration uses the `edit_bench` split name in the viewer. Use LanceDB below for vector search and the complete image and STEP assets. [Open the Dataset Viewer](https://huggingface.co/datasets/lance-format/benchcad-lance/viewer/QA/QA)
The Dataset Viewer reads the Parquet browse tables in `viewer/`. LanceDB opens the indexed tables in `data/`.
## 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](meta/info.json)
## 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](https://huggingface.co/intfloat/multilingual-e5-small/tree/614241f622f53c4eeff9890bdc4f31cfecc418b3)
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 LanceDB
Open the public QA table directly on Hugging Face to inspect its row count and indices. [LanceDB documentation](https://lancedb.com/docs)
```python
import lancedb
db = lancedb.connect("hf://datasets/lance-format/benchcad-lance/data")
tbl = db.open_table("qa")
print(tbl.count_rows())
print(tbl.list_indices())
```
For repeated training or heavy random access, download the dataset once and open `./benchcad-lance/data` locally.
```bash
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.
```bash
pip install lancedb==0.41.0 sentence-transformers==6.3.0
```
```python
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.
```python
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.
```python
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.
```python
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.
```python
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.
```python
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](https://benchcad.com/benchcad-1) · [Paper](https://arxiv.org/abs/2605.10865) · [License notice](LICENSE.txt)
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](https://huggingface.co/datasets/BenchCAD/BenchCAD/tree/5919f578ab09ec283603a082fab07c7639ab56eb)
|