Skip to content

Add deterministic SGD context audit - #25

Merged
aryamantodkar merged 2 commits into
mainfrom
codex/audit-sgd-context
Aug 24, 2026
Merged

Add deterministic SGD context audit#25
aryamantodkar merged 2 commits into
mainfrom
codex/audit-sgd-context

Conversation

@aryamantodkar

@aryamantodkar aryamantodkar commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a streaming audit for schema-declared non-categorical slots in SGD train USER turns
  • count dialogue files, dialogues, USER turns, context-only turns, slot spans, overlaps, and every (service, slot) pair
  • include each slot's authoritative SGD schema description in its audit entry
  • retain up to 50 deterministic hash-ranked examples per service-slot pair
  • write the report atomically with stable train/dialogues_NNN.json provenance
  • expose the audit through the premove-audit-sgd CLI

Why

The SGD enrichment plan needs an explicit inventory before slot-to-ITN mapping begins. This audit provides that inventory without assigning ITN labels or generating training records.

The protected invariant is that the same SGD train split produces the same counts, descriptions, sample identities, and provenance on every machine. Slot descriptions flow through the validated schema index, so the later mapping policy can use SGD's semantics without maintaining a second schema parser. Without stable provenance and deterministic sampling, audit reports could differ by checkout location or source traversal details.

Full-corpus audit

Running:

uv run premove-audit-sgd \
  data/external/sgd/train \
  data/generated/dataset_v1/sgd/context_audit.json \
  --examples-per-slot 50

produced:

dialogue files:              127
dialogues:                   16,142
USER turns:                  164,982
context-only USER turns:     114,951
non-categorical slot spans:  66,603
service-slot pairs:          94
overlapping-span turns:      2

All 94 service-slot pairs have a non-empty schema description. The generated report is ignored and is not included in this PR.

Validation

  • uv run ruff check .
  • uv run pytest — 234 passed
  • uv build
  • verified all sampled offsets satisfy utterance[start:end] == value
  • verified each pair has min(50, count) examples
  • verified all 94 audited pairs have non-empty schema descriptions

uv run ruff format --check . still reports two pre-existing formatting differences in tests/test_golden.py and tests/test_types.py; this PR does not modify those files.

@aryamantodkar
aryamantodkar merged commit 516d9a3 into main Aug 24, 2026
@aryamantodkar
aryamantodkar deleted the codex/audit-sgd-context branch August 24, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant