diff --git a/docs/audit/REVIEW_PROMPT_VARIANTS_V2.md b/docs/audit/REVIEW_PROMPT_VARIANTS_V2.md new file mode 100644 index 0000000..b231a8b --- /dev/null +++ b/docs/audit/REVIEW_PROMPT_VARIANTS_V2.md @@ -0,0 +1,74 @@ +# Per-variant paper-faithfulness audit V2 (with reference implementations) + +Re-audit of `lora-lite` after adding canonical reference implementation URLs to +each variant docstring. Your job: for each variant, **directly compare** our +implementation against the reference impl (peft and/or paper-author repo), not +just against the paper text. This is round 2 — the previous review (you can +read `docs/audit/variants_review.md`) found: + +- HRA gate=0 init kills `lora_U` gradient on step 0 +- DeLoRA same pattern with lambda0=0 +- IA3 targets q/v not paper k/v/ffn-down (deviation documented but untested) +- PiSSA bf16 init err 0.31 on Qwen +- Saved adapters don't preserve PiSSA W_res mutation + +Your job now is to verify those findings against the **reference code**, and +look for anything the prior review missed once you have the reference in hand. + +## Inputs + +- Our code: `src/lora_lite/variants/{lora,pissa,dora,ia3,hra,delora}.py` +- Adapter plumbing: `src/lora_lite/{adapter.py,target.py,variant.py,config.py}` +- Papers (text): `docs/papers/*_*.txt` +- **Reference implementations** (just added): + - `docs/refs/peft_lora_layer.py` — peft LoRA Linear (and PiSSA init paths) + - `docs/refs/peft_lora_dora.py` — peft DoRA helper module + - `docs/refs/peft_lora_variants.py` — peft per-variant init dispatch (PiSSA, OLoRA, etc.) + - `docs/refs/peft_ia3_layer.py` — peft IA3 layer + - `docs/refs/peft_hra_layer.py` — peft HRA layer (clean, has apply_GS toggle) + - `docs/refs/peft_delora_layer.py` — peft DeLoRA layer (upstreamed) + - `docs/refs/orig_pissa_init.py` — PiSSA paper authors' init script (MuLabPKU) + - `docs/refs/orig_hra_layer.py` — HRA paper authors' OFT-with-HRA layer (DaShenZi721) + - `docs/refs/orig_delora.py` — DeLoRA paper authors' fork-of-peft impl (ExplainableML) +- Logs: `logs/smoke.log`, `logs/qwen_probe.log` +- Prior review: `docs/audit/variants_review.md` (do NOT just restate it) + +## What to deliver per variant (LoRA, PiSSA, DoRA, IA3, HRA, DeLoRA) + +1. **Reference impl ground-truth** — what does the *reference* code actually do + for: parameter shapes, initialization, scale factor, forward equation, + save/load, target placement? Quote ≤10 lines with file/line cites from + `docs/refs/`. + +2. **Our code** — quote our impl (≤10 lines, with `src/lora_lite/variants/.py:LN` cites). + +3. **Diff** — bullet list of every meaningful difference. + Mark each one as: `[OK-doc]` (acceptable, documented), `[OK-undoc]` (acceptable, + should add to docstring), `[BUG]` (likely wrong), `[STYLE]` (cosmetic). + +4. **Did the prior review get it right?** Quote the relevant prior verdict + line and either confirm or correct. + +5. **Verdict** — Faithful / Faithful-with-doc-gap / Partial / Buggy. + One-line reason. + +## Final aggregate + +Markdown table: + +| variant | prior verdict | new verdict | new bugs found | doc gaps | + +And a 5-bullet "what to fix next" list, ordered by severity. + +## Hard rules + +- Quote evidence from `docs/refs/` files. If you can't find the relevant + reference function, say so explicitly — don't guess. +- Do NOT edit code. Output review only. +- Be specific about line numbers from the references. "peft does X" is not + enough; "peft_lora_layer.py:L1234 does X" is. +- If you find a NEW bug not flagged in `variants_review.md`, mark it + `[NEW-BUG]` and explain the failure mode. +- If the prior review was wrong (false positive), mark it `[OVERTURN]`. + +Write to stdout. I will redirect to `docs/audit/variants_review_v2.md`. diff --git a/docs/audit/variants_review_v2.md b/docs/audit/variants_review_v2.md new file mode 100644 index 0000000..d9dfc6e --- /dev/null +++ b/docs/audit/variants_review_v2.md @@ -0,0 +1,1278 @@ +[client] initialize (running) + +[client] session/new (running) +I’ll use the `gsd` workflow here since this is a multi-step audit, and I’ll keep it review-only: read refs, compare implementation, then produce the markdown report to stdout. + +[tool] Read SKILL.md (running) + input: {"call_id":"call_4LnMf0WHkHoYdG0a5N21Rrgd","process_id":"77034","turn_id":"019dc987-7ec1-7ee2-8133-220e153d9394","command":["/usr/bin/zsh","-lc","sed -n '1,220p' /home/wassname/.claude/skills/gsd/SKILL.md"],"cwd":"/me... + files: /home/wassname/.claude/skills/gsd/SKILL.md + +[tool] Read SKILL.md (completed) + kind: read + input: {"call_id":"call_4LnMf0WHkHoYdG0a5N21Rrgd","process_id":"77034","turn_id":"019dc987-7ec1-7ee2-8133-220e153d9394","command":["/usr/bin/zsh","-lc","sed -n '1,220p' /home/wassname/.claude/skills/gsd/SKILL.md"],"cwd":"/me... + files: /home/wassname/.claude/skills/gsd/SKILL.md + output: + sed: /tmp/.mount_vscodiOHg5sd/lib/x86_64-linux-gnu/libselinux.so.1: no version information available (required by sed) + --- + name: gsd + description: "Get Shit Done workflow for non-trivial tasks: spec -> implement -> test -> review -> wrap. Mandatory for anything with more than one step." + --- + + + + # GSD (Get Shit Done) + + Mandatory for all non-trivial tasks (more than one step). Skip only for single-line fixes. + + ## Part 1: Core workflow + + ### 1.1 Spec-first planning + ... (192 more lines) +I’m going to gather the exact line-numbered evidence first: prior verdicts, our variant code, plumbing, and the reference implementations. The main thing to avoid is smearing paper-faithfulness and reference-faithfulness together. + +[tool] Read variants_review.md (running) + input: {"call_id":"call_ZMecpefRlTCdKyqbYXoIQ4dq","process_id":"78042","turn_id":"019dc987-7ec1-7ee2-8133-220e153d9394","command":["/usr/bin/zsh","-lc","nl -ba docs/audit/variants_review.md | sed -n '1,260p'"],"cwd":"/media/... + files: /media/wassname/SGIronWolf/projects5/2026/lora-lite/docs/audit/variants_review.md + +[tool] Run for f in src/lora_lite/{adapter.py,target.py,variant.py,config.py}; do printf '\n### %s\n' "$f"; nl -ba "$f" | sed -n '1,280p'; done (running) + input: {"call_id":"call_ToqQP8XSZ8r22VF9IYDGRrHF","process_id":"51617","turn_id":"019dc987-7ec1-7ee2-8133-220e153d9394","command":["/usr/bin/zsh","-lc","for f in src/lora_lite/{adapter.py,target.py,variant.py,config.py}; do ... + +[tool] Run for f in src/lora_lite/variants/{lora,pissa,dora,ia3,hra,delora}.py; do printf '\n### %s\n' "$f"; nl -ba "$f" | sed -n '1,260p'; done (running) + input: {"call_id":"call_i9nfOVjK5lGEtnZXiX8w3UVI","process_id":"66364","turn_id":"019dc987-7ec1-7ee2-8133-220e153d9394","command":["/usr/bin/zsh","-lc","for f in src/lora_lite/variants/{lora,pissa,dora,ia3,hra,delora}.py; do... + +[tool] Read variants_review.md (completed) + kind: read + input: {"call_id":"call_ZMecpefRlTCdKyqbYXoIQ4dq","process_id":"78042","turn_id":"019dc987-7ec1-7ee2-8133-220e153d9394","command":["/usr/bin/zsh","-lc","nl -ba docs/audit/variants_review.md | sed -n '1,260p'"],"cwd":"/media/... + files: /media/wassname/SGIronWolf/projects5/2026/lora-lite/docs/audit/variants_review.md + output: + sed: /tmp/.mount_vscodiOHg5sd/lib/x86_64-linux-gnu/libselinux.so.1: no version information available (required by sed) + 1 [client] initialize (running) + 2 + 3 [client] session/new (running) + 4 I’ll use the `gsd` skill because this is a multi-step audit, then I’ll read the variant code, paper excerpts, logs, and refs only as needed. No code edits, just a verdict with quoted evidence. + 5 + 6 [tool] Read SKILL.md (running) + 7 input: {"call_id":"call_ZJ8jUrIxVXwLtDtWUHoN5Nyw","process_id":"8344","turn_id":"019dc96e-e7cd-79f2-b04d-65a1c4d26637","command":["/usr/bin/zsh","-lc","sed -n '1,220p' /home/wassname/.claude/skills/gsd/SKILL.md"],"cwd":"/med... + 8 files: /home/wassname/.claude/skills/gsd/SKILL.md + 9 + 10 [tool] Read SKILL.md (completed) + 11 kind: read + 12 input: {"call_id":"call_ZJ8jUrIxVXwLtDtWUHoN5Nyw","process_id":"8344","turn_id":"019dc96e-e7cd-79f2-b04d-65a1c4d26637","command":["/usr/bin/zsh","-lc","sed -n '1,220p' /home/wassname/.claude/skills/gsd/SKILL.md"],"cwd":"/med... + 13 files: /home/wassname/.claude/skills/gsd/SKILL.md + 14 output: + 15 sed: /tmp/.mount_vscodiOHg5sd/lib/x86_64-linux-gnu/libselinux.so.1: no version information available (required by sed) + 16 --- + 17 name: gsd + 18 description: "Get Shit Done workflow for non-trivial tasks: spec -> implement -> test -> review -> wrap. Mandatory for anything with more than one step." + 19 --- + 20 + 21