feat(#97): add SHAP narrator task type to training pipeline#104
Open
William-Hill wants to merge 4 commits intofine-tuning/student-explainabilityfrom
Open
feat(#97): add SHAP narrator task type to training pipeline#104William-Hill wants to merge 4 commits intofine-tuning/student-explainabilityfrom
William-Hill wants to merge 4 commits intofine-tuning/student-explainabilityfrom
Conversation
Add narrator as a third task alongside explainer and summarizer. The narrator takes per-student SHAP values + profile and generates advisor-facing narratives grounded in ML feature attribution. - prompts.py: NARRATOR_SCHEMA, NARRATOR_STUDENT_SYSTEM, build_narrator_prompt() - seed.py: generate_synthetic_student_profiles() with SHAP data - distill.py: narrator in _TASK_CONFIG, included in main() distillation loop - eval.py: _NARRATOR_REQUIRED_KEYS, shap_grounding ship criterion (>= 80%), check_shap_grounding() metric (counts feature name mentions in narrative) - prepare.py: narrator added to task iteration
- Remove dead generate_explainer_pairs/generate_summarizer_pairs wrappers - Derive _REQUIRED_KEYS sets from schema dicts in prompts.py - Simplify dedup loop in check_shap_grounding with dict.fromkeys() - Add narrator key to load_seed_queries() return - Update test_distill.py to use generate_pairs() directly - Fix stale docstring in generate_pairs()
Collaborator
Author
|
@codeerabbitai review |
- check_ship_criteria() now iterates required criteria first; missing metrics are blocking failures instead of silently passing - load_seed_queries() missing-file fallback includes narrator key - Add .superpowers/ to .gitignore (runtime state files) - Update test expectation for narrator in seed query fallback
Replace single-family model comparison (Qwen 4B vs 9B) with cross-family comparison (Qwen 3.5-4B vs Gemma 4 E4B). Gemma 4 E4B has native structured JSON output and 128K context; Qwen 3.5-4B is the proven D4BL baseline. Key changes: - Add model selection section with head-to-head comparison table - Update notebook config from MODEL_SIZES to MODELS list - Switch from QLoRA to bf16 LoRA (Unsloth discourages QLoRA on Qwen 3.5) - Update Ollama naming, env vars, cost estimates, success criteria
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
narratoras a third task type to the training pipeline alongsideexplainerandsummarizer. The narrator takes per-student SHAP attribution values + student profile and generates advisor-facing narratives grounded in ML feature attribution.NARRATOR_SCHEMA,NARRATOR_STUDENT_SYSTEM,build_narrator_prompt()— teacher prompt with SHAP values, risk factors, and available interventionsgenerate_synthetic_student_profiles()— synthetic students with SHAP data for distillation;load_seed_queries()now returns narrator key_TASK_CONFIG, included inmain()loop; removed deadgenerate_explainer_pairs/generate_summarizer_pairswrapperscheck_shap_grounding()metric (narrative must mention >= 2 of top-3 SHAP features); narrator ship criteria; required keys derived from schema dictsShip Criteria for Narrator
json_validityschema_adherenceshap_groundingcaveat_inclusionTest Plan
python -m training.distill --school bishop-state --localwith narrator taskCloses #97