Trace Blueprint¶
Status: normative contract for dataset ABI, determinism, and build policy.
1) Goal¶
Trace generates grounded visual-reasoning instances with:
- prompt,
- typed answer,
- image artifacts,
- typed annotation,
- sidecar trace for replay and verifier metadata.
2) Public Taxonomy¶
Public dataset taxonomy uses:
domain -> scene_id -> task_id
Rules:
scene_idis the visual rendering grammar.task_idis the public sampling unit and usestask_<domain>__<scene_id>__<objective_contract>.query_idis replay and branch-diagnostic metadata inside one task contract, not a public sampling unit.- Source layout, config files, prompt bundle paths, registered task classes, and registered source scene/group fields are implementation routing, not public taxonomy.
- Current source layout uses:
src/trace_tasks/tasks/<domain>/<scene_id>/<objective_contract>.pysrc/trace_tasks/tasks/<domain>/<scene_id>/shared/src/trace_tasks/resources/configs/domains/<domain>/<scene_id>.yamlsrc/trace_tasks/resources/prompts/<domain>/<scene_id>/<bundle_id>.json
3) Required Artifacts¶
3.1 Train Instance¶
Every record must include:
- identity and taxonomy (
instance_id,instance_seed,domain,scene_id,task/task_id, optionalquery_id); promptand optionalprompt_variants;images[]with dataset-root-relativepathandimage_hash;answer_gt: {type, value};annotation_gt: {type, value};reward_contract;trace_ref;versions.
Constraints:
answer_gt.typeandannotation_gt.typemust be registered type ids.images[*].pathis dataset-root-relative, never absolute.trace_refis mandatory.reward_contractis mandatory and must match the resolved public answer/annotation reward mapping.
3.2 Sidecar Trace¶
Trace payload is mandatory and referenced by trace_ref.
Required sections:
scene_irquery_specrender_specrender_mapexecution_tracewitness_symbolicprojected_annotation
4) Prompt Contract¶
- Prompt text must live in external bundles under
src/trace_tasks/resources/prompts/. - Deterministic composition layers are scene, task, optional query, and output
mode (
answer_only,answer_and_annotation). - Store rendered prompt modes in
prompt_variantswhen generated. - Record prompt metadata in trace: bundle id, layer keys, selected variants, slot values, and output mode.
- Template cardinality rule: each required list has exactly 5 high-quality variants unless the prompt schema explicitly declares an approved exception.
5) Annotation And Reward Contracts¶
- Symbolic witness metadata is the source of truth in trace.
- Prompt-facing annotation is projected from the witness after final layout and rendering placement are known.
TrainInstance.annotation_gtuses one registered public annotation type.- Annotation-order semantics are task-defined and deterministic.
- Unsupported annotation-type requests are hard validation errors.
reward_contractis builder-owned metadata derived fromanswer_gt.typeandannotation_gt.type.- Reward-contract ids are versioned separately from answer/annotation types.
6) Determinism And Identity¶
- Single root seed per instance:
instance_seed. - All sub-seeds derive by namespace hash.
- No hidden randomness; all randomness is explicit and recorded when it affects replay, layout, rendering, prompt selection, answer, or annotation.
- Canonical JSON (RFC 8785 JCS) is required for identity hashes.
- Hash algorithm is
blake3. instance_iduses semantic fields and image content hashes, not file paths.
7) Visual Variation Invariant¶
- Repeated-unit visual grammars should include non-semantic unit-size jitter whenever the image is built from repeated cells, tiles, slots, grid squares, hexes, stickers, or voxels.
- The first target is a sampled minimum-to-maximum rendered unit-size span of
at least
2x; narrower ranges are acceptable only when readability, fit, or annotation integrity requires them. - Unit-size jitter must be explicit and recorded in render metadata.
- Annotation bboxes/points must be projected after final jittered layout.
8) Sampling Policy¶
- Global sampling unit is
task_id. - Domain and scene probabilities are derived by task aggregation unless build config explicitly overrides them.
- Query sampling is inside each task and uniform by default.
- Uniform semantic sampling is implemented by seeded RNG draws over explicit equal probabilities. Seed modulo, hash modulo, cursor cycling, and index enumeration are not valid substitutes for random sampling of task-internal semantic axes.
- Exact stratification, when needed for a build, belongs in the build sampler and must be recorded as a sampling policy rather than hidden inside task generation.
- Validate answer distributions per task/query with lightweight anti-degeneracy checks over generated answers.
- Never relax semantic constraints to force acceptance.
9) Build, Validation, And Finalize¶
- Build to staging directory.
- Generate train records and trace shards.
- Run pre-finalize validation.
- Optionally run strict reproducibility pass.
- Atomically finalize on success.
- Persist failure bundle on failure.
Required build outputs:
validation_report.jsonbuild_report.json
10) Versioning Policy¶
instance_versionis the ABI contract version.- Breaking schema or semantic changes require a version bump.
- Mixed instance versions in one dataset are invalid.
- Replay-critical versions must be recorded in
versions.
11) Quality Gates¶
A task/build is acceptable only if:
- schema and trace linkage are valid,
- answer/annotation/witness come from one execution trace,
- final answer is unique by construction,
- determinism checks pass for fixed seeds,
- prompt metadata and template constraints pass,
- no silent constraint relaxation is used.
12) Document Ownership¶
When contracts change, update the matching source-of-truth docs:
docs/contracts/SYSTEM_ARCHITECTURE.mdfor implementation boundaries;docs/workflows/TASK_AUTHORING.mdfor author workflow;docs/workflows/BUILD_VALIDATION.mdfor operational validation;- domain/task docs for domain-specific behavior.