Dv04's picture
fix: regenerate smoke_test_results.json with healthy metrics (2026-07-09)
2775530 verified
|
Raw
History Blame Contribute Delete
10.9 kB
---
license: cc-by-nc-4.0
extra_gated_heading: Acknowledge the terms to access this dataset
extra_gated_prompt: >-
Access is granted for non-commercial research and evaluation use only. By requesting access you
agree not to redistribute this dataset or any derivative data, to cite Dhi Technologies in any
publication or output that uses it, and to obtain a separate commercial license via dhi-tech.com
before any commercial use. Access requests are reviewed manually by Dhi Technologies.
extra_gated_fields:
Name: text
Affiliation: text
Intended use: text
I agree to use this dataset for non-commercial research and evaluation only, and not to redistribute it: checkbox
extra_gated_button_content: Submit request
task_categories:
- image-classification
- object-detection
tags:
- vision
- automl
- onnx
- synthetic
pretty_name: Prompt2Model Toy Examples
size_categories:
- n<1K
---
# Prompt2Model Toy Examples
**Product:** [Prompt2Model](https://github.com/DHI-Technologies-Inc/Prompt2Model-Language-Guided-Vision-Model-Factory):
a language-guided vision model factory. A typed pipeline (prompt, dataset config, training,
calibration/conformal abstain, ONNX export, an optional distill/quantize step with an
accuracy-floor gate, and a hard-case flywheel).
## What this is (and isn't)
This is **not a benchmark dataset**. Prompt2Model has no natural "own" benchmark corpus the way a
task-specific product does. What's uploaded here is the repository's own **toy smoke-test
fixtures**, tiny synthetic shape-classification and shape-detection sets used to exercise the
pipeline end to end, generated by the repo's own `prompt2model.cli generate-toy-data` command,
plus the real output of running the pipeline on them once.
**2026-07-09 update:** `smoke_test_results.json` was regenerated. The previous upload measured
classification accuracy 0.0 and macro F1 0.0, and that number was a real, disclosed measurement,
not a fabricated one, but it came from a run with three real bugs in the pipeline, not from the
toy task being genuinely unsolvable:
1. `Prompt2ModelFactory.run()` never seeded torch's global RNG, so model weight init and
DataLoader shuffling were nondeterministic run to run.
2. The train/val/test split shuffled the whole sample pool flat, with no regard for class
balance, and on this 3-class, 12-images-per-class toy set that could drop an entire class out
of the validation or test slice.
3. The smoke-test command trained `mobilenet_v3_small` from scratch (no pretrained backbone) at
`batch_size=8`. BatchNorm running statistics never stabilized over so few, so small batches,
and the backbone collapsed to an input-independent constant output, verified directly by
inspecting logits: identical for every validation image regardless of its true label.
All three are fixed in
[PR #18](https://github.com/DHI-Technologies-Inc/Prompt2Model-Language-Guided-Vision-Model-Factory/pull/18)
(seeded RNGs, a stratified split that guarantees class coverage, `pretrained=True` in the
smoke-test config). The pipeline code and this artifact are now consistent: a rerun with the fixed
code is deterministic and scores far above chance. The old 0.0/0.0 numbers were never faked, they
were a bug being disclosed honestly; leaving a known-degenerate run as the public example once the
cause is understood and fixed would be the opposite of honest, so the artifact is replaced rather
than kept.
Reproducibility was independently reverified on 2026-07-09: `prompt2model smoke-test` was run three
separate times on CPU (`seed=42`, the package default, threaded through
`Prompt2ModelFactory.run()`). Classification accuracy, macro F1, the full calibration block, and
both detection mAP figures came back bit-identical across all three runs; only wall-clock
`latency_ms`/`fps` varied with machine load, which is expected for a timing measurement, not an
accuracy one. The artifact published here is the JSON from the third of those runs.
## What's in this dataset
- **`classification/{red_square,green_triangle,blue_circle}/`**: 12 tiny 128x128 PNGs per class
(36 total), procedurally drawn shapes.
- **`detection/images/`** (12 PNGs, `image_001.png` through `image_012.png`, 128x128 each) plus
**`detection/annotations.json`** (about 5.8 KB): a COCO-style toy detection set, 2 categories
(`square`, `circle`), 24 bounding-box annotations across the 12 images (2 objects per image).
- **`smoke_test_results.json`** (about 2.6 KB): real output of
`PYTHONPATH=src python -m prompt2model.cli smoke-test`, this exact toy data run through the real
pipeline (train, calibrate, export to ONNX, verify ONNX Runtime inference), on the fixed code
described above.
## How to load it
Verified against the actual files in this repository (prints image/annotation counts and the
classification metrics dict):
```python
import json
from huggingface_hub import hf_hub_download
repo_id = "Dhi-Technologies/prompt2model-examples"
ann_path = hf_hub_download(repo_id, "detection/annotations.json", repo_type="dataset")
smoke_path = hf_hub_download(repo_id, "smoke_test_results.json", repo_type="dataset")
annotations = json.load(open(ann_path))
smoke = json.load(open(smoke_path))
print(len(annotations["images"]), "images,", len(annotations["annotations"]), "boxes")
print(smoke["classification"]["metrics"]["calibration"])
```
To fetch a classification image, download it the same way, for example
`hf_hub_download(repo_id, "classification/red_square/red_square_000.png", repo_type="dataset")`.
## Measured result: read this as a pipeline smoke test, not a model-quality benchmark
The toy sets are tiny by design (a few dozen images); the numbers below are read directly from the
regenerated `smoke_test_results.json` in this repository today, not from repository prose, and
reflect that scale, not real-world accuracy:
- **Classification**: ONNX export built and verified runnable; conformal calibration completed on
7 held-out validation samples (`ece_before` 0.3864, `ece_after` 0.0014, `conformal_threshold`
0.004888 at `alpha=0.1`); accuracy and macro F1 both measured 1.0 on this run (chance for 3
classes is about 0.33); 1.52M parameters; about 89 ms / 11 fps CPU latency for this exported
model.
- **Detection**: mAP@0.5 = 0.0338, mAP@[0.5:0.95] = 0.0131 on the toy set (still low, a handful of
synthetic training images and a couple of training steps is not a real detection benchmark, but
measurably better than the pre-fix run's mAP@0.5 = 0.0040 now that the backbone is pretrained
instead of collapsing); ONNX export built and verified runnable; 3.73M parameters; about 25 ms /
40 fps CPU latency.
The point of this artifact is that the **typed pipeline runs end to end and the exported ONNX
models are verified runnable**, not that these are competitive vision models. The classification
result on this toy set should be read as "the pipeline can actually learn a trivial, separable
task once the RNG-seeding, class-coverage, and pretrained-backbone bugs are fixed," not as a claim
about real-world accuracy.
Reproduce with:
```
PYTHONPATH=src python -m prompt2model.cli generate-toy-data --task all --output-dir output/toy_data
PYTHONPATH=src python -m prompt2model.cli smoke-test --output-dir output/smoke
```
## The refusal gate this repo is really about
The number worth trusting most in this artifact is not an accuracy figure on a toy set, it is the
pipeline's own honesty mechanism: at inference time, a split conformal abstention check compares
each prediction's nonconformity (1 minus the predicted probability) against a validation-
calibrated threshold, and abstains rather than guessing when that threshold is exceeded. On this
smoke test the threshold was fit at `alpha=0.1` (a 90% target coverage) from 7 held-out samples,
giving `conformal_threshold=0.004888`. Separately, the factory's compression step refuses to ship
a distilled or quantized model that falls below 98% of the uncompressed model's accuracy (the
default accuracy floor), shipping the uncompressed model instead and logging the refusal, rather
than silently degrading.
## Method card, models produced, weights not published here
The pipeline *does* train and export real ONNX models, but the ones referenced in
`smoke_test_results.json` are trained on a few dozen toy images and would be misleading to
publish as weights. So this repo ships the **fixtures and pipeline output**, not a model repo: no
trained checkpoint is presented as if it were a usable vision model. When the pipeline is run on
a real task, that model would be published separately and labeled with its real training data and
metrics.
## Limitations
- Toy scale only: 36 classification images and 12 detection images total. Accuracy, F1, and mAP
numbers at this scale measure whether the pipeline executes correctly, not model quality.
- 7-sample calibration is disclosed as noisy, not smoothed over: `ece_before`/`ece_after` on 7
points is not a statistically stable estimate of real calibration error.
- The pipeline now seeds `torch` and `random` from `config.dataset.seed` (default 42), and the
train/val/test split is stratified by class, so re-running the exact commands above is expected
to reproduce these same metrics deterministically, not just the same honesty-gate mechanics.
- This dataset intentionally has no held-out real-world evaluation set; it exists to exercise the
pipeline, not to benchmark vision models.
## License
This dataset (fixtures and pipeline output) is released under **CC BY-NC 4.0** (non-commercial).
Access is gated and requires manual approval: it is provided for non-commercial research and
evaluation only, redistribution is not permitted, and any publication or output using it should
cite Dhi Technologies. Commercial use requires a separate agreement; contact
[dhi-tech.com](https://dhi-tech.com). Note: this license covers the dataset artifact itself, not
the separately MIT-licensed Prompt2Model code repository linked below.
## Try it
- Live demo (static, the refusal-gate mechanism plus a worked abstain/predict example):
[prompt2model-demo](https://huggingface.co/spaces/Dhi-Technologies/prompt2model-demo)
- Blog: [Six products, one honesty thesis](https://huggingface.co/datasets/Dhi-Technologies/blog/blob/main/04_portfolio_overview.md)
- Dhi Labs: [dhi-tech.com/labs](https://dhi-tech.com/labs)
## Source & research context
- Code (public, MIT licensed): https://github.com/DHI-Technologies-Inc/Prompt2Model-Language-Guided-Vision-Model-Factory
- Collection: [Dhi Labs, honest edge vision AI](https://huggingface.co/collections/Dhi-Technologies/dhi-labs-honest-edge-vision-ai-6a4eb297cbd60f5f673cc2d7)
- Blog dataset: https://huggingface.co/datasets/Dhi-Technologies/blog
- Org: https://huggingface.co/Dhi-Technologies, GitHub org: https://github.com/DHI-Technologies-Inc