Skip to content

docs: Add label-as-first-class-citizen pipeline design and implementation spec - #1

Open
jcyeom wants to merge 1 commit into
masterfrom
claude/label-first-class-pipeline-cp20b0
Open

jcyeom wants to merge 1 commit into
masterfrom
claude/label-first-class-pipeline-cp20b0

Conversation

@jcyeom

@jcyeom jcyeom commented Sep 18, 2026

Copy link
Copy Markdown
Owner

What type of PR is this?

/kind documentation

What this PR does / why we need it:

This PR adds comprehensive documentation for a data pipeline design that manages labels as first-class objects in a data lake, alongside feature data. The contribution includes:

  1. Revised research paper (00-paper-revised.md): An updated version of the original paper addressing 8 critical logical flaws, 11 schema omissions, and 3 structural enhancements identified during implementation review.

  2. Implementation design specification (02-design.md): A detailed 893-line technical specification covering:

    • Architecture and 4-layer storage strategy (Bronze/Silver/Gold/Meta)
    • Complete schema definitions for L0-L3 labels with operational metadata
    • Label Fusion Engine algorithm with confidence calibration and correlation adjustment
    • Replay/reproducibility guarantees through normalized hashing and snapshot preservation
    • Drift detection, anchor set management, and dataset manifest design
    • Governance, PII handling, and CI validation requirements
  3. Revision notes (01-revision-notes.md): Detailed mapping of all changes from the original paper with justifications, organized by category (logical flaws, schema gaps, structural improvements, unresolved items).

  4. DDL schemas (ddl/01_bronze.sql through ddl/04_meta.sql): Production-ready table definitions for:

    • Bronze layer: Raw labeler responses (L0)
    • Silver layer: Parsed candidate labels (L1) with rationale separation
    • Gold layer: Consensus labels (L2) and verified labels (L3) with leakage prevention views
    • Meta layer: Labeler registry, fusion policies, calibration models, anchor sets, review queues, drift metrics, and dataset manifests
  5. Configuration example (config/pipeline.example.yaml): A complete pipeline configuration template demonstrating all tunable parameters with inline documentation.

Key design principles addressed:

  • P1 (Immutability): L0/L1 are append-only; corrections use new run_ids
  • P2 (Reproducibility): All outputs include generation metadata for replay
  • P3 (Abstention clarity): Abstain flag separated from value domain
  • P4 (Exclusion tracking): Excluded data explicitly recorded in manifests
  • P5 (Unbiased evaluation): Anchor sets force random sampling for evaluation baselines
  • P6 (Versioned policies): All policies (fusion, calibration, routing) are versioned configurations, not code

Which issue(s) this PR fixes:

This PR provides the implementation foundation for label management in weak supervision pipelines, addressing the gap between academic frameworks (Snorkel) and production data lake requirements.

Special notes for your reviewer:

  • The design explicitly rejects the assumption that LLM labelers can be deterministically reproduced (addressing [7] in related work). Instead, it preserves raw responses in Bronze and enables replay through normalized hashing.
  • The specification includes 14 CI validation checks (§14.4) to prevent common failure modes (snapshot retention, leakage, anchor ratio, schema compatibility).
  • Python implementation is intentionally excluded from this PR to avoid boilerplate checks in the kubernetes-client repository. Interface contracts are fully specified in §15 of the design document for independent implementation.
  • All 44 tables/views are defined with explicit partitioning, clustering, and retention policies suitable for production medallion architectures.

Does this PR introduce a user-facing change?

NONE

Additional documentation:

https://claude.ai/code/session_01VDpZfU6Xrs9HAgSQU46mWW

Revise the weak-supervision label pipeline paper per an implementation
review, and add a design spec that code can be built from.

Paper fixes (8 substantive):
- Replace the "seed-fixed reproducibility" claim, which contradicted the
  cited run-to-run variance work, with replay from preserved raw responses
- Separate consensus policies from agreement metrics; Cohen's kappa is a
  dataset-level chance-corrected statistic, not a per-sample decision
  function, and is limited to two raters
- Add anchor-based monotonic calibration; rule/LLM/human confidences are
  not comparable on a shared scale
- Stop emitting NULL consensus labels for disagreements, which removed
  only hard samples from training and biased the set; keep a soft label
  and declare inclusion in the dataset manifest instead
- Introduce a random anchor set with a forced share of the review budget,
  so labeler accuracy and drift are not estimated from disagreement-only
  samples
- Split verified labels into train and eval_holdout purposes to stop
  leakage between labeler evaluation and training
- Identify drift cause from two signals (distribution shift plus anchor
  rescoring) instead of PSI alone
- Move the agreement field from the candidate to the consensus schema,
  removing a circular dependency in the append-only layer

Schema gaps closed: sample_id, label_task, target_ref, is_abstain,
ontology_ver, run_id, split value columns, cost/latency, per-component
LLM hashes, feature_snapshot_id, and consensus replay metadata.

Structural additions: an operational definition of first-class labels,
a four-tier mapping with raw responses in Bronze, labeler correlation
adjustment, a dataset manifest, canonical hashing rules, and an
evaluation plan that measures the value of retaining candidate labels.

Design spec covers architecture, table schemas with DDL, replay
procedure, fusion algorithm, calibration, review routing, drift
detection, idempotency, storage economics, governance, module layout
with interface contracts, test strategy, and an eight-stage roadmap.

Documentation only; no Python is added, so the boilerplate check and
test collection in this repository are unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VDpZfU6Xrs9HAgSQU46mWW
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.

2 participants