My_Learn

# 🧠 My_Learn **一个从 2019 年持续至今的 AI / LLM 开放学习仓库** *从统计学习方法 → 深度学习 → LLM → Agent → Agentic RL —— 每一步都留下笔记、代码与习题全解*
[![GitHub stars](https://img.shields.io/github/stars/scchy/My_Learn?style=flat&logo=github&color=f9c513)](https://github.com/scchy/My_Learn/stargazers) [![GitHub forks](https://img.shields.io/github/forks/scchy/My_Learn?style=flat&logo=github)](https://github.com/scchy/My_Learn/network/members) [![GitHub issues](https://img.shields.io/github/issues/scchy/My_Learn?color=f16d64)](https://github.com/scchy/My_Learn/issues) [![GitHub last commit](https://img.shields.io/github/last-commit/scchy/My_Learn?logo=git&color=2ea44f)](https://github.com/scchy/My_Learn/commits/master) [![GitHub commit activity](https://img.shields.io/github/commit-activity/m/scchy/My_Learn?logo=git)](https://github.com/scchy/My_Learn/commits/master) [![Python](https://img.shields.io/badge/Python-3.10+-3776AB?logo=python&logoColor=white)](https://www.python.org/) [![PyTorch](https://img.shields.io/badge/PyTorch-EE4C2C?logo=pytorch&logoColor=white)](https://pytorch.org/) [![License](https://img.shields.io/badge/License-MIT-f9c513)](./LICENSE) **📚 学习地图 · 🧪 每章习题全解 · 🔥 真实踩坑记录 · 💻 全部代码可运行**

📌 这是什么

这不是一个”收藏夹”式的学习仓库,而是 Learning in Public:

🗓️ 仓库最早提交可追溯至 2019 年 12 月,6 年间持续更新。


🗺️ 学习地图

轨迹 内容 状态
🤖 Hello-Agent 11 章智能体系统课:范式 → 框架 → 记忆/RAG → 协议 → Agentic RL ✅ 进行中
🛠️ PI_Agent 7 天手写一个完整 Agent CLI(Agent Loop / 三层压缩 / 工具安全) ✅ 完成
⚡ LLM_Skill Anthropic Agent Skills 实战:一次构建,多处部署 ✅ 完成
📊 经典轨迹 统计学习方法 / PySpark / TF2 / C++ / 因果推断 📦 归档

🤖 旗舰内容

Hello-Agent — 11 章智能体学习全记录

课程来源:DataWhale Hello-Agent · 每章含 note.md 笔记 + 习题.md 全解 + 可运行代码

章节 主题 亮点
Ch01 初识智能体 Simple Agent 首跑与环境搭建
Ch02 智能体发展史 以史为鉴:发展脉络与技术洞察
Ch03 LLM 基础 语言模型基础 + 习题全解
Ch04 智能体范式设计 ReAct / Plan-and-Execute / Reflection + 智能家居 Agent 实践
Ch05 低代码平台搭建 平台化智能体搭建思路
Ch06 智能体框架 AutoGen / AgentScope / CAMEL / LangGraph 四框架对比
Ch07 手写 Agent 框架 “万物皆工具”:从零实现 ReAct Agent 与多智能体 Conversation
Ch08 记忆与 RAG Qdrant 嵌入式知识库 + 智能问答助手(Streamlit 前端)+ 记忆遗忘/归档
Ch09 上下文工程 上下文质量评估 LLM 增强层 + HybridCascade 混合级联压缩
Ch10 通信协议 MCP / ANP / A2A 三协议对比 + MCP 数据分析服务器实战
Ch11 Agentic RL ⭐ SFT → RM → PPO → GRPO 全景 + TRL 直训 Qwen3-0.6B + 六阶段端到端 Pipeline
🔥 Ch11 GRPO 实战踩坑实录(点击展开) 训练 Qwen3-0.6B 做 GRPO 时真实遇到并修复的问题,全部记录在 [Ch11 笔记](/My_Learn/Hello-Agent/chap11/note.html) 与 [习题全解](/My_Learn/Hello-Agent/chap11/%E4%B9%A0%E9%A2%98.html) 中: - **策略崩溃(Policy Collapse)**:模型输出分布迅速坍缩 → 显式参数注入 + KL 锚定解决 - **工具封装参数静默失效**:封装层吞掉了关键参数 → 重构 RLTrainingTool 参数透传 - **数据与模板不一致**:训练/推理 chat template 不统一导致奖励失真 → 本地数据集 + chat template 统一 - **GRPO vs PPO**:去掉 Critic 的组内相对优势估计,显存减半、实现简化

PI_Agent — 7 天手写一个完整 Agent

覆盖 Pi Agent 全部核心机制,约 700 行 Python,详见 执行计划

Agent Loop → 流式 chunk 中断处理 / 工具超时 / malformed JSON 容错
Compaction → Pi-style 上下文压缩:从后向前找合法切割点 / Turn 边界保护 / 双摘要 / 增量更新
Tool Safety → dangerous 标记 / 用户确认流程
Extension  → importlib 动态加载,热更新与状态隔离
CLI        → 交互 / 非交互双模式 + Session 管理

📚 经典学习轨迹(2019–2024)

年份 轨迹 来源 / 说明
2019 统计学习方法 跟随 lihang-code 逐章推导实现
2019 PySpark 跟随 pyspark-algorithms 系统学习
2020 TensorFlow 2 TF 2.0 从头梳理
2023 C++ / TensorRT 高性能推理 C++ 课程笔记
2023 因果效应关系 贝叶斯基础与因果推断(研究方向)
2024 LLM 进阶 InternLM 全家桶:LangChain / XTuner / 部署实战

🌲 仓库结构

My_Learn
├── 🤖 Hello-Agent        # 11 章智能体课程笔记 + 习题全解 + 代码
│   ├── chap01 ~ chap05   #   范式 / 历史 / LLM 基础 / 框架
│   ├── chap06 ~ chap07   #   框架对比 / 手写框架
│   ├── chap08 ~ chap09   #   记忆与 RAG / 上下文工程
│   ├── chap10            #   MCP / ANP / A2A 通信协议
│   └── chap11            #   Agentic RL(SFT → GRPO 端到端训练)
├── 🛠️ PI_Agent           # 7 天手写 Agent CLI(Loop / Compaction / Tools)
├── ⚡ LLM_Skill          # Anthropic Agent Skills 实战
├── 📚 统计学习方法        # 李航《统计学习方法》推导与实现
├── 📊 pyspark / tf2      # 经典大数据 / 深度学习轨迹
├── 🔬 因果效应关系_基础_贝叶斯
└── 🌐 docs/              # Docsify 文档站点

🚀 快速开始

git clone https://github.com/scchy/My_Learn.git
cd My_Learn

想学 Agent? 按顺序阅读 Hello-Agent/chap01 → chap11,每章先看笔记、再做习题、最后跑代码。 想手写 Agent? 直接读 PI_Agent/plan/mini-7d-plan.md,照着 7 天计划敲一遍。

部分章节依赖 LLM API Key,请自行配置 .env(仓库不包含任何密钥)。


📈 Star History

Star History Chart


🤝 一起学习

📄 License

本项目采用 MIT License 开源 —— 笔记与代码随意取用,但请保留一颗学习的心 😄


**目标:⭐ 1,000,000** *虽然离 freeCodeCamp(~430k)还有点距离,但梦想还是要有的* 🚀