Skip to content

feat: Blue Agent LoRA 微調學習機制 (Issue #46) - #48

Open
timwei0801 wants to merge 1 commit into
mainfrom
feature/issue-46-lora-finetuner
Open

feat: Blue Agent LoRA 微調學習機制 (Issue #46)#48
timwei0801 wants to merge 1 commit into
mainfrom
feature/issue-46-lora-finetuner

Conversation

@timwei0801

Copy link
Copy Markdown
Owner

Summary

  • 新增 EpisodeCollector:滑動窗口收集 TP/TN/FP/FN 案例,轉 ChatML JSONL 格式
  • 新增 LoRAFineTuner:Unsloth + TRL SFTTrainer 完整 pipeline(LoRA → merge → GGUF → ollama create)
  • 整合至 AdversarialTrainer:每 N epochs 自動觸發微調並切換 Blue Agent 模型

Motivation

Issue #41 實驗揭示 accuracy ~56%(接近隨機猜測),根因是 LLM backbone 權重從未更新。此 PR 加入 LoRA 微調讓 Blue Agent 真正從對抗經驗學習。

Test plan

  • 24 個新測試全部通過(EpisodeCollector、LoRAFineTuner、Trainer 整合)
  • 147 個既有 training 測試全部通過(零回歸)
  • flake8 / bandit 通過
  • GPU server 上安裝 Unsloth + TRL 依賴後跑實際微調實驗

Closes #46

🤖 Generated with Claude Code

新增 LoRA 微調 pipeline(Unsloth + TRL SFTTrainer),讓 Blue Agent 的 LLM
backbone 在對抗訓練中真正從 TP/TN/FP/FN 案例學習,解決 accuracy ~56% 問題。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

[M3] Blue Agent LoRA 微調學習機制:對抗訓練中的參數化自進化

1 participant