Files
myWiki/concepts/action-head-router.md

52 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "动作头路由器 (Action Head Router)"
created: 2026-06-17
updated: 2026-06-17
type: concept
tags: [architecture, routing, reinforcement-learning]
sources: [raw/papers/zhang-tarpo-2026.md]
confidence: high
---
# 动作头路由器 (Action Head Router)
动作头路由器是 [[tarpo|TARPO]] 框架中的**轻量级路由决策模块**——一个附加在 LLM 骨干上的线性投影层,用于在每一步决定推理模式。
## 结构
```
rho(h_t) = Softmax(W_r * h_t + b_r)
```
- `h_t ∈ R^d`Transformer 最后一层隐藏状态
- `W_r ∈ R^{2×d}`:将 d 维隐藏状态投影到 2 维hard/soft 概率)
- `b_r ∈ R^2`:偏置项,初始化对训练有关键影响
这就是全文最 "lightweight" 的部分——仅 `2d + 2` 个参数。
## 初始化策略
偏置 `b_0` 的初始化影响模型对 hard/soft 的初始偏好:
- `b_0 = [2.2, 0]`:偏向 hard → 保守起点soft 比率随训练逐渐上升
- `b_0 = [0.85, 0]`:较均衡 → 早期就有较多 soft token
- 默认采用轻度 hard 偏好,与模型的自然倾向一致
## 训练与推理
- **训练时**:从 `ρ_θ` 采样路由决策,鼓励结构探索
- **推理时**:支持随机和确定性两种路由策略
## 与 LLM 骨干的关系
动作头是**最小侵入性**的——它不改变 Transformer 架构,仅读取最后一层隐藏状态作为输入。这种解耦设计使得:
1. 可轻松适配不同规模的 LLM
2. 路由决策和 token 生成使用共享的 advantage 信号联合优化
3. 训练稳定,不会干扰骨干的预训练知识
## 参考
- [[action-routing-policy|动作路由策略]]
- [[token-wise-routing|逐token路由]]
- [[tarpo|TARPO]]