Local Apple Silicon DPO Distillation Flywheel: Technical Playbook
1. Cross-Family Defect Capture and Repair
This stage utilizes a heterogeneous model architecture to identify and rectify reasoning failures. The "Worker" model (Target) is evaluated by a "Critic" model from a different family (e.g., Llama-3-70B evaluating Mistral-7B).
- **Capture Trigger:** Any response from the Worker model scoring $< 95/100$ on the Critic's rubric is flagged as a "Defect."
- **Repair Protocol:**
- **Critic Intervention:** The Critic generates a "Correction Trace" identifying the specific logical leap or factual error.
- **Worker Regeneration:** The Worker is prompted with the Correction Trace to generate a corrected response.
- **Validation:** The Critic must score the repaired response $\ge 100/100$ before the pair is eligible for the distillation pool.
- **Lineage Tracking:** Every pair must carry a `Source_ID`, `Critic_ID`, and `Repair_Iteration_Count` metadata tag to prevent recursive loop contamination.
2. Oracle Margin Filtering and Secret Scrubbing
To ensure high-signal DPO pairs, the system enforces a strict mathematical delta between the "Chosen" and "Rejected" responses.
- **Oracle Margin ($\Delta \ge 15$):**
- The Critic assigns a scalar score to both the Chosen and Rejected responses.
- **Filter:** $\text{Score}(\text{Chosen}) - \text{Score}(\text{Rejected}) \ge 15$.
- If the margin is $< 15$, the pair is discarded to prevent gradient noise during DPO training.
- **Secret Scrubbing (Zero-Tolerance):**
- **PII/Credential Filter:** Automated regex and NER (Named Entity Recognition) pass to strip emails, IP addresses, and API keys.
- **Internal Project Scrubbing:** Any mention of internal project codenames or non-public infrastructure is replaced with `[REDACTED]`.
- **Deduplication:** Apply a Cosine Similarity threshold of $< 0.85$ on the Chosen responses to ensure the distillation set contains unique reasoning paths.
3. CX-100 Benchmark Holdout Isolation
To prevent data contamination and ensure the integrity of the CX-100 evaluation suite, strict architectural isolation is enforced.
- **Data Siloing:** The CX-100 test set is stored in a physically separate directory/database with restricted access permissions.
- **Leakage Prevention:**
- **Zero-Overlap Check:** Before any distillation run, a hash-based comparison ensures no samples from the CX-100 holdout exist in the training/distillation pool.
- **Perplexity Monitoring:** Monitor the model's perplexity on the CX-100 holdout. A sudden drop in perplexity during training indicates potential leakage.
- **Validation:** The CX-100 set is only accessible to the final evaluation agent, never the Critic or Worker during the distillation phase.
4. Reality Gate Promotion Criteria
Promotion to the "Production-Ready" dataset requires passing the Reality Gate, a multi-stage verification of the distilled data's utility and safety.
- **Success Metrics for Promotion:**
- **Reasoning Density:** Chosen responses must contain $\ge 3$ distinct logical steps for complex queries.
- **Instruction Adherence:** 100% success rate on negative constraints (e.g., "Do not use X").
- **Diversity Score:** The batch must maintain a Shannon Entropy score $> 0.8$ across diverse topics (Coding, Creative Writing, Logic, Math).
- **Promotion Workflow:**
1. **Stage 1 (Validation):** Automated check of $\Delta \ge 15$ and Secret Scrubbing.
2. **Stage 2 (Verification):** Manual/Expert audit of a 1% random sample from the batch.
3. **Stage 3 (Promotion):** Upon passing Stage 2, the batch is moved from `Distillation_Buffer` to `Production_Ready_Pool`.