Files
OBLITERATUS/docs/CONCEPT_DATASETS.md
Joseph MaglyandClaude Opus 5.5 ae9d774609 feat(concepts): require pack schema 2.0 for dataset declarations
Releases that read only 1.x manifests ignore the dataset declaration and
each row's role, so they extract from select, calibrate and locked test
rows. Gating dataset packs on a new major version makes those releases
reject the pack ("Unsupported schema_version") instead.

- Accept schema majors 1 and 2; 2.x keeps every 1.x field.
- manifest.dataset now requires schema_version 2.0+ (was 1.3+, never
  released). 1.x packs without a dataset are unchanged.
- Compare versions as (major, minor) tuples. The selector gate in
  pack.py compared only the minor number and would have rejected 2.0.
- Unknown-major tests now use 3.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 20:46:10 -05:00

120 lines
7.5 KiB
Markdown

# Concept datasets and independent partitions
Dataset declarations require Concept Pack schema 2.0 or later. Version 2.x keeps
every 1.x field, so a 1.x pack upgrades by changing `schema_version` to `'2.0'`.
Packs without a declaration retain legacy prompt, split, refusal, and CLI behavior.
Dataset declarations are supported for research and user packs. The immutable core
refusal pack cannot acquire a dataset declaration or bypass its existing identity guard.
A legacy pack has unavailable role/group counts; `pack.dataset()` fails explicitly
rather than assigning roles to old `train` or `heldout` labels.
The major version is what keeps partitions isolated across releases. Releases that
read only 1.x manifests would ignore the `dataset` declaration and each row's `role`
and extract from every row, including locked `test` rows. They reject a 2.x manifest
with "Unsupported schema_version", so a dataset pack fails to load there instead.
Every declared positive, control, neighbour and battery file must keep at least one
`fit` row. A set whose rows are all assigned to other roles is rejected rather than
passed to extraction or gating empty.
```yaml
schema_version: '2.0'
dataset:
dataset_version: synthetic-v1
source_version: synthetic-source-v1
roles: [fit, select, calibrate, test]
test_locked: true
```
Every new row requires `id`, `text`, `role`, and `group_id`. Roles are explicit;
set names and battery membership never assign them. `fit` must be declared.
Declaring `test` requires `test_locked: true`; otherwise the lock must be false.
A row cannot also contain legacy `split`. Version strings are labels bound into
a revision, not substitutes for content hashes.
Record ids are globally unique. Canonical references are `[logical_path, id]`.
Equal `group_id`, `family_id`, or `pair_id` values join independence units across
sets, within their own field namespace. `parent_ids` (at most 16) and
`synthetic_parent_id` join ancestry transitively. Missing, self, ambiguous, and
cyclic ancestry fail. Siblings share their parent's unit. Raw exact text duplicates
also join units; no unit may cross roles. Rows are never silently deleted.
`source_id`, `perspective`, `person`, `domain`, and `category` describe provenance
and coverage without automatically joining units. Arbitrary rendering annotations
are retained and included in content identity.
`pack.to_target()` on a declared dataset includes **fit only** across positives,
controls, neighbours, and battery, including aligned annotation lists. Positives
and every declared control need nonempty fit data. It never falls back to all rows.
Within-fit CV uses the reserved `_dataset_unit` column, rejecting source collisions.
Recipe and entry-point grouping fields conservatively coarsen these units; missing
or invalid grouping values fail. The original recipe is retained in target
provenance, while the resolved recipe and derived records bind execution identity.
Too few usable independent groups can still make the existing CV machinery fail;
a declaration does not guarantee adequate class/group coverage.
`pack.dataset().access_role('select')` returns copied records and a receipt.
Accessing `test` requires `allow_locked_test=True`; the receipt binds revision,
role, and explicit acknowledgement. This is an application boundary, not protection
against the filesystem owner or proof that nobody previously viewed the data.
The fit target's provenance has revision/role/policy metadata and the original
recipe plus the existing pack source/hash/licence references, with no non-fit source records.
Content SHA-256 binds entire parsed rows and canonical references sorted by ref.
Partition SHA-256 binds role assignments, resolved units, declarations, and the
versioned grouping policy. Revision SHA-256 binds content, partition, declared
versions, and original row order. Canonical JSON sorts keys, uses compact separators
and UTF-8 (`ensure_ascii=False`), and rejects nonfinite numbers. Display title,
caveats, and licence attribution do not change dataset identity; the separate
pack archive hash still binds them. These digests do not identify a model,
tokenizer, renderer, or downstream run.
```bash
obliteratus concepts dataset-preview ./synthetic-pack --private --json
obliteratus concepts dataset-preview ./synthetic-pack --role select --max-pairs 1000 --max-bytes 500000 --json
obliteratus concepts dataset-preview ./synthetic-pack --role test --allow-locked-test --include-text --private --json
obliteratus concepts dataset-preview ./synthetic-pack --allow-locked-test --private --json
```
Preview resolves verified bundled data or an existing verified cache only. An
unfetched reference fails and requires a separate explicit fetch. Preview never
implicitly downloads data or runs a model, including on error paths. Default
reports omit raw text and row annotations; their projection contains references,
row hashes, units, role coverage, and identity. `--include-text` explicitly exposes
source text and must be handled as a private export. It is independent of both
`--private` and locked-test acknowledgement. The default role is fit.
`--private` invokes the actual telemetry disable API before pack resolution,
even after earlier explicit opt-in. This disables new emissions through
`is_enabled()`-gated benchmark logging, report submission, and Hub scheduling
triggered by this invocation. It does not cancel already-running background tasks,
isolate the whole process, or change privacy promises for legacy export commands.
Similarity is a versioned heuristic: NFKC, casefold, whitespace normalization and
token-set Jaccard, with a default threshold of 0.8. Raw exact equality is handled
separately with a hash join. Structural lineage/raw-exact integrity checks cover
all declared roles, but heuristic diagnostics exclude locked-test rows unless
`--allow-locked-test` is supplied, even when no text is exported. An acknowledged
cross-partition audit records test access in the receipt. `roles_included` and
`roles_excluded` label the diagnostic scope; excluded roles require review and are
not counted as completed comparisons. Deterministic candidate diagnostics are bounded by
`--max-pairs` (default 10000, maximum 100000) and `--max-bytes` (default 1000000,
maximum 16000000). The byte budget charges both input strings per comparison,
including normalization/token work; there are no embeddings or external calls.
Reports expose completed/skipped pairs, bytes processed, truncation and unavailable
reason. Zero budgets are allowed and yield incomplete diagnostics. Cross-role
candidates or incomplete diagnostics require review; neither a clean heuristic
report nor structural validation establishes statistical independence. Empty
declared roles report measured zero and `adequacy: not_established`.
The canonical contracts are maintained by the concept packs maintainers:
[pack declaration](../obliteratus/concepts/schema/concept-pack.v1.schema.json),
[record](../obliteratus/concepts/schema/concept-dataset-record.v1.schema.json), and
[derived partition report](../obliteratus/concepts/schema/concept-dataset-report.v1.schema.json).
Their catalog ids, stable v1 status, ownership, and compatibility are documented
in the schemas. The record and report reference the pack's shared role/declaration
definitions. Runtime validation has no optional dependency and resolves only
shipped schema references; development fixtures compare it with Draft 2020-12.
Wheel and sdist include these contracts via the existing schema package-data rule.
CPU synthetic fixtures demonstrate application contracts, not pretrained efficacy,
scientific validity, or GPU qualification.