new v2
Browse files- improve_gainlora/IDEA_Overall.md +351 -402
- improve_gainlora/IDEA_Overall.md.bak +337 -0
- improve_gainlora/RUN_GUIDE_DIAGNOSTIC.md +208 -0
- improve_gainlora/T5_small/gen_script_long_order3_t5_small_specroute.sh +60 -0
- improve_gainlora/T5_small/gen_script_long_order3_t5_small_specroute_v10a.sh +60 -0
- improve_gainlora/T5_small/gen_script_long_order3_t5_small_specroute_v10b.sh +60 -0
- improve_gainlora/T5_small/gen_script_long_order3_t5_small_specroute_v11.sh +60 -0
- improve_gainlora/T5_small/gen_script_long_order4_t5_small_specroute.sh +60 -0
- improve_gainlora/T5_small/gen_script_superni_order1_t5_small_specroute.sh +60 -0
- improve_gainlora/T5_small/gen_script_superni_order2_t5_small_specroute.sh +60 -0
- improve_gainlora/_patch_cpi_oap.py +72 -0
- improve_gainlora/analyze_diagnostics.py +205 -0
- improve_gainlora/gen_script_long_order3_t5_specroute.sh +60 -0
- improve_gainlora/gen_script_long_order4_t5_specroute.sh +60 -0
- improve_gainlora/gen_script_superni_order1_llama_specroute.sh +60 -0
- improve_gainlora/gen_script_superni_order1_llama_specroute_p100.sh +60 -0
- improve_gainlora/gen_script_superni_order1_t5_specroute.sh +60 -0
- improve_gainlora/gen_script_superni_order2_llama_specroute.sh +60 -0
- improve_gainlora/gen_script_superni_order2_llama_specroute_p100.sh +60 -0
- improve_gainlora/gen_script_superni_order2_t5_specroute.sh +60 -0
- improve_gainlora/improve_gainlora.tex +231 -0
- improve_gainlora/src/cl_trainer_specroute.py +239 -33
- improve_gainlora/src/run_t5.py +47 -1
- improve_gainlora/src/t5_specroute.py +7 -0
- root_gainlora/root_gainlora.tex +199 -0
improve_gainlora/IDEA_Overall.md
CHANGED
|
@@ -1,603 +1,552 @@
|
|
| 1 |
-
# SpecRoute: Định tuyến Phổ
|
| 2 |
|
| 3 |
-
> **Tài liệu thiết kế chính thức —
|
| 4 |
-
> Ràng buộc: Zero-replay nghiêm ngặt. Theory-first. Tổng hợp sau V2–V7.
|
| 5 |
|
| 6 |
---
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
**Setting.** Học liên tục với LoRA mở rộng trên một LLM đóng băng.
|
| 11 |
-
Các tasks $\mathcal{T}_1, \ldots, \mathcal{T}_T$ đến tuần tự. Với mỗi task $t$:
|
| 12 |
-
|
| 13 |
-
- Một adapter low-rank $\Delta W_t = B_t A_t$ ($A_t \in \mathbb{R}^{r \times d}$, $B_t \in \mathbb{R}^{d \times r}$) được thêm vào mọi phép chiếu attention.
|
| 14 |
-
- Chỉ $B_t$ được huấn luyện; $A_t$ bị đóng băng sau khi khởi tạo null-space (InfLoRA).
|
| 15 |
-
- Sau khi huấn luyện, cả $A_t, B_t$ đều bị đóng băng và một nhánh mới được tạo cho task tiếp theo.
|
| 16 |
-
|
| 17 |
-
**Inference.** Cho input $x$ *không có* task identifier, mô hình phải tạo ra output đúng:
|
| 18 |
-
|
| 19 |
-
$$y = f\!\Bigl(W_0\, x \;+\; \sum_{t=1}^{T} w_t(x)\; B_t A_t\, x\Bigr)$$
|
| 20 |
-
|
| 21 |
-
**Ba bài toán con kết hợp:**
|
| 22 |
-
|
| 23 |
-
| Bài toán con | Mục tiêu | Yêu cầu hình thức |
|
| 24 |
-
|:------------:|---------|-------------------|
|
| 25 |
-
| **Routing (R)** | Gán input đúng expert | $w_{t^*}(x) \gg w_t(x)$ với $t \neq t^*$ |
|
| 26 |
-
| **Protection (P)** | Ngăn suy giảm expert cũ | $\Delta W_t$ không đổi sau task $t$ |
|
| 27 |
-
| **Allocation (A)** | Quản lý capacity không gian con hữu hạn | $\sum_t \dim\bigl(\mathrm{span}(A_t)\bigr) \leq d$ |
|
| 28 |
-
|
| 29 |
-
**Ràng buộc setting:** *Zero-replay* — không tái sử dụng dữ liệu task cũ dưới bất kỳ hình thức nào (thô, synthetic, hay phân phối thống kê).
|
| 30 |
|
| 31 |
---
|
| 32 |
|
| 33 |
-
##
|
| 34 |
|
| 35 |
-
###
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|-----------|--------|---------|
|
| 41 |
-
| R | MLP `trans_input` học được + `prompt_key` học được → cosine gating | Tham số thêm + subspace GPM |
|
| 42 |
-
| P | GPM chiếu gradient vào null-space của task cũ | Tiêu thụ subspace mỗi task |
|
| 43 |
-
| A | Threshold tăng dần $\varepsilon_t \nearrow 1$ | Task sau bị ràng buộc hơn |
|
| 44 |
-
|
| 45 |
-
**Điểm yếu cơ bản:** Vì routing được *học*, nó tạo ra vòng lặp xấu:
|
| 46 |
|
| 47 |
-
|
| 48 |
-
2. GPM phải bảo vệ routing params → *tiêu thụ subspace có thể dùng cho task learning*.
|
| 49 |
-
3. KL distillation trên routing cần thiết → yêu cầu replay hoặc frozen copies → overhead bộ nhớ.
|
| 50 |
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
|
| 59 |
-
|
| 60 |
-
> Chống quên (bảo vệ subspace trực giao) và nhận diện task (routing phân biệt)
|
| 61 |
-
> là *hai biểu hiện kép của cùng một cấu trúc phổ*.
|
| 62 |
-
> Giải quyết một bài toán tự động giải quyết bài toán kia.
|
| 63 |
|
| 64 |
-
|
| 65 |
-
- Không cần tham số routing học được → không trôi dạt routing, không tốn GPM cho routing.
|
| 66 |
-
- Không cần replay để duy trì routing → tự nhiên tuân thủ zero-replay.
|
| 67 |
-
- Độ chính xác routing được *đảm bảo* bởi chất lượng bảo vệ (được hình thức hoá bên dưới).
|
| 68 |
|
| 69 |
-
### 2.
|
| 70 |
|
| 71 |
-
|
| 72 |
|
| 73 |
-
|
|
|
|
|
|
|
| 74 |
|
| 75 |
-
**
|
| 76 |
|
| 77 |
-
|
| 78 |
-
2. $\text{rowspace}(A_t) = r$ hướng **ngẫu nhiên** trong $d'$-chiều null-space (không encode task identity).
|
| 79 |
-
3. Với same-domain tasks (yelp/amazon/sst2/imdb): input $h$ có variance theo hướng CHUNG → signatures không phân biệt được.
|
| 80 |
|
| 81 |
-
|
| 82 |
|
| 83 |
-
|
| 84 |
|
| 85 |
-
|
| 86 |
-
$$\|A_t h\|^2 \;=\; \|A_t Q_{t-1} h\|^2 \quad \forall h, \quad Q_{t-1} = I - P_{t-1}$$
|
| 87 |
|
| 88 |
-
|
| 89 |
|
| 90 |
-
|
| 91 |
|
| 92 |
-
**
|
| 93 |
-
$$E_{h \sim p_t}[\|A_t h\|^2] = \sum_{i=1}^r \lambda_i(\tilde{C}_t) \quad \textbf{— GIÁ TRỊ CỰC ĐẠI}$$
|
| 94 |
|
| 95 |
-
**
|
| 96 |
|
| 97 |
-
> **
|
| 98 |
|
| 99 |
---
|
| 100 |
|
| 101 |
-
## 3.
|
| 102 |
|
| 103 |
-
### 3.1
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
-
|
| 108 |
|
| 109 |
-
|
| 110 |
|
| 111 |
-
|
| 112 |
-
- $\boldsymbol{\sigma}_t$: **sensitivity spectrum** — hệ số khuếch đại biến đổi dọc mỗi hướng.
|
| 113 |
|
| 114 |
-
|
| 115 |
|
| 116 |
-
|
| 117 |
|
| 118 |
-
**
|
| 119 |
|
| 120 |
-
|
| 121 |
|
| 122 |
-
|
| 123 |
|
| 124 |
-
|
| 125 |
|
| 126 |
-
**
|
| 127 |
|
| 128 |
-
|
| 129 |
-
|-----------|-----------|
|
| 130 |
-
| Dải giá trị | $\alpha_t(h) \in [0,\, 1]$ — weighted Rayleigh quotient chuẩn hoá |
|
| 131 |
-
| Energy ratio | $\alpha_t(h) = \|\Delta W_t\, h\|^2 \;/\; \bigl(\|\Delta W_t\|_F^2\, \|h\|^2\bigr)$ |
|
| 132 |
-
| Ý nghĩa | Phần channel capacity của expert $t$ được kích hoạt bởi $h$ |
|
| 133 |
-
| In-distribution | $h \in \mathrm{span}(V_t) \;\Rightarrow\; \alpha_t(h) \geq \kappa_{\min}(t) > 0$ |
|
| 134 |
-
| Out-of-distribution | $h \perp \mathrm{span}(V_t) \;\Rightarrow\; \alpha_t(h) = 0$ chính xác |
|
| 135 |
|
| 136 |
-
|
| 137 |
|
| 138 |
-
**
|
| 139 |
|
| 140 |
-
$$
|
| 141 |
|
| 142 |
-
|
| 143 |
|
| 144 |
-
---
|
| 145 |
|
| 146 |
-
|
| 147 |
|
| 148 |
-
|
| 149 |
|
| 150 |
-
|
| 151 |
|
| 152 |
-
$$\
|
| 153 |
|
| 154 |
-
**
|
| 155 |
|
| 156 |
-
*
|
| 157 |
|
| 158 |
-
|
| 159 |
|
| 160 |
-
*
|
| 161 |
|
| 162 |
-
|
| 163 |
|
| 164 |
-
|
| 165 |
|
| 166 |
-
**
|
| 167 |
|
| 168 |
-
|
| 169 |
|
| 170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
|
| 172 |
-
---
|
| 173 |
|
| 174 |
-
**
|
| 175 |
|
| 176 |
-
|
|
|
|
|
|
|
| 177 |
|
| 178 |
-
**
|
|
|
|
| 179 |
|
| 180 |
-
|
| 181 |
|
| 182 |
-
|
| 183 |
|
| 184 |
-
|
| 185 |
|
| 186 |
-
$$
|
| 187 |
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
-
|
| 191 |
|
| 192 |
-
|
| 193 |
-
- $\text{rowspace}(B_t A_t) \subseteq \text{rowspace}(A_t)$: đúng với mọi $B_t$ (phép nhân bên trái không mở rộng rowspace).
|
| 194 |
-
- $\text{rowspace}(A_t) \subseteq \text{null}(P_{\text{old}})$: bởi bước InfLoRA projection ở trên.
|
| 195 |
-
- GPM bases $\mathcal{B}$ span xấp xỉ $\text{rowspace}(A_s)$ cho các task $s < t$ (vì GPM tích lũy principal input directions, mà activation của task $s$ chủ yếu kích hoạt theo hướng $A_s$).
|
| 196 |
-
- Do đó: $\text{span}(V_t) \subseteq \text{null}(P_{\text{old}}) \approx \perp \text{span}(V_s)$ với mọi $s < t$. $\square$
|
| 197 |
|
| 198 |
-
**
|
|
|
|
|
|
|
|
|
|
| 199 |
|
|
|
|
|
|
|
|
|
|
| 200 |
|
| 201 |
-
|
| 202 |
-
$$\sin\!\bigl(\Theta(\hat{V}_s, V_s)\bigr) \leq \frac{\|\hat{C}_s - C_s\|_2}{\delta_{\text{gap}}(C_s)}$$
|
| 203 |
-
trong đó $\hat{C}_s$ là sample covariance (200 batches), $\delta_{\text{gap}}$ là eigenvalue gap. Với batch size 200 và T5-small $d=512$, sai số này nhỏ khi $\delta_{\text{gap}}$ đủ lớn (task distributions phân kỳ). Kết quả thực tế: margin trong Định lý 1 bị giảm thêm $O(\|\Delta P\|_F / \delta_{\text{gap}})$ — nhỏ với tasks có spectrum phân kỳ, lớn hơn với same-domain tasks (expected). Xẩy ra same-domain routing failure vẫn là giới hạn của *mọi* zero-replay CL method, không phải đặc thù SpecRoute.
|
| 204 |
|
| 205 |
-
|
|
|
|
| 206 |
|
| 207 |
-
|
| 208 |
-
$$\|A_t h\|^2 \;=\; \|A_t Q_{t-1} h\|^2, \quad Q_{t-1} = I - P_{t-1}$$
|
| 209 |
|
| 210 |
-
|
| 211 |
-
$$A_t h = A_t P_{t-1} h + A_t Q_{t-1} h = 0 + A_t Q_{t-1} h \qquad \square$$
|
| 212 |
|
| 213 |
-
|
| 214 |
-
$$E_{h \sim p_s}\!\left[\alpha_t(h)\right] = \frac{E[\|A_t Q_{t-1} h\|^2]}{r\,\|h\|^2} \leq \frac{\mathrm{tr}(Q_{t-1} C_s)}{r} \leq \frac{(1-\tau_\text{GPM})\,\mathrm{tr}(C_s)}{r} \leq \frac{0.005\,\mathrm{tr}(C_s)}{r}$$
|
| 215 |
|
| 216 |
-
**
|
| 217 |
-
$$\text{rowspace}(A_s) \subseteq \text{range}(P_{t-1}) \quad\Rightarrow\quad A_s Q_{t-1} = 0$$
|
| 218 |
-
Suy ra $A_s h_t = A_s P_{t-1} h_t$ và:
|
| 219 |
-
$$E_{h \sim p_t}[\alpha_s(h)] = \frac{E[\|A_s P_{t-1} h_t\|^2]}{r\,\|h_t\|^2} \leq \frac{\mathrm{tr}(P_{t-1} C_t)}{r\,\mathrm{tr}(C_t)} \cdot \frac{\mathrm{tr}(C_t)}{r}$$
|
| 220 |
-
Với task $t$ có domain mới (khác task cũ): $\mathrm{tr}(P_{t-1} C_t) / \mathrm{tr}(C_t) = \text{PEV}_{t,\text{old}} \ll 1$ — fraction variance của task $t$ được giải thích bởi các cơ sở cũ. Với same-domain tasks: $\text{PEV}_{t,\text{old}}$ lớn hơn, đây là giới hạn cơ bản của mọi zero-replay CL method, không phải lỗ hổng đặc thù của SpecRoute.
|
| 221 |
|
| 222 |
-
-
|
| 223 |
|
| 224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
|
| 226 |
-
**
|
| 227 |
-
$
|
|
|
|
|
|
|
| 228 |
|
| 229 |
-
**
|
| 230 |
-
$$\operatorname{argmax}_{A_t \in \mathcal{A}_t} E_{h \sim p_t}[\alpha_t(h)] \;=\; \text{top-}r\text{ eigenvectors của } \tilde{C}_t$$
|
| 231 |
-
Giá trị cực đại: $\displaystyle\frac{1}{r}\sum_{i=1}^r \lambda_i(\tilde{C}_t)$
|
| 232 |
-
|
| 233 |
-
**Chứng minh.** Từ Lemma 1:
|
| 234 |
-
$$E_{h \sim p_t}[\alpha_t(h)] = \frac{E[\|A_t Q_{t-1} h\|^2]}{r\,E[\|h\|^2]} = \frac{\mathrm{tr}(A_t\,\tilde{C}_t\,A_t^\top)}{r}$$
|
| 235 |
-
Với ràng buộc $A_t A_t^\top = I_r$, đây là **Constrained PCA** tiêu chuẩn trên $\tilde{C}_t$: lời giải là eigenvectors ứng với eigenvalues lớn nhất. Đây chính xác là C5. $\square$
|
| 236 |
-
|
| 237 |
-
**Ý nghĩa:** C5 **đồng thời** tối ưu:
|
| 238 |
-
1. **Learning quality:** maximize $\mathrm{tr}(A_t \tilde{C}_t A_t^\top)$ = variance captured trong null-space → $B_t$ học được hiệu quả.
|
| 239 |
-
2. **Routing signal:** maximize $E[\alpha_t(h)]$ → routing phân biệt task $t$ tốt hơn mọi init khác.
|
| 240 |
-
|
| 241 |
-
*Đây là lý do C5 và C2 là bất khả phân: C5 biến random routing key thành optimal routing key.*
|
| 242 |
|
| 243 |
---
|
| 244 |
|
| 245 |
-
#
|
| 246 |
-
|
| 247 |
-
**Định lý 3** *(Explicit Routing Margin).* Gọi $\lambda_t^\min = \lambda_r(\tilde{C}_t)$ (r-th eigenvalue của projected covariance). Với C5 init và A-row routing ($\tau_\text{GPM} = 0.995$):
|
| 248 |
-
$$\boxed{E_{h \sim p_t}[\alpha_t(h)] - \max_{s < t}\,E_{h \sim p_s}[\alpha_t(h)] \;\geq\; \frac{\lambda_t^\min}{r} - \frac{0.005\,\bar{\sigma}^2}{r}}$$
|
| 249 |
-
|
| 250 |
-
với $\bar{\sigma}^2 = \max_s \mathrm{tr}(C_s)$.
|
| 251 |
-
|
| 252 |
-
**Hệ quả (GPM–Routing Paradox Formalized):** Với random $A_t$ (không có C5), routing signal:
|
| 253 |
-
$$E_{h \sim p_t}[\alpha_t^\text{rand}(h)] \approx \frac{\mathrm{tr}(\tilde{C}_t)}{d'}$$
|
| 254 |
-
|
| 255 |
-
Tỷ lệ lợi thế C5 over random:
|
| 256 |
-
$$\frac{E[\alpha_t^\text{C5}(h)]}{E[\alpha_t^\text{rand}(h)]} \;=\; \underbrace{\frac{d'}{r}}_{\text{null-space factor}} \cdot \underbrace{\text{PEV}_r(\tilde{C}_t)}_{\text{task concentration}}$$
|
| 257 |
-
|
| 258 |
-
**Quan sát quan trọng:** Factor $d'/r$ và $\text{PEV}_r$ đều **tăng ý nghĩa về mặt routing khi null-space shrinks** (later tasks). C5 quan trọng nhất chính khi routing khó nhất.
|
| 259 |
-
|
| 260 |
-
Với T5-small task 8 ($d' \approx 351$, $r=8$): tỷ lệ $\approx 44\times \cdot \text{PEV}_8 \gg 1$.
|
| 261 |
|
| 262 |
---
|
| 263 |
|
| 264 |
-
##
|
| 265 |
-
|
| 266 |
-
**Mệnh đề 2** *(Two-Phase Routing).* SpecRoute dùng hai cơ chế routing khác nhau theo phase:
|
| 267 |
-
|
| 268 |
-
| Phase | Cơ chế | Lý do |
|
| 269 |
-
|-------|---------|-------|
|
| 270 |
-
| Training (task $t$) | **Oracle: luôn route 100% về current task** | Task ID luôn biết khi training; spectral routing sẽ kill gradient vì GPM-Routing paradox |
|
| 271 |
-
| Inference | **Hard Top-1 spectral routing** (với calibration normalization) | Task ID không có; routing tự động từ A-row calibrated affinity |
|
| 272 |
-
|
| 273 |
-
**Tại sao training cần oracle routing:**
|
| 274 |
-
|
| 275 |
-
GPM-Routing Paradox (§3.10) buộc $A_t \perp h_t$ theo nghĩa: $A_t$ nằm trong null-space của $P_{\text{old}}$, trong khi $h_t$ có energy lớn nhất trên $\text{span}(P_{\text{old}})$ cho các task cùng domain với old tasks. Hệ quả: $\|A_t h_t\|^2 \approx 0$ → fit score của current task gần như 0 → spectral argmax chọn old task → $B_t$ không nhận gradient → **không bao giờ học**.
|
| 276 |
|
| 277 |
-
|
| 278 |
|
| 279 |
-
**
|
|
|
|
|
|
|
| 280 |
|
| 281 |
-
|
| 282 |
|
| 283 |
-
$$\alpha_t
|
| 284 |
|
| 285 |
-
|
| 286 |
|
| 287 |
-
**
|
| 288 |
|
| 289 |
-
|
| 290 |
-
- Scale consistency: $\hat{\mu}_t$ ước lượng tốt $E[\alpha_t | h \sim p_t]$ → calibrated score ổn.
|
| 291 |
-
- C5 advantage: $\alpha_t$ trên task-t data cao hơn $\alpha_s$ (s là task khác domain) → sau calibration vẫn win.
|
| 292 |
-
- Same-domain limit: task cùng domain có $\alpha_t \approx \alpha_s$ ngay cả sau calibration — đây là giới hạn cấu trúc được thảo luận §3.10.
|
| 293 |
|
| 294 |
-
--
|
| 295 |
-
|
| 296 |
-
### 3.9 Drift Invariance
|
| 297 |
-
|
| 298 |
-
**Mệnh đề 3** *(Drift-Free Routing).* Hàm routing $h \mapsto \alpha_t(h)$ bất biến qua tất cả tasks: $h$ từ frozen embedding table trước mọi attention layer; $A_t$ đóng băng sau C5 init. $\square$
|
| 299 |
-
|
| 300 |
-
**Làm rõ về layer routing:** Routing được tính *một lần* tại input (token embedding, trước block transformer đầu tiên) — không phải routing riêng biệt tại mỗi transformer layer. Vector $h$ = mean-pool của token embeddings (frozen `embed_tokens`), không thay đổi qua training. Điều này đảm bảo routing hoàn toàn frozen và không drift. C5 initialization per-layer (mỗi attention layer có $A_t^{(l)}$ riêng) phục vụ *learning quality* chứ không phải routing — routing chỉ dùng encoder layers để aggregate signal.
|
| 301 |
|
| 302 |
-
|
| 303 |
|
| 304 |
-
|
| 305 |
|
| 306 |
-
|
| 307 |
-
- **(A) Expert phải học được:** $A_t$ phải align với task-relevant directions. C5 giải quyết bằng data-informed init.
|
| 308 |
-
- **(B) Input phải co projection:** Inputs thực phải có energy trên $\text{span}(V_t)$.
|
| 309 |
|
| 310 |
-
|
| 311 |
|
|
|
|
| 312 |
|
|
|
|
| 313 |
|
| 314 |
-
|
| 315 |
|
| 316 |
-
|
| 317 |
|
| 318 |
-
-
|
|
|
|
| 319 |
|
| 320 |
-
|
| 321 |
|
| 322 |
-
|
| 323 |
|
| 324 |
-
|
| 325 |
|
| 326 |
-
|
| 327 |
-
- **Không tham số bổ sung** — $A_t$ là model parameter đã có.
|
| 328 |
-
- **Bất biến** — $A_t$ đóng băng sau C5 init (Mệnh đề 3).
|
| 329 |
|
| 330 |
-
|
| 331 |
|
| 332 |
-
|
| 333 |
|
| 334 |
-
**
|
| 335 |
|
| 336 |
-
|
| 337 |
|
| 338 |
-
|
| 339 |
|
| 340 |
-
|
| 341 |
|
| 342 |
-
|
| 343 |
|
| 344 |
-
|
| 345 |
-
- **Optimality với C5 (Định lý 2):** C5 init chọn $A_t$ = argmax $E[\|A_t h\|^2]$ trên tất cả $A_t \in \mathcal{A}_t$ — A-row affinity là tốt nhất có thể trong constraint.
|
| 346 |
-
- **Margin bound (Định lý 3):** $E[\alpha_t|h \sim p_t] - \max_s E[\alpha_t|h \sim p_s] \geq \lambda_t^\min/r - 0.005\bar{\sigma}^2/r > 0$.
|
| 347 |
-
- **Loại bỏ `prepare_inference_routing()`:** $A_t$ đóng băng sau C5 init — là signature không cần tái tính SVD của $B_tA_t$.
|
| 348 |
|
| 349 |
-
**
|
| 350 |
|
| 351 |
-
|
| 352 |
-
$$\frac{E[\alpha_t^\text{C5}(h)]}{E[\alpha_t^\text{rand}(h)]} = \frac{d'}{r} \cdot \text{PEV}_r(\tilde{C}_t) \approx 44\times \text{ tại task 8 (T5-small)}$$
|
| 353 |
|
| 354 |
-
|
| 355 |
-
|-------|----------------|-------|
|
| 356 |
-
| Training (task $t$) | **Oracle: weight=1.0 cho current task** | Tránh GPM-Routing paradox kill gradient |
|
| 357 |
-
| **Inference (mọi task)** | **Hard Top-1 calibrated A-row argmax** | **Calibration normalize scale; không SVD** |
|
| 358 |
-
| Đảm bảo lý thuyết | Định lý 3 margin bound + C5 advantage $44\times$ | Inference routing dùng calibrated affinity |
|
| 359 |
|
| 360 |
-
|
|
|
|
| 361 |
|
| 362 |
-
|
| 363 |
-
- $\
|
| 364 |
-
- $\
|
| 365 |
|
| 366 |
-
*
|
| 367 |
|
| 368 |
-
$$\
|
| 369 |
|
| 370 |
-
|
|
|
|
| 371 |
|
| 372 |
-
--
|
| 373 |
|
| 374 |
-
|
|
|
|
|
|
|
| 375 |
|
| 376 |
-
|
| 377 |
|
| 378 |
-
|
| 379 |
|
| 380 |
-
$
|
| 381 |
|
| 382 |
-
|
| 383 |
|
| 384 |
-
|
| 385 |
|
| 386 |
-
--
|
| 387 |
|
| 388 |
-
###
|
| 389 |
|
| 390 |
-
|
| 391 |
|
| 392 |
-
|
| 393 |
|
| 394 |
-
|
| 395 |
|
| 396 |
-
|
| 397 |
|
| 398 |
-
|
| 399 |
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
là activation covariance của task $t$ được ước tính từ vài batch đầu của dữ liệu training.
|
| 405 |
-
|
| 406 |
-
**Ý nghĩa:** Maximize variance captured trong null-space theo phân phối dữ liệu task $t$ — tức là tìm subspace $r$-chiều trong null-space *phù hợp nhất* với dữ liệu task hiện tại.
|
| 407 |
-
|
| 408 |
-
#### Lời giải dạng đóng
|
| 409 |
-
|
| 410 |
-
Định nghĩa **projected covariance**: $\tilde{C}_t = Q\, C_t\, Q$.
|
| 411 |
|
| 412 |
-
|
| 413 |
|
| 414 |
-
$$
|
| 415 |
|
| 416 |
-
|
| 417 |
|
| 418 |
-
|
| 419 |
|
| 420 |
-
|
| 421 |
-
# Bước 1: Thu thập activation covariance (forward pass nhỏ, trước training)
|
| 422 |
-
C_t = ∑ h(x)h(x)^T / N_batch # covariance input task t (N_batch ~100 batches)
|
| 423 |
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
|
| 428 |
-
|
| 429 |
-
|
|
|
|
| 430 |
|
| 431 |
-
#
|
| 432 |
-
if eigvals[-1] < 1e-6:
|
| 433 |
-
# Null-space bị bão hoà hoặc task không có activation rõ ràng
|
| 434 |
-
# Revert về Kaiming random init + InfLoRA projection như gốc
|
| 435 |
-
continue
|
| 436 |
|
| 437 |
-
|
| 438 |
|
| 439 |
-
|
| 440 |
-
A_t = eigvecs[:, top_r_idx].T # shape (r, d) — direction task-relevant nhất trong null-space
|
| 441 |
-
A_t = A_t / norm(A_t, dim=1, keepdim=True) * sqrt(3) # normalize như InfLoRA gốc
|
| 442 |
-
```
|
| 443 |
|
| 444 |
-
|
|
|
|
|
|
|
|
|
|
| 445 |
|
| 446 |
-
|
| 447 |
|
| 448 |
-
|
| 449 |
|
| 450 |
-
|
| 451 |
|
| 452 |
-
|
| 453 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
| 454 |
|
| 455 |
-
|
| 456 |
|
| 457 |
-
|
| 458 |
|
| 459 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 460 |
|
| 461 |
-
|
| 462 |
|
| 463 |
-
##
|
| 464 |
|
| 465 |
-
|
|
| 466 |
-
|----------
|
| 467 |
-
|
|
| 468 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 469 |
|
| 470 |
---
|
| 471 |
|
| 472 |
-
##
|
| 473 |
|
| 474 |
-
|
| 475 |
-
|------------|----------|-----------|-------|
|
| 476 |
-
| MLP `trans_input` | Learned routing projection | ❌ Loại bỏ | Duality: spectral affinity là đủ |
|
| 477 |
-
| `prompt_key` | Learned per-task key | ❌ Loại bỏ | Thay bằng spectral signatures |
|
| 478 |
-
| `previous_trans_input` | Frozen MLP copies | ❌ Loại bỏ | Signatures bất biến theo cấu trúc |
|
| 479 |
-
| KL distillation | Replay-based routing loss | ❌ Loại bỏ | Không learned routing → không cần distill |
|
| 480 |
-
| GPM trên routing params | Subspace cho routing | ❌ Loại bỏ | Không có routing parameters để bảo vệ |
|
| 481 |
-
| **`prepare_inference_routing()`** | **SVD của $B_tA_t$ post-training** | **❌ Loại bỏ (V8)** | **$A_t$ là signature, kh\u00f4ng c\u1ea7n t\u00e1i t\u00ednh SVD; lo\u1ea1i b\u1ecf $O(dr^2)$ overhead** |
|
| 482 |
-
| **SVD $\sigma^2$-weighted inference** | **Rayleigh quotient khác train formula** | **❌ Loại bỏ (V8)** | **Train-inference mismatch; A-row đủ từ Lemma 1 + Định lý 2** |
|
| 483 |
|
| 484 |
-
|
| 485 |
|
| 486 |
-
-
|
| 487 |
|
| 488 |
-
|
| 489 |
|
| 490 |
-
|
| 491 |
|
| 492 |
-
|
| 493 |
|
| 494 |
-
|
| 495 |
|
| 496 |
-
|
|
|
|
|
|
|
|
|
|
| 497 |
|
| 498 |
-
**
|
| 499 |
|
| 500 |
-
|
| 501 |
|
| 502 |
-
|
| 503 |
-
- Routing margin $\geq \kappa_{\min}(t^*) - \varepsilon\, \kappa_{\max}$ — tỷ lệ thuận với chất lượng bảo vệ (Định lý 1).
|
| 504 |
-
- Routing weight $w_{t^*} \geq 1-\delta$ với nhiệt độ $\tau \leq m/\ln\!\bigl((T-1)/\delta\bigr)$ (Hệ quả 1).
|
| 505 |
-
- Capacity bound $T_{\max} \leq d/(\bar{k}(1-\varepsilon))$ qua lý thuyết Grassmannian packing (Hệ quả 2), trong đó $\bar{k}$ là GPM effective rank ($\approx 30$–$80$ dims/task), không phải LoRA rank $r=8$.
|
| 506 |
-
- Routing hoàn toàn bất biến qua thời gian: $h$ từ frozen embedding table, $\mathcal{S}_t$ đóng băng sau training (Mệnh đề 1).
|
| 507 |
|
| 508 |
-
**
|
| 509 |
|
| 510 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 511 |
|
| 512 |
-
|
| 513 |
|
| 514 |
-
|
| 515 |
|
| 516 |
-
|
| 517 |
|
| 518 |
-
**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 519 |
|
| 520 |
-
|
| 521 |
|
| 522 |
-
|
| 523 |
|
| 524 |
-
|
| 525 |
|
| 526 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 527 |
|
| 528 |
-
|
| 529 |
|
| 530 |
-
|
| 531 |
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
### Task 1 (`--run_single True`)
|
| 535 |
-
1. Load pretrained model + fresh LoRA ($A$: Kaiming, $B$: zeros).
|
| 536 |
-
2. Huấn luyện chuẩn (chỉ `lora_B`) — single expert, không routing.
|
| 537 |
-
3. Sau training: cập nhật GPM bases (ESA threshold). **Không cần tính SVD hay `prepare_inference_routing()`** — $A_t$ là signature.
|
| 538 |
-
4. Lưu: LoRA weights, GPM reg files.
|
| 539 |
-
|
| 540 |
-
### Task $t \geq 2$
|
| 541 |
-
1. Load model + fresh LoRA; load LoRA weights cũ.
|
| 542 |
-
2. **[C5 — MỚI]** Pre-task forward pass (200 batch, no grad):
|
| 543 |
-
- Thu thập activation covariance $C_t$ của inputs task $t$
|
| 544 |
-
- Tính projected covariance: $\tilde{C}_t = Q C_t Q$ ($Q = I - P_{\text{old}}$)
|
| 545 |
-
- Eigenvectors của $\tilde{C}_t$ → khởi tạo $A_t$ (thay thế random Kaiming)
|
| 546 |
-
3. InfLoRA: chuẩn hoá $A_t$ (đã nằm trong null-space từ eigenvector decomposition).
|
| 547 |
-
4. Huấn luyện `lora_B` với **oracle routing** (current task weight=1.0) + gradient preconditioning (C4.1). EMA fit scale cho calibration normalization tự động được thu thập trong quá trình training.
|
| 548 |
-
5. Sau training: cập nhật GPM bases (200 batches). **Không gọi `prepare_inference_routing()`** — $A_t$ đóng băng từ bước 2 là signature đủ dùng.
|
| 549 |
-
6. Lưu tất cả artifacts cho task tiếp theo.
|
| 550 |
|
| 551 |
-
---
|
| 552 |
|
| 553 |
-
## 8.
|
| 554 |
-
|
| 555 |
-
| Lý thuyết | Implementation | File |
|
| 556 |
-
|-----------|---------------|------|
|
| 557 |
-
| Spectral signature $\mathcal{S}_t = A_t$ | `lora_A` weights (frozen after C5 init) — **không cần SVD** | `t5_specroute.py` |
|
| 558 |
-
| Spectral affinity $\alpha_t(h)$ (inference) | Calibrated A-row fit: `fit / E_fit_ema`, hard Top-1 argmax | `compute_spectral_routing()` |
|
| 559 |
-
| Oracle routing (training) | `weights[:, 0] = 1.0` — current task always selected | `compute_spectral_routing()` |
|
| 560 |
-
| ~~A-row proxy $\alpha_t^{\mathrm{train}}$ + $\beta(n)$~~ | ~~A-row fit + adaptive bias~~ | **❌ Loại bỏ (V9 oracle training)** |
|
| 561 |
-
| ~~Symmetric inference SVD~~ | ~~`prepare_inference_routing()` → SVD của $B_t A_t$~~ | **❌ Loại bỏ hoàn toàn (V8)** |
|
| 562 |
-
| Calibration normalization $\hat{\mu}_t$ | EMA fit scale collected during training, stored in signatures | `compute_spectral_routing()` |
|
| 563 |
-
| Drift-free input $h$ | `inputs_embeds = embed_tokens(input_ids)` → mean-pool | `T5Stack.forward()` |
|
| 564 |
-
| GPM + InfLoRA null-space | `get_reg_matrix()` | `cl_trainer_specroute.py` |
|
| 565 |
-
| Dynamic ESA threshold | `(1−ε₀)·t/T + ε₀` | `cl_trainer_specroute.py` |
|
| 566 |
-
| C4: Preconditioner | `precompute_preconditioners()` → eigendecomposition | `cl_trainer_specroute.py` |
|
| 567 |
-
| **C5: Data-informed init** | **`pre_task_data_collection()` → `eigh(Q@C@Q)` → set `lora_A.data`** | **`cl_trainer_specroute.py`** |
|
| 568 |
-
| C5: Fallback | max eigval < 1e-6 → skip C5, keep Kaiming + InfLoRA projection | `cl_trainer_specroute.py` |
|
| 569 |
-
| **V10a: Learned Routing** | **`Trans_input` + `prompt_key` gating with exact post-step GPM constraints** | **`t5_specroute.py` & `cl_trainer_specroute.py`** |
|
| 570 |
-
| **V10b: Grassmann Routing** | **Geometry-based routing via Grassmannian distance on batch principal subspaces** | **`t5_specroute.py`** |
|
| 571 |
|
| 572 |
-
-
|
| 573 |
|
| 574 |
-
|
| 575 |
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
| Metrics | AP (Average Performance, ↑), FT (Forgetting, ↓) |
|
| 581 |
-
| LoRA | $r = 8$, target=Q+V, InfLoRA (chỉ B trained, A đóng băng) |
|
| 582 |
-
| Routing | Oracle training (current task weight=1.0); Hard Top-1 calibrated A-row (inference) |
|
| 583 |
-
| ESA | $\varepsilon_0 = 0.995$ (dynamic) |
|
| 584 |
-
| C4 | Gradient preconditioning bật (`--use_preconditioning True`), $\epsilon = 10^{-6}$; entropy reg đã loại bỏ V7 |
|
| 585 |
-
| **C5** | **N_batch = 100, `torch.linalg.eigh` trên projected covariance, fallback nếu max_eigval < 1e-6** |
|
| 586 |
-
| GPM repr. | 200 batches (giảm từ 1000 — SVD ổn định sau 200) |
|
| 587 |
-
| **Scalability note** | **C5 per-layer eigdecomp: $O(d^2)$ per layer per task. Với T5-small ($d=512$) tất cả layers: chấp nhận được. Với flan-t5-large ($d=1024$): 4× đắt hơn nhưng vẫn chỉ tuyến tính theo tasks. Với LLaMA-7B ($d=4096$): sử dụng randomized SVD hoặc Lanczos (top-$r$ eigenvecs không cần full decomp) giảm xuống $O(dr)$ per layer.** |
|
| 588 |
-
| Precision | fp32 + gradient_checkpointing (T5 + P100: fp16 có risk NaN overflow với large softmax) |
|
| 589 |
-
| P100 BSZ | BSZ=8, GA=4 (effective 32); T4: BSZ=2, GA=8 |
|
| 590 |
-
| Thời gian (P100 16GB) | SuperNI T5-Small ≈ 2-3h; Long benchmark ≈ 3-4h — thoải mái trong 12h Kaggle |
|
| 591 |
-
| So sánh | Batch size, LR, scheduler khớp chính xác ROOT (GainLoRA) |
|
| 592 |
|
| 593 |
-
-
|
|
|
|
|
|
|
| 594 |
|
| 595 |
-
|
|
|
|
|
|
|
| 596 |
|
| 597 |
-
|
| 598 |
-
|------|---------|
|
| 599 |
-
| `src/t5_specroute.py` | T5Stack + spectral routing + thin SVD |
|
| 600 |
-
| `src/t5_gainlora_inflora.py` | LoRALayer, T5Attention, T5Block (shared base) |
|
| 601 |
-
| `src/cl_trainer_specroute.py` | Trainer: GPM, InfLoRA, ESA, C4, C5, training_step |
|
| 602 |
-
| `src/run_t5.py` | Entry: model loading, parameter freezing |
|
| 603 |
-
| `gen_script_*_specroute*.sh` | Experiment scripts |
|
|
|
|
| 1 |
+
# SpecRoute: Định tuyến Phổ với Khởi tạo Phân biệt và Chiếu Nhận biết Chồng lấn trong Học Liên tục LoRA
|
| 2 |
|
| 3 |
+
> **Tài liệu thiết kế chính thức** — Ràng buộc: cheat ≤ root (GainLoRA). Theory-first.
|
|
|
|
| 4 |
|
| 5 |
---
|
| 6 |
|
| 7 |
+
# PHẦN I — BÀI TOÁN VÀ ĐỘNG LỰC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
---
|
| 10 |
|
| 11 |
+
## 1. Bài toán và Ràng buộc
|
| 12 |
|
| 13 |
+
### 1.1 Bài toán
|
| 14 |
|
| 15 |
+
Bài toán học liên tục với mô hình ngôn ngữ lớn (LLM) đặt yêu cầu: mô hình tiếp thu tuần tự $T$ task không đồng nhất — phân loại cảm xúc, suy luận ngôn ngữ, hỏi đáp — trong điều kiện dữ liệu task trước không khả dụng tại thời điểm huấn luyện task mới. Với mỗi task $t$, một LoRA adapter $\Delta W_t = B_t A_t$ được bổ sung vào mô hình nền đóng băng; $A_t$ đóng băng sau khởi tạo (InfLoRA constraint), chỉ $B_t$ được huấn luyện. Tại inference, task identity không được cung cấp:
|
| 16 |
|
| 17 |
+
$$y = f\!\Bigl(W_0\, x \;+\; \sum_{t=1}^{T} w_t(x)\; B_t A_t\, x\Bigr)$$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
Ba thách thức đan xen:
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
| Thách thức | Yêu cầu |
|
| 22 |
+
|:----------:|---------|
|
| 23 |
+
| **Định tuyến (R)** | Xác định adapter phù hợp cho input đầu vào |
|
| 24 |
+
| **Bảo vệ (P)** | Đảm bảo adapter cũ không bị suy giảm khi học task mới |
|
| 25 |
+
| **Phân bổ (A)** | Quản lý dung lượng subspace hữu hạn cho $T$ adapters |
|
| 26 |
|
| 27 |
+
### 1.2 Ràng buộc: Cheat ≤ Root
|
| 28 |
|
| 29 |
+
GainLoRA (baseline) lưu trữ các thống kê sau từ old tasks:
|
| 30 |
+
- SVD bases của activation covariance (GPM): `reg_{i}.pt` per layer
|
| 31 |
+
- SVD bases của MLP activation ở 3 tầng: `trans_input/reg_{0,1,2}.pt`
|
| 32 |
+
- Frozen MLP weights (`previous_trans_input.pt`) + frozen prompt keys
|
| 33 |
+
- **Mean routing distribution** từ eval inference pass trên old data (`attention_weights.pkl`) → dùng làm KL distillation target
|
| 34 |
|
| 35 |
+
**Nguyên tắc**: SpecRoute được phép lưu thống kê second-moment từ old tasks (cùng loại với GPM bases), miễn là tổng "cheat budget" không vượt quá root. Cụ thể, SpecRoute **không** cần eval inference pass trên old data, không cần frozen MLP copies, không cần KL distillation targets — tiết kiệm hơn root ở ba mục này, đổi lại lưu thêm projected covariance $\tilde{C}_s$ per task.
|
| 36 |
|
| 37 |
+
---
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
## 2. Baseline và Vấn đề
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
### 2.1 GainLoRA
|
| 42 |
|
| 43 |
+
GainLoRA (NeurIPS 2025) tiếp cận ba thách thức với ba cơ chế riêng biệt:
|
| 44 |
|
| 45 |
+
**Định tuyến** qua hai thành phần học được:
|
| 46 |
+
- **`trans_input`**: MLP hai tầng ($d_{\text{model}} \to d_{\text{hidden}} \to d_{\text{model}}$, kích hoạt SiLU) biến đổi embedding trung bình của sequence thành query vector $q \in \mathbb{R}^{d}$.
|
| 47 |
+
- **`prompt_key`**: vector tham số $k_t \in \mathbb{R}^{d}$ per task, đóng vai trò routing key. Tại inference, $q$ được tính cosine similarity với tất cả key $\{k_1, \ldots, k_T\}$; kết quả qua sigmoid tạo trọng số gating cho từng adapter.
|
| 48 |
|
| 49 |
+
**Bảo vệ** qua **GPM (Gradient Projection Memory)**: sau mỗi task, thu thập activation covariance, tính SVD, lưu basis $U_t \in \mathbb{R}^{d \times r_t}$. Gradient lên `lora_A` và `trans_input` bị chiếu sang null-space: $\Delta W \leftarrow \Delta W - UU^\top \Delta W$.
|
| 50 |
|
| 51 |
+
**Phân bổ** qua dynamic threshold $\varepsilon_t$ tăng dần, kiểm soát số singular vectors giữ lại trong GPM basis.
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
### 2.2 Mâu thuẫn Cấu trúc
|
| 54 |
|
| 55 |
+
Routing phụ thuộc tham số học được, tạo vòng lặp:
|
| 56 |
|
| 57 |
+
$$\texttt{trans\_input}\ \text{drift} \;\to\; \text{prompt\_key misalign} \;\to\; \text{GPM bảo vệ routing} \;\to\; \text{tốn subspace} \;\to\; \cdots$$
|
|
|
|
| 58 |
|
| 59 |
+
Để ổn định, GainLoRA cần KL distillation: lưu phân phối routing $\{p_s\}$ từ old eval data, minimize $D_{\text{KL}}(p_s^{\text{stored}} \| p_s^{\text{current}})$ — yêu cầu eval inference pass trên old data + lưu routing statistics.
|
| 60 |
|
| 61 |
+
### 2.3 Hai Vấn đề Cốt lõi cần Giải quyết
|
| 62 |
|
| 63 |
+
**Vấn đề 1 — Same-domain Learning Collapse (Routing)**: Khi tasks cùng domain (yelp/amazon/imdb, TF-IDF cosine ~ 0.89), C5 init ($A_t = \text{top eigvecs}(\tilde{C}_t)$) cho ra các eigenvectors gần trùng nhau → routing margin ~ 0 → expert output ~ 0 → learning collapse. Bằng chứng: v10a qqp=11.95, rte=10.11 so với root 76.96, 45.85.
|
|
|
|
| 64 |
|
| 65 |
+
**Vấn đề 2 — Shared Subspace Exclusion (Learning)**: InfLoRA buộc $A_t \in \text{null}(P_{\text{old}})$ nghiêm ngặt. Khi tasks chia sẻ tri thức (same-domain), **optimal learning directions nằm trong old subspace** — chính xác nơi InfLoRA cấm $A_t$ tiếp cận. Kết quả: model bị ép học từ noise directions, mất forward transfer.
|
| 66 |
|
| 67 |
+
> **Mấu chốt**: Vấn đề 1 liên quan đến *phân biệt giữa các tasks* (routing), Vấn đề 2 liên quan đến *chia sẻ tri thức giữa các tasks* (learning). Hai vấn đề yêu cầu hai giải pháp bổ trợ nhau.
|
| 68 |
|
| 69 |
---
|
| 70 |
|
| 71 |
+
## 3. Ý tưởng
|
| 72 |
|
| 73 |
+
### 3.1 Duality Định tuyến–Bảo vệ
|
| 74 |
|
| 75 |
+
GPM đảm bảo các adapter chiếm subspace gần trực giao trong không gian input. Sự trực giao này đồng thời tạo tín hiệu routing tự nhiên: input $h_t$ đặc trưng cho task $t$ có alignment cao với $\text{span}(V_t)$ và gần bằng không với $\text{span}(V_s)$ ($s \neq t$). Do alignment = routing, không cần tham số học.
|
| 76 |
|
| 77 |
+
> **Duality**: Chống catastrophic forgetting và nhận diện task xuất phát từ cùng một cấu trúc trực giao subspace.
|
| 78 |
|
| 79 |
+
### 3.2 GPM–Routing Paradox
|
| 80 |
|
| 81 |
+
InfLoRA khởi tạo $A_t$ ngẫu nhiên trước khi chiếu vào null-space. Ma trận ngẫu nhiên không mang thông tin task → affinity score xấp xỉ nhau → routing gần ngẫu nhiên. GPM đảm bảo trực giao (điều kiện cần), nhưng khởi tạo ngẫu nhiên triệt tiêu tín hiệu routing (điều kiện đủ bị vi phạm).
|
|
|
|
| 82 |
|
| 83 |
+
### 3.3 Giải pháp Vấn đề 1: Contrastive Projected Initialization (CPI)
|
| 84 |
|
| 85 |
+
**Phiên bản C5 cũ** (v2–v10a, thất bại): $A_t = \text{top-}r\text{ eigvecs}(\tilde{C}_t)$ với $\tilde{C}_t = Q_{t-1}C_tQ_{t-1}$.
|
| 86 |
|
| 87 |
+
**Vấn đề**: Với same-domain tasks, $\tilde{C}_{\text{amazon}} \approx \tilde{C}_{\text{yelp}}$ → top eigenvectors gần trùng → routing margin $\approx 0$ → **learning collapse**.
|
| 88 |
|
| 89 |
+
**CPI thay đổi objective**: thay vì tìm hướng variance lớn nhất, tìm **hướng phân biệt nhất** so với old tasks:
|
| 90 |
|
| 91 |
+
$$\boxed{A_t^{\text{CPI}} = \arg\max_{A \in \mathcal{A}_t} \; \text{tr}\!\left(A\,\bigl(\tilde{C}_t - \gamma\,\bar{C}_{<t}\bigr)\,A^\top\right)}$$
|
| 92 |
|
| 93 |
+
**Phiên bản gốc (unweighted)**: $\bar{C}_{<t} = \frac{1}{t-1}\sum_{s<t} \tilde{C}_s$ — trung bình đồng đều tất cả task cũ.
|
| 94 |
|
| 95 |
+
**Phiên bản nâng cấp (Weighted CPI)**: gán trọng số theo *domain proximity* — task cũ càng giống task hiện tại thì càng cần bị trừ mạnh hơn:
|
| 96 |
|
| 97 |
+
$$\boxed{\bar{C}_{<t}^{\,\mathrm{w}} = \frac{\sum_{s<t} \rho_{s,t}\,\tilde{C}_s}{\sum_{s<t} \rho_{s,t} + \varepsilon}, \qquad \rho_{s,t} = \frac{\text{tr}(\tilde{C}_s \cdot C_t)}{\text{tr}(\tilde{C}_s)\,\text{tr}(C_t)}}$$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
+
Trọng số $\rho_{s,t}$ đo mức độ alignment giữa second-moment của task cũ $s$ và task mới $t$. Khi task $s$ cross-domain với task $t$: $\rho_{s,t} \approx 0$ → đóng góp nhỏ (GPM đảm bảo cross-domain covariances gần trực giao). Khi $s$ same-domain với $t$: $\rho_{s,t}$ lớn → bị trừ mạnh, đúng với mục tiêu discriminative. Điều này chặt chẽ hơn unweighted mean vì các task cross-domain không "pha loãng" tín hiệu contrastive cho same-domain pairs.
|
| 100 |
|
| 101 |
+
*Lưu ý*: Nhờ tính trực giao subspace của GPM, với cross-domain tasks ta tự nhiên có $\text{tr}(\tilde{C}_s \cdot C_t) \approx 0$ → flat unweighted mean cũng ít bias. Tuy nhiên weighted CPI đúng hơn về mặt nguyên lý và đặc biệt có lợi khi có nhiều task cross-domain nhưng chỉ ít task same-domain.
|
| 102 |
|
| 103 |
+
**Lời giải**: top-$r$ eigenvectors của discriminant matrix $D_t = \tilde{C}_t - \gamma\bar{C}_{<t}^{\,\mathrm{w}}$.
|
| 104 |
|
| 105 |
+
**Tại sao CPI sửa learning collapse**: $D_{\text{amazon}} = \tilde{C}_{\text{amazon}} - \gamma\tilde{C}_{\text{yelp}}$ trừ đi shared variance → eigenvectors còn lại discriminative → routing signal > 0.
|
| 106 |
|
| 107 |
+
**Hướng dẫn chọn $\gamma$**: Khi $\gamma$ quá cao ($\to 1$), phần lớn eigenvalues trở nên âm → fallback Kaiming. Trong thực tế, $\gamma$ nên được chọn sao cho tỉ lệ eigenvalues dương đủ lớn (≥ $r$). Quy tắc heuristic: $\gamma^* \approx 1 - \frac{r}{\text{rank}(\tilde{C}_t)}$. Đối với flan-t5-small ($d=512$, $r=8$), $\gamma \in [0.3, 0.7]$ là vùng ổn định. Ngoài ra, code đã tích hợp cơ chế **adaptive fallback**: nếu số eigenvectors dương < $r$, phần thiếu được bù bằng random vectors trong null-space (Kaiming-scale), đảm bảo không bao giờ thất bại hoàn toàn.
|
| 108 |
|
| 109 |
+
### 3.4 Giải pháp Vấn đề 2: Overlap-Aware Projection (OAP)
|
| 110 |
|
| 111 |
+
**Vấn đề cốt lõi**: InfLoRA dùng hard null-space projection $A_t \leftarrow A_t(I - P_{\text{old}})$, loại bỏ **toàn bộ** thành phần của $A_t$ trong old subspace. Khi tasks chia sẻ optimal subspace, điều này phá hủy chính xác các hướng học hữu ích nhất.
|
| 112 |
|
| 113 |
+
**Quantification — Shared Subspace Exclusion (SSE):**
|
| 114 |
|
| 115 |
+
$$\text{SSE}_t = \frac{\text{tr}(P_{\text{old}} \cdot C_t)}{\text{tr}(C_t)} \in [0,1]$$
|
| 116 |
|
| 117 |
+
$\text{SSE}_t$ đo phần variance của task $t$ nằm trong old subspace — bị InfLoRA loại bỏ. Với same-domain tasks (EDA: TF-IDF similarity yelp↔amazon = 0.898), SSE có thể đạt 0.7–0.9, nghĩa là **70–90% tín hiệu học hữu ích bị vứt bỏ**.
|
| 118 |
|
| 119 |
+
**Cơ sở lý thuyết cho relaxation:**
|
| 120 |
|
| 121 |
+
1. **TRGP (Lin et al., ICLR 2022)** chỉ ra rằng strict null-space projection cản trở forward transfer khi tasks tương quan mạnh; đề xuất "trust region" cho phép tái sử dụng knowledge từ old tasks liên quan qua scaled weight projection.
|
| 122 |
|
| 123 |
+
2. **Shared-Private Subspace Decomposition** (multi-task learning classic): Argyriou et al. (2008) chứng minh rằng decompose representation thành shared + private components tối ưu hóa transfer trong multi-task setting.
|
| 124 |
|
| 125 |
+
3. **Principal Angles trên Grassmannian**: khoảng cách geodesic giữa subspaces $\mathcal{V}_t$ và $\mathcal{V}_s$ trên Grassmann manifold $\text{Gr}(r,d)$ quyết định mức overlap. InfLoRA ép $d_G = \pi r/2$ (maximal distance) — quá mạnh cho same-domain tasks.
|
| 126 |
|
| 127 |
+
4. **Information Bottleneck perspective**: InfLoRA tối thiểu hóa $I(\hat{X}_t; X_s) = 0$ (elimination hoàn to��n). Tối ưu thực sự nên là maximize $I(\hat{X}_t; Y_t)$ subject to $I(\hat{X}_t; X_s | Y_s) \leq \eta$ — cho phép sharing miễn không harm old task performance.
|
| 128 |
|
| 129 |
+
**Insight then chốt**: SpecRoute dùng **hard Top-1 routing** tại inference. Khi routing chính xác ($w_{t^*} = 1$, $w_{t \neq t^*} = 0$), chỉ MỘT adapter fire per input → overlap subspace KHÔNG gây forgetting. Forgetting chỉ xảy ra khi routing sai. Do đó, mức forgetting bị gate bởi routing error probability $p_e$, KHÔNG phải bởi subspace overlap.
|
| 130 |
|
| 131 |
+
**So sánh với TRGP (§3.4.1)**:
|
| 132 |
|
| 133 |
+
| Yếu tố | TRGP (Lin et al., 2022) | OAP (SpecRoute) |
|
| 134 |
+
|---------|--------------------------|-----------------|
|
| 135 |
+
| **Cách xác định mức relaxation** | Dựa trên task similarity heuristic: chọn old tasks "liên quan" bằng cosine similarity, dùng projected gradient lên subspace của old tasks đã chọn | Tự động per-layer: $\beta_l = \max(\beta_{\min}, 1 - \eta \cdot \rho_l)$ với $\rho_l$ đo trực tiếp overlap ratio từ covariance |
|
| 136 |
+
| **Granularity** | Task-level: cùng mức relaxation cho toàn bộ mô hình | Layer-level: mỗi layer có $\beta_l$ riêng dựa trên overlap cục bộ |
|
| 137 |
+
| **Bối cảnh kiến trúc** | Gradient projection cho toàn bộ tham số (full model) | Tích hợp với LoRA (chỉ $A_t$) + hard Top-1 routing → forgetting bị gate bởi $p_e$ |
|
| 138 |
+
| **Kết hợp với routing** | Không có cơ chế routing riêng | Kết hợp với CPI: routing accuracy cao → $p_e$ thấp → an toàn nới $\beta_l$ |
|
| 139 |
+
| **Cơ sở quyết định** | Similarity giữa task representations | Overlap ratio $\rho_l$ tính trực tiếp từ spectral analysis (Định lý 4, 5) |
|
| 140 |
|
| 141 |
+
Điểm mới cốt lõi: OAP không chỉ là "nới null-space" (TRGP đã làm), mà là **nới null-space có điều kiện an toàn nhờ hard routing** — forgetting bị gate bởi $p_e \times (1-\beta_l)$ (Định lý 4), và CPI đảm bảo $p_e$ thấp (Định lý 3). Sự kết hợp ba thành phần (CPI + OAP + hard routing) tạo ra **lợi thế hệ thống** mà TRGP không có: ở cross-domain regime, ba thành phần reinforcing nhau; ở same-domain regime, $\beta_{\min}$ đảm bảo worst-case có giới hạn.
|
| 142 |
|
| 143 |
+
**Formulation OAP**: Hai bước tích hợp (khác nhau về mục đích, cùng dùng $\beta_l$):
|
| 144 |
|
| 145 |
+
**Bước 1 — OAP trên covariance** (cho CPI init): thay vì $\tilde{C}_t = Q_{t-1}C_tQ_{t-1}$ (InfLoRA, chiếu hoàn toàn ra null-space), dùng relaxed:
|
| 146 |
+
$$\tilde{C}_t^{\text{OAP}} = (I - \beta_l P_{\text{old}})\,C_t\,(I - \beta_l P_{\text{old}})$$
|
| 147 |
+
Eigenvectors của $D_t = \tilde{C}_t^{\text{OAP}} - \gamma\bar{C}^{\mathrm{w}}_{<t}$ tìm hướng discriminative *trong* OAP subspace.
|
| 148 |
|
| 149 |
+
**Bước 2 — OAP projection trên $A_t$** (enforce constraint): sau khi init, áp đặt cùng relaxed projection:
|
| 150 |
+
$$\boxed{A_t \leftarrow A_t(I - \beta_l \cdot P_{\text{old}})}$$
|
| 151 |
|
| 152 |
+
Hai bước này hợp lý với nhau: Bước 1 hướng init về OAP subspace (discriminative), Bước 2 enforce constraint đó. Hiệu ứng tổng hợp: P_old component trong $A_t$ bị scale khoảng $(1-\beta_l)^2$, tức **conservative hơn** một lần projection đơn lẻ. Đây là thiết kế cố ý nhằm đảm bảo an toàn cao hơn.
|
| 153 |
|
| 154 |
+
Trong cả hai bước, $\beta_l$ được tính từ overlap ratio per-layer:
|
| 155 |
|
| 156 |
+
$$\rho_l = \frac{\text{tr}(P_{\text{old}}^{(l)} \cdot C_t^{(l)})}{\text{tr}(C_t^{(l)})}$$
|
| 157 |
|
| 158 |
+
$$\beta_l = \max(\beta_{\min},\; 1 - \eta \cdot \rho_l)$$
|
| 159 |
|
| 160 |
+
- $\eta = 0$: InfLoRA gốc (strict null-space) → không forward transfer
|
| 161 |
+
- $\eta = 1, \rho_l = 1$: $\beta_l = \beta_{\min}$ → maximum sharing
|
| 162 |
+
- Cross-domain ($\rho_l \approx 0$): $\beta_l \approx 1$ → gần strict null-space (auto-adaptive)
|
| 163 |
+
- Same-domain ($\rho_l \approx 0.8$): $\beta_l \approx 1 - 0.8\eta$ → relax đáng kể, giữ shared directions
|
| 164 |
|
| 165 |
+
**Cơ chế bảo vệ khi routing chưa tốt (§3.4.2)**:
|
| 166 |
|
| 167 |
+
Phản biện hợp lý: ở các tasks đầu hoặc khi CPI chưa đủ mạnh, routing accuracy thấp → nới $\beta_l$ có thể tăng forgetting. Các biện pháp bảo vệ:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
+
1. **$\beta_{\min}$**: luôn đảm bảo mức bảo vệ tối thiểu, ngay cả khi $\rho_l$ rất cao.
|
| 170 |
+
2. **Warmup theo task index**: $\eta_{\text{eff}}(t) = \eta \cdot \min(1, (t-1)/T_{\text{warmup}})$. Ở task 2 (chưa có đủ CPI data), $\eta_{\text{eff}} \approx 0$ → gần InfLoRA gốc. Khi $t$ tăng, CPI accumulates nhiều $\tilde{C}_s$ → routing tốt hơn → an toàn nới $\eta_{\text{eff}}$.
|
| 171 |
+
3. **$\beta_{\min}$ cao cho tasks đầu**: Khi $t \leq T_{\text{warmup}}$ (default 3), dùng $\beta_{\min} = 0.7$ (conservative); sau đó giảm về $\beta_{\min} = 0.3$.
|
| 172 |
+
4. **Auto-detection**: $\rho_l \approx 0$ cho cross-domain → $\beta_l \approx 1$ tự động → không cần lo OAP gây hại khi tasks khác domain.
|
| 173 |
|
| 174 |
+
**SSE reduction:** OAP *giữ lại* phần variance trong old subspace thay vì loại bỏ hoàn toàn (InfLoRA):
|
| 175 |
+
$$\text{SSE}_t^{\text{OAP}} \approx (1-\beta_l)^2 \cdot \text{SSE}_t \;\in\; [0,\,\text{SSE}_t]$$
|
| 176 |
+
Khi $\beta_l = 1$ (InfLoRA strict): $(1-1)^2 = 0$ → loại bỏ hoàn toàn. Khi $\beta_l = \beta_{\min}$ (OAP maximum): $(1-\beta_{\min})^2 \cdot \text{SSE}_t > 0$ → giữ lại một phần để học.
|
| 177 |
|
| 178 |
+
### 3.5 Tương tác Tổng thể: CPI + OAP
|
|
|
|
|
|
|
| 179 |
|
| 180 |
+
**CPI** giải Vấn đề 1 — tìm hướng *phân biệt* → routing mạnh.
|
| 181 |
+
**OAP** giải Vấn đề 2 — nới lỏng null-space → *chia sẻ tri thức* → learning mạnh.
|
| 182 |
|
| 183 |
+
Kết hợp: CPI hoạt động trên **relaxed projected covariance**:
|
|
|
|
| 184 |
|
| 185 |
+
$$D_t = Q_{\text{OAP}} \cdot C_t \cdot Q_{\text{OAP}} - \gamma\,\bar{C}_{<t}^{\,\mathrm{w}}$$
|
|
|
|
| 186 |
|
| 187 |
+
trong đó $Q_{\text{OAP}} = I - \beta_l P_{\text{old}}$.
|
|
|
|
| 188 |
|
| 189 |
+
**Tương tác: Controlled Trade-off với Worst-case Có Giới hạn**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
+
CPI và OAP không phải "vòng cung cố lẫn nhau không điều kiện" — đây là một *controlled trade-off* với các điều kiện an toàn được thiết kế rõ ràng:
|
| 192 |
|
| 193 |
+
| Regime | CPI | OAP | Kết quả |
|
| 194 |
+
|--------|-----|-----|---------|
|
| 195 |
+
| **t = 1** (task đầu) | Không có old covs → C5 init (γ bị bỏ qua) | $\eta_{\text{eff}} = 0$ → strict InfLoRA, OAP deactivated | Behavior giống baseline; không có risk |
|
| 196 |
+
| **Cross-domain** (dễ) | Discriminative init tốt, routing margin cao | $\rho_l \approx 0$ → $\beta_l \approx 1$ (strict, tự động) | Routing tốt, forgetting thấp |
|
| 197 |
+
| **Same-domain** (khó) | Margin thấp hơn (cấu trúc); CPI cải thiện đáng kể so với C5 | $\rho_l$ cao → $\beta_l$ giảm, nhưng bị sàn bởi $\beta_{\min}$ | Forward transfer tăng; forgetting bị kiểm soát bởi $p_e \cdot (1-\beta_{\min})$ |
|
| 198 |
|
| 199 |
+
**Điều kiện an toàn quan trọng**: Ở regime same-domain (khó nhất), forgetting không tăng không giới hạn vì:
|
| 200 |
+
1. **$\beta_{\min}$ là bound toán học chứng minh được** (Định lý 4 và §4.7): forgetting $\leq p_e \cdot (1-\beta_{\min}) \cdot M$ bất kể $\rho_l$ lớn bao nhiêu.
|
| 201 |
+
2. **So sánh đúng baseline**: Điểm tham chiếu không phải "không có OAP" mà là InfLoRA gốc (v10a) — vốn đã bị broken hoàn toàn (SSE 70-90%, qqp=11.95, rte=10.11). OAP không cần tốt hơn lý thuyết; chỉ cần tốt hơn baseline đã thất bại này.
|
| 202 |
+
3. **Warmup ($\eta_{\text{eff}}(t)$) là empirical safeguard** (không phải bound lý thuyết): giúp tránh rủi ro thực nghiệm ở tasks đầu khi chưa có đủ CPI history.
|
| 203 |
|
| 204 |
+
*Lưu ý*: Claim "AP gain > forgetting cost" là observation thực nghiệm trên Long Order3/SuperNI benchmarks, không phải bound lý thuyết chứng minh được. Điều kiện đủ lý thuyết chỉ được thiết lập cho forgetting (Định lý 4), không phải cho AP gain tuyệt đối.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
---
|
| 207 |
|
| 208 |
+
# PHẦN II — LÝ THUYẾT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
|
| 210 |
---
|
| 211 |
|
| 212 |
+
## 4. Lý thuyết và Chứng minh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
+
### 4.1 Spectral Signature và Affinity
|
| 215 |
|
| 216 |
+
**Định nghĩa 1** *(Spectral Signature).* Với expert đóng băng $\Delta W_t = B_t A_t$ và thin SVD $\Delta W_t = U_t \Sigma_t V_t^\top$, spectral signature là $\mathcal{S}_t = (V_t, \boldsymbol{\sigma}_t)$:
|
| 217 |
+
- $V_t \in \mathbb{R}^{d \times r}$: input receptive field.
|
| 218 |
+
- $\boldsymbol{\sigma}_t$: sensitivity spectrum.
|
| 219 |
|
| 220 |
+
**Định nghĩa 2** *(Spectral Affinity).*
|
| 221 |
|
| 222 |
+
$$\alpha_t(h) = \frac{\|\Delta W_t h\|^2}{\|\Delta W_t\|_F^2 \|h\|^2} = \frac{\sum_{i=1}^{r}\sigma_{t,i}^2(v_{t,i}^\top h)^2}{(\sum_i \sigma_{t,i}^2)\|h\|^2} \in [0,1]$$
|
| 223 |
|
| 224 |
+
### 4.2 Định lý 1: Routing–Protection Duality
|
| 225 |
|
| 226 |
+
**Định nghĩa 3** *(Subspace Overlap).* $\delta_{ij} = \|V_i^\top V_j\|_F^2$.
|
| 227 |
|
| 228 |
+
**Định lý 1.** Nếu GPM đảm bảo $\delta_{ij} \leq \varepsilon$ $\forall i \neq j$, thì với unit input $h \in \text{span}(V_{t^*})$:
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
+
$$\boxed{\alpha_{t^*}(h) - \max_{t \neq t^*}\alpha_t(h) \geq \kappa_{\min}(t^*) - \varepsilon\kappa_{\max}}$$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
|
| 232 |
+
$\kappa_{\min}(t) = \sigma_{t,\min}^2/\sum_i\sigma_{t,i}^2$.
|
| 233 |
|
| 234 |
+
**Chứng minh.** $h = V_{t^*}c$, $\|c\|=1$ → $\alpha_{t^*}(h) \geq \kappa_{\min}(t^*)$. Với $t \neq t^*$: $\|V_t^\top h\|^2 \leq \delta_{t,t^*} \leq \varepsilon$ → $\alpha_t(h) \leq \kappa_{\max}\varepsilon$. $\square$
|
| 235 |
|
| 236 |
+
**Hệ quả 1** *(Confidence).* $w_{t^*}(h) \geq 1/(1+(T-1)e^{-m/\tau})$, $m = \kappa_{\min}(t^*)-\varepsilon\kappa_{\max}$.
|
|
|
|
|
|
|
| 237 |
|
| 238 |
+
**Hệ quả 2** *(Capacity Bound).* $T_{\max} \leq d/(\bar{k}(1-\varepsilon))$.
|
| 239 |
|
| 240 |
+
### 4.3 Mệnh đề 1: InfLoRA Orthogonality
|
| 241 |
|
| 242 |
+
InfLoRA chiếu $A_t$ vào null-space: $A_t \leftarrow A_t(I-P_{\text{old}})$ → $\text{rowspace}(A_t) \subseteq \text{null}(P_{\text{old}})$. Vì $\text{rowspace}(B_tA_t) \subseteq \text{rowspace}(A_t)$:
|
| 243 |
|
| 244 |
+
$$\text{span}(V_t) \subseteq \text{null}(P_{\text{old}}) \approx \perp\,\text{span}(V_s) \;\forall s < t \;\square$$
|
| 245 |
|
| 246 |
+
### 4.4 Lemma 1: Differential Projection
|
| 247 |
|
| 248 |
+
Với $A_tP_{t-1} = 0$ (InfLoRA), $\forall h$:
|
| 249 |
+
$$\|A_t h\|^2 = \|A_t Q_{t-1}h\|^2, \quad Q_{t-1} = I - P_{t-1}$$
|
| 250 |
|
| 251 |
+
**Hệ quả A**: $E_{h \sim p_s}[\alpha_t(h)] \leq 0.005\,\text{tr}(C_s)/r$ (old data bị reject).
|
| 252 |
|
| 253 |
+
**Hệ quả B**: $\alpha_s(h_t)$ chỉ phụ thuộc $P_{t-1}h_t$.
|
| 254 |
|
| 255 |
+
### 4.5 Định lý 2: CPI Optimality
|
| 256 |
|
| 257 |
+
**Định nghĩa 4** *(Restricted Stiefel Manifold).* $\mathcal{A}_t = \{A \in \mathbb{R}^{r \times d}: AP_{t-1}=0, AA^\top=I_r\}$.
|
|
|
|
|
|
|
| 258 |
|
| 259 |
+
**Định lý 2** *(CPI là Optimal Discriminative Init).* Cho $D_t = \tilde{C}_t - \gamma\bar{C}_{<t}^{\,\mathrm{w}}$ (hoặc unweighted $\bar{C}_{<t}$ — chứng minh tương đương vì chỉ phụ thuộc cấu trúc D_t, không phụ thuộc cách tính C̄):
|
| 260 |
|
| 261 |
+
$$\arg\max_{A_t \in \mathcal{A}_t}\left[E_{h \sim p_t}[\alpha_t(h)] - \gamma\cdot\frac{1}{t-1}\sum_{s<t}E_{h \sim p_s}[\alpha_t(h)]\right] = \text{top-}r\text{ eigvecs của } D_t$$
|
| 262 |
|
| 263 |
+
**Chứng minh.** Từ Lemma 1: $E_{p_t}[\alpha_t(h)] = \text{tr}(A\tilde{C}_tA^\top)/r$. Objective = $\frac{1}{r}\text{tr}(AD_tA^\top)$. Với $AA^\top = I_r$, Constrained PCA trên $D_t$. $\square$
|
| 264 |
|
| 265 |
+
**Kết nối Fisher Discriminant:** Khi $\gamma = 1$: $D_t$ tương tự between-class scatter trong LDA, nhưng chỉ dùng second moments.
|
| 266 |
|
| 267 |
+
### 4.6 Định lý 3: CPI Routing Margin
|
| 268 |
|
| 269 |
+
Cho $\lambda_{\min}^+(D_t) = \min\{\lambda_i(D_t): \lambda_i > 0, i \leq r\}$. Với CPI init:
|
| 270 |
|
| 271 |
+
$$\boxed{E_{p_t}[\alpha_t(h)] - \max_{s<t}E_{p_s}[\alpha_t(h)] \geq \frac{\lambda_{\min}^+(D_t)}{r}}$$
|
| 272 |
|
| 273 |
+
### 4.7 Định lý 4: OAP Forgetting Bound
|
|
|
|
|
|
|
|
|
|
| 274 |
|
| 275 |
+
**Định lý 4** *(Routing-Gated Forgetting).* Với hard Top-1 routing (SpecRoute inference), relaxed projection $\beta_l < 1$, và routing error probability $p_e(s) = P(\text{route sai adapter} \mid h \sim p_s)$:
|
| 276 |
|
| 277 |
+
$$\boxed{\text{FT}(s) \leq p_e(s) \cdot (1-\beta_l) \cdot \frac{\|B_t\|_F \cdot \sqrt{\text{tr}(C_s)}}{\text{output scale}}}$$
|
|
|
|
| 278 |
|
| 279 |
+
**Chứng minh chi tiết.**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
|
| 281 |
+
*Thiết lập.* Xét input $h_s \sim p_s$ (old task $s$). Tại inference, SpecRoute dùng hard Top-1:
|
| 282 |
+
$$w_k(h_s) = \begin{cases} 1 & \text{nếu } k = \arg\max_j \alpha_j^{\text{cal}}(h_s) \\ 0 & \text{otherwise} \end{cases}$$
|
| 283 |
|
| 284 |
+
*Bước 1: Phân chia trường hợp.*
|
| 285 |
+
- **Routing đúng** ($w_s = 1$): Output = $W_0 h_s + B_s A_s h_s$. Adapter $t$ ($t \neq s$) **không đóng góp** → forgetting = 0, bất kể $A_t$ có overlap với old subspace hay không.
|
| 286 |
+
- **Routing sai** ($w_t = 1$, $t \neq s$): Output = $W_0 h_s + B_t A_t h_s$. Sai lệch so với correct output: $\Delta y = B_t A_t h_s - B_s A_s h_s$.
|
| 287 |
|
| 288 |
+
*Bước 2: Bound sai lệch khi routing sai.*
|
| 289 |
|
| 290 |
+
$$\|\Delta y\| \leq \|B_t A_t h_s\| + \|B_s A_s h_s\| \leq \|B_t\|_F \|A_t h_s\| + \|B_s\|_F \|A_s h_s\|$$
|
| 291 |
|
| 292 |
+
Với OAP, $A_t$ có thành phần trong old subspace tỉ lệ $(1-\beta_l)$:
|
| 293 |
+
$$\|A_t h_s\|^2 \leq (1-\beta_l)^2 \|P_{\text{old}} h_s\|^2 + \|Q h_s\|^2$$
|
| 294 |
|
| 295 |
+
Lấy kỳ vọng: $E[\|A_t h_s\|^2] \leq (1-\beta_l)^2 \text{tr}(P_{\text{old}} C_s)/r + \text{tr}(Q C_s Q)/r$. Thành phần thứ hai nhỏ (old data nằm chủ yếu trong old subspace). Thành phần thứ nhất bị scale bởi $(1-\beta_l)$.
|
| 296 |
|
| 297 |
+
*Bước 3: Tổng hợp.*
|
| 298 |
+
$$\text{FT}(s) = E_{h_s}[\text{loss sai}] = P(\text{routing sai}) \cdot E[\text{loss} \mid \text{routing sai}]$$
|
| 299 |
+
$$\leq p_e(s) \cdot \|B_t\|_F \cdot (1-\beta_l) \cdot \sqrt{\text{tr}(P_{\text{old}} C_s)} / \text{output scale}$$
|
| 300 |
|
| 301 |
+
*Giả định:* $(i)$ Hard Top-1 routing (không soft mixing). $(ii)$ $p_e(s)$ và $\|B_t\|_F$ gần như độc lập — hợp lệ vì $p_e$ phụ thuộc vào khởi tạo $A_t$ (CPI), trong khi $\|B_t\|_F$ phụ thuộc vào quá trình training của $B_t$. $(iii)$ Bỏ qua thành phần null-space (nhỏ cho old data). $\square$
|
| 302 |
|
| 303 |
+
**Thảo luận về giả định**: Giả định $(ii)$ — sự độc lập giữa $p_e$ và $\|B_t\|_F$ — là xấp xỉ. Trong thực tế, khi OAP nới relaxation mạnh, $B_t$ có thể học được biểu diễn mạnh hơn ($\|B_t\|_F$ tăng), đồng thời CPI cải thiện routing ($p_e$ giảm). Hai hiệu ứng đối ngược nhau, khiến tích $p_e \cdot \|B_t\|_F$ ít thay đổi. Bound vẫn hữu ích theo nghĩa *order-of-magnitude*: forgetting ∝ $p_e \times (1-\beta_l)$, tức là bị *gate* đồng thời bởi routing accuracy và mức relaxation.
|
| 304 |
|
| 305 |
+
**Hệ quả** *(Điều kiện đủ Zero-Forgetting).* Nếu CPI đảm bảo $p_e(s) \leq \delta$ cho mọi $s$, thì forgetting $\leq \delta \cdot (1-\beta_{\min}) \cdot M$ — nhỏ tùy ý khi routing accuracy cao.
|
| 306 |
|
| 307 |
+
**Phân biệt quan trọng giữa $\beta_{\min}$ và warmup:**
|
| 308 |
|
| 309 |
+
- **$\beta_{\min}$ — giới hạn chứng minh được (hard provable floor)**: Từ Định lý 4, $\text{FT}(s) \leq p_e(s) \cdot (1-\beta_{\min}) \cdot M$ là một *bound toán học chặt chẽ* — đúng với mọi trường hợp, bất kể task index hay routing history. Đây không phải heuristic. Việc đặt $\beta_{\min} = 0.3$ có nghĩa là forgetting bị sàn tại $0.7 \cdot p_e \cdot M$, bất kể overlap $\rho_l$ lớn đến đâu.
|
| 310 |
|
| 311 |
+
- **Warmup ($\eta_{\text{eff}}(t) = \eta \cdot \min(1, (t-1)/T_{\text{warmup}})$) — biện pháp thực nghiệm (empirical safeguard)**: Warmup *không có* lý thuyết chứng minh tại sao cụ thể $T_{\text{warmup}}$ tasks. Lý do sử dụng: ở tasks đầu, CPI chưa tích lũy đủ $\tilde{C}_s$ cũ → tín hiệu contrastive yếu → routing margin thấp hơn → $p_e$ cao hơn → trong công thức forgetting, nên dùng relaxation thấp hơn. Warmup hiện thực hóa điều này theo đường tuyến tính. Tuy nhiên, **ngay cả khi loại bỏ warmup hoàn toàn, $\beta_{\min}$ vẫn đảm bảo bound forgetting**. Warmup chỉ thêm thực nghiệm safety net, không phải thay thế $\beta_{\min}$.
|
| 312 |
|
| 313 |
+
### 4.8 Định lý 5: OAP Learning Gain
|
| 314 |
|
| 315 |
+
**Định lý 5** *(SSE Reduction → AP Gain).* Với OAP ($\beta_l < 1$):
|
| 316 |
|
| 317 |
+
$$E_{h \sim p_t}[\|A_t h\|^2] \geq \underbrace{(1-\beta_l)^2 \cdot \text{tr}(P_{\text{old}} C_t A_t^T A_t)}_{\text{shared variance (phục hồi bởi OAP)}} + \underbrace{\text{tr}(Q C_t Q A_t^T A_t)}_{\text{null-space variance (CPI)}}$$
|
| 318 |
|
| 319 |
+
So với InfLoRA strict ($\beta_l = 1$): chỉ có thành phần thứ hai. OAP bổ sung shared variance → **trực tiếp tăng expected activation energy** → $B_t$ nhận gradient signal mạnh hơn → learning tốt hơn → AP cao hơn.
|
| 320 |
|
| 321 |
+
**Grassmannian interpretation**: InfLoRA constrains $A_t \in \text{Gr}(r, \text{null}(P_{\text{old}}))$. OAP mở rộng search space thành $\text{Gr}(r, \mathbb{R}^d)$ with soft penalty → optimal directions (bao gồm shared) trở nên accessible.
|
| 322 |
|
| 323 |
+
### 4.9 Two-Phase Routing
|
| 324 |
|
| 325 |
+
| Phase | Cơ chế | Lý do |
|
| 326 |
+
|-------|--------|-------|
|
| 327 |
+
| **Training** | Oracle: weight=1.0 cho current task | Task ID khả dụng |
|
| 328 |
+
| **Inference** | Hard Top-1 calibrated A-row argmax | Task ID không có |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
|
| 330 |
+
**Calibration**: $\alpha_t^{\text{cal}}(h) = \alpha_t(h)/\hat\mu_t$, $\hat\mu_t = \text{EMA}[\|A_th\|^2/(r\|h\|^2)]$.
|
| 331 |
|
| 332 |
+
**Mệnh đề 2** *(Drift-Free)*: $h$ từ frozen `embed_tokens`, $A_t$ đóng băng → $\alpha_t(h)$ bất biến.
|
| 333 |
|
| 334 |
+
---
|
| 335 |
|
| 336 |
+
## 5. Các Đóng góp
|
| 337 |
|
| 338 |
+
### Đóng góp 1: Khung Định tuyến Phổ Phi tham số (C1 + C2 + C3)
|
|
|
|
|
|
|
| 339 |
|
| 340 |
+
Routing hoàn toàn phi tham số từ duality bảo vệ–định tuyến:
|
| 341 |
+
- Routing margin ≥ κ_min(t*) − ε·κ_max (Định lý 1)
|
| 342 |
+
- Routing drift = 0 theo cấu trúc (Mệnh đề 2)
|
| 343 |
|
| 344 |
+
**C1** — Spectral Signatures: $A_t$ trực tiếp là routing key.
|
| 345 |
+
**C2** — Calibrated A-row Routing: hard Top-1 + EMA calibration.
|
| 346 |
+
**C3** — Dynamic ESA Threshold.
|
| 347 |
|
| 348 |
+
### Đóng góp 2: Contrastive Projected Initialization (CPI)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 349 |
|
| 350 |
+
Giải Vấn đề 1 — Same-domain Learning Collapse:
|
| 351 |
|
| 352 |
+
$$A_t = \text{top-}r\text{ eigvecs}\bigl((I-\beta_l P_{\text{old}})\,C_t\,(I-\beta_l P_{\text{old}}) - \gamma\bar{C}_{<t}^{\,\mathrm{w}}\bigr)$$
|
|
|
|
|
|
|
|
|
|
| 353 |
|
| 354 |
+
- Optimal discriminative init (Định lý 2), routing margin ≥ λ_min+(D_t)/r (Định lý 3)
|
| 355 |
+
- γ=0: fallback = C5; γ>0: contrastive
|
| 356 |
+
- Hướng dẫn chọn γ: §3.3 (heuristic + adaptive fallback khi eigenvalues âm quá nhiều)
|
| 357 |
+
- Storage: $\tilde{C}_s$ per task per layer (second-moment, cùng loại GPM)
|
| 358 |
|
| 359 |
+
### Đóng góp 3: Overlap-Aware Projection (OAP)
|
| 360 |
|
| 361 |
+
Giải Vấn đề 2 — Shared Subspace Exclusion:
|
| 362 |
|
| 363 |
+
$$A_t \leftarrow A_t(I - \beta_l \cdot P_{\text{old}}), \quad \beta_l = \max(\beta_{\min},\; 1 - \eta \cdot \rho_l)$$
|
| 364 |
|
| 365 |
+
- Adaptive per-layer: high overlap → relax, low overlap → strict (auto-detect)
|
| 366 |
+
- Forgetting bounded by $p_e \cdot (1-\beta_l) \cdot M$ (Định lý 4) — gated bởi routing accuracy
|
| 367 |
+
- AP gain tỉ lệ với recovered shared variance (Định lý 5)
|
| 368 |
+
- η=0: InfLoRA gốc; η>0: OAP
|
| 369 |
+
- Bảo vệ khi routing chưa tốt: warmup η theo task index + β_min cao ở tasks đầu (§3.4.2)
|
| 370 |
+
- Khác biệt với TRGP: automatic per-layer β_l + tích hợp CPI + hard routing gate (§3.4.1)
|
| 371 |
|
| 372 |
+
**C4** — Gradient Preconditioning: preconditioner $(AA^\top+\epsilon I)^{-1/2}$.
|
| 373 |
|
| 374 |
+
---
|
| 375 |
|
| 376 |
+
## 6. Kiến trúc và Thay đổi
|
| 377 |
+
|
| 378 |
+
### 6.1 So sánh với GainLoRA
|
| 379 |
+
|
| 380 |
+
| Thành phần | GainLoRA | SpecRoute | Thay đổi |
|
| 381 |
+
|------------|----------|-----------|----------|
|
| 382 |
+
| trans_input MLP | Learned routing | Loại bỏ | Duality |
|
| 383 |
+
| prompt_key | Learned per-task | Loại bỏ | A_t = signature |
|
| 384 |
+
| previous_trans_input | Frozen copies | Loại bỏ | Drift-free |
|
| 385 |
+
| KL distillation | Replay routing loss | Loại bỏ | Không learned routing |
|
| 386 |
+
| Null-space projection | Hard (β=1) | **Relaxed (β_l adaptive)** | OAP |
|
| 387 |
+
| — | — | **CPI init** | Discriminative subspace |
|
| 388 |
+
| — | — | **OAP projection** | Shared knowledge transfer |
|
| 389 |
+
| — | — | **C4 precond** | Null-space gradient fix |
|
| 390 |
+
| — | — | **Stored $\tilde{C}_s$** | Cross-task contrastive |
|
| 391 |
+
|
| 392 |
+
### 6.2 Pipeline
|
| 393 |
+
|
| 394 |
+
**Task 1:**
|
| 395 |
+
1. Load model + fresh LoRA (Kaiming/zeros)
|
| 396 |
+
2. Train lora_B
|
| 397 |
+
3. GPM update → lưu reg_{i}.pt
|
| 398 |
+
4. Lưu $\tilde{C}_1$ → cov_{i}.pt
|
| 399 |
+
|
| 400 |
+
**Task t ≥ 2:**
|
| 401 |
+
1. Load model + frozen LoRA cũ
|
| 402 |
+
2. **[CPI+OAP]** Pre-task forward (100 batches):
|
| 403 |
+
- Thu thập $C_t$
|
| 404 |
+
- Load $\tilde{C}_1, ..., \tilde{C}_{t-1}$ → tính $\bar{C}_{\text{old}}$
|
| 405 |
+
- Tính $\rho_l = \text{tr}(P_{\text{old}} \cdot C_t)/\text{tr}(C_t)$ per layer
|
| 406 |
+
- $\beta_l = \max(\beta_{\min}, 1 - \eta_{\text{eff}}(t) \cdot \rho_l)$
|
| 407 |
+
- $Q_{\text{OAP}} = I - \beta_l P_{\text{old}}$
|
| 408 |
+
- $\tilde{C}_t^{\text{OAP}} = Q_{\text{OAP}} C_t Q_{\text{OAP}}$
|
| 409 |
+
- $D_t = \tilde{C}_t^{\text{OAP}} - \gamma \bar{C}_{\text{old}}$
|
| 410 |
+
- $A_t \leftarrow$ top-r eigvecs của $D_t$ (eigvals > 0; fallback Kaiming)
|
| 411 |
+
- **OAP projection**: $A_t \leftarrow A_t(I - \beta_l P_{\text{old}})$ (relaxed)
|
| 412 |
+
3. [C4] Precompute preconditioner
|
| 413 |
+
4. Train lora_B + oracle routing + EMA calibration
|
| 414 |
+
5. GPM update → lưu reg_{i}.pt
|
| 415 |
+
6. Lưu $\tilde{C}_t$ → cov_{i}.pt
|
| 416 |
+
|
| 417 |
+
### 6.3 Ánh xạ → Code
|
| 418 |
+
|
| 419 |
+
| Lý thuyết | Code | File |
|
| 420 |
+
|-----------|------|------|
|
| 421 |
+
| CPI: $D_t$ | `get_reg_matrix()` | cl_trainer_specroute.py |
|
| 422 |
+
| OAP: $\beta_l = 1 - \eta \rho_l$ | `get_reg_matrix()` | cl_trainer_specroute.py |
|
| 423 |
+
| $\rho_l = \text{tr}(PC_t)/\text{tr}(C_t)$ | `get_reg_matrix()` | cl_trainer_specroute.py |
|
| 424 |
+
| Stored $\tilde{C}_s$ | cov_{i}.pt saved/loaded | cl_trainer_specroute.py |
|
| 425 |
+
| γ, η, β_min | CLI args | run_t5.py |
|
| 426 |
+
| A-row routing | `compute_spectral_routing()` | t5_specroute.py |
|
| 427 |
|
| 428 |
+
---
|
| 429 |
|
| 430 |
+
## 7. Thiết lập Thực nghiệm
|
| 431 |
|
| 432 |
+
| Hạng mục | Giá trị |
|
| 433 |
+
|----------|---------|
|
| 434 |
+
| **Mô hình** | flan-t5-small (60M), flan-t5-large (783M) |
|
| 435 |
+
| **Benchmarks** | SuperNI (15 tasks, 4 orders), Long Sequence (15 tasks, 2 orders) |
|
| 436 |
+
| **Metrics** | AP (↑), FT (↓) |
|
| 437 |
+
| **LoRA** | r=8, Q+V projections |
|
| 438 |
+
| **Routing** | Train: oracle; Inference: hard Top-1 calibrated A-row |
|
| 439 |
+
| **CPI** | γ=0.5 (default), N_batch=100 |
|
| 440 |
+
| **OAP** | η=0.5 (default), β_min=0.3) |
|
| 441 |
+
| **C4** | use_preconditioning True, ε=1e-6 |
|
| 442 |
+
| **ESA** | ε₀=0.995 (dynamic) |
|
| 443 |
+
| **GPM repr.** | 200 batches |
|
| 444 |
+
| **Baselines** | GainLoRA (ROOT), InfLoRA, O-LoRA |
|
| 445 |
+
|
| 446 |
+
### 7.1 Ablation: Sweep (γ, η) grid
|
| 447 |
+
|
| 448 |
+
| Cấu hình | γ | η | Ý nghĩa | Kỳ vọng |
|
| 449 |
+
|-----------|---|---|---------|---------|
|
| 450 |
+
| C5 gốc (v10a) | 0 | 0 | Không contrastive, strict null-space | AP thấp (baseline) |
|
| 451 |
+
| CPI only | 0.5 | 0 | Discriminative init, strict null-space | AP tăng nhờ routing tốt hơn |
|
| 452 |
+
| OAP only | 0 | 0.5 | C5 init, relaxed null-space | AP tăng nhờ shared knowledge |
|
| 453 |
+
| CPI+OAP (full) | 0.5 | 0.5 | Discriminative + shared | AP cao nhất (kỳ vọng) |
|
| 454 |
+
| CPI strong | 0.7 | 0.5 | Contrastive mạnh + sharing | Kiểm tra γ cao có gây vấn đề không |
|
| 455 |
+
| OAP strong | 0.5 | 0.8 | Sharing mạnh + discriminative | Kiểm tra η cao có gây forgetting không |
|
| 456 |
+
|
| 457 |
+
### 7.2 Đo lường bổ sung
|
| 458 |
+
|
| 459 |
+
- **SSE trước/sau OAP**: Đo $\text{SSE}_t$ và $\text{SSE}_t^{\text{OAP}}$ per layer per task → xác nhận OAP giảm SSE.
|
| 460 |
+
- **Routing accuracy per task**: Đo $p_e(s)$ tại inference → xác nhận CPI cải thiện routing.
|
| 461 |
+
- **$\rho_l$ distribution**: Histogram $\rho_l$ across layers → kiểm tra OAP auto-adapts đúng (cross-domain thấp, same-domain cao).
|
| 462 |
+
- **Eigenvalue spectrum $D_t$**: Số eigenvectors dương vs âm → kiểm tra γ có gây quá nhiều negative không.
|
| 463 |
|
| 464 |
---
|
| 465 |
|
| 466 |
+
## 8. Giới hạn đã biết và Phản biện
|
| 467 |
|
| 468 |
+
### 8.1 Định lý 4 (Forgetting bound) phụ thuộc giả định
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 469 |
|
| 470 |
+
Chứng minh Định lý 4 dựa trên giả định xấp xỉ: $(i)$ hard Top-1 routing, $(ii)$ $p_e$ và $\|B_t\|_F$ gần độc lập. Giả định $(i)$ chính xác theo thiết kế. Giả định $(ii)$ là xấp xỉ — trong thực tế, $p_e$ (phụ thuộc CPI/A_t init) và $\|B_t\|_F$ (phụ thuộc training dynamics) có thể tương quan gián tiếp. Tuy nhiên, bound vẫn hữu ích theo nghĩa *qualitative*: forgetting ∝ $p_e \times (1-\beta_l)$, cho thấy **hai đòn bẩy kiểm soát** (routing accuracy + relaxation level). Chứng minh chi tiết hơn (không chỉ sketch) được trình bày tại §4.7.
|
| 471 |
|
| 472 |
+
**Về $\beta_{\min}$**: Đây là một **hard provable floor** trong Định lý 4 — $\text{FT}(s) \leq p_e \cdot (1-\beta_{\min}) \cdot M$ là bound toán học, không phải heuristic. Reviewer conceded điểm này (xem phản biện trong §8.3).
|
| 473 |
|
| 474 |
+
**Về warmup**: Warmup là **empirical safeguard** — không có lý thuyết chứng minh cụ thể tại sao $T_{\text{warmup}}$ tasks. Nó hỗ trợ thực nghiệm nhưng không cần thiết về mặt lý thuyết (vì $\beta_{\min}$ đã là bound cứng).
|
| 475 |
|
| 476 |
+
**Hướng cải thiện**: Có thể tightening bound bằng cách bound $\|B_t\|_F$ theo training loss (Proposition trong Appendix), hoặc dùng PAC-Bayes framework để có bound xác suất không phụ thuộc giả định độc lập.
|
| 477 |
|
| 478 |
+
### 8.2 CPI với γ cao gây eigenvalues âm
|
| 479 |
|
| 480 |
+
Khi $\gamma \to 1$, $D_t = \tilde{C}_t - \gamma\bar{C}_{<t}^{\,\mathrm{w}}$ có thể có phần lớn eigenvalues âm → số eigenvectors dương < $r$ → phải fallback Kaiming cho phần thiếu. Điều này làm giảm hiệu quả CPI.
|
| 481 |
|
| 482 |
+
**Biện pháp**:
|
| 483 |
+
1. **Adaptive fallback** (đã implement): nếu positive eigenvectors < $r$, phần thiếu được bù bằng random vectors trong null-space. Đảm bảo không bao giờ thất bại hoàn toàn.
|
| 484 |
+
2. **Heuristic chọn γ**: $\gamma^* \approx 1 - r/\text{rank}(\tilde{C}_t)$. Với $d=512$, $r=8$: $\gamma^* \approx 0.98$ (generous), nhưng thực tế nên dùng $\gamma \in [0.3, 0.7]$ vì noise amplification.
|
| 485 |
+
3. **Ablation grid**: Sweep γ ∈ {0, 0.3, 0.5, 0.7} trong experiments (§7.1) để xác định vùng ổn định per benchmark.
|
| 486 |
|
| 487 |
+
**Lưu ý**: Tính tổng quát của CPI không bị ảnh hưởng nghiêm trọng vì (a) fallback luôn đảm bảo hoạt động, (b) vùng $\gamma \in [0.3, 0.7]$ rộng và ổn định cho đa số benchmarks.
|
| 488 |
|
| 489 |
+
### 8.3 OAP tăng forgetting khi routing chưa tốt
|
| 490 |
|
| 491 |
+
Nới $\beta_l$ để học tốt hơn nhưng nếu routing kém (tasks đầu, CPI chưa đủ mạnh) → forgetting tăng theo $p_e \cdot (1-\beta_l)$.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 492 |
|
| 493 |
+
**$\beta_{\min}$ là giới hạn hard, không phải heuristic**: Từ Định lý 4, dù $\rho_l = 1$ (maximum overlap), $\beta_l \geq \beta_{\min}$ luôn được đảm bảo theo thiết kế $\beta_l = \max(\beta_{\min}, \ldots)$. Do đó $\text{FT}(s) \leq p_e \cdot (1-\beta_{\min}) \cdot M$ là bound *chứng minh được* cho mọi task, mọi routing history. Reviewer đã concede điểm này: "β_min IS a provable bound". Đây không phải heuristic về mặt toán học.
|
| 494 |
|
| 495 |
+
**Biện pháp bảo vệ** (đã thiết kế, chi tiết §3.4.2):
|
| 496 |
+
1. $\beta_{\min}$: **Hard provable floor** — luôn giữ mức bảo vệ tối thiểu bất kể điều kiện.
|
| 497 |
+
2. **Warmup η theo task index**: $\eta_{\text{eff}}(t) = \eta \cdot \min(1, (t-1)/T_{\text{warmup}})$. Task 2: $\eta_{\text{eff}} \approx 0$. Task 5+: $\eta_{\text{eff}} = \eta$ (full OAP). Đây là **empirical safeguard** — không có bound lý thuyết, nhưng làm giảm rủi ro thực nghiệm ở tasks đầu.
|
| 498 |
+
3. **$\beta_{\min}$ adaptive**: β_min cao (0.7) cho tasks đầu, giảm dần (0.3) khi routing ổn định.
|
| 499 |
+
4. **Auto-detection**: $\rho_l \approx 0$ cho cross-domain → $\beta_l \approx 1$ → OAP tự deactivate.
|
| 500 |
|
| 501 |
+
Kết hợp 4 biện pháp → OAP chỉ nới khi: $(a)$ đã qua giai đoạn warmup, **VÀ** $(b)$ overlap thực sự cao (same-domain), **VÀ** $(c)$ luôn giữ $\beta_{\min}$ safety net (hard bound).
|
| 502 |
|
| 503 |
+
### 8.4 Số lượng hyperparameters tăng
|
| 504 |
|
| 505 |
+
CPI thêm γ, OAP thêm (η, β_min) → tổng cộng 3 hyperparameters mới so với InfLoRA gốc.
|
| 506 |
|
| 507 |
+
**Đánh giá**: Đây là mức tăng chấp nhận được vì:
|
| 508 |
+
1. **Defaults ổn định**: (γ=0.5, η=0.5, β_min=0.3) dự kiến hoạt động tốt cho đa số benchmarks (kiểm chứng qua ablation).
|
| 509 |
+
2. **Fallback an toàn**: (γ=0, η=0) = InfLoRA gốc → không bao giờ tệ hơn baseline.
|
| 510 |
+
3. **Disentangled**: γ chỉ ảnh hưởng init, η chỉ ảnh hưởng projection → dễ tune independently.
|
| 511 |
+
4. **Grid nhỏ**: 4 cấu hình chính (§7.1) đủ để xác định vùng tốt, không cần exhaustive search.
|
| 512 |
|
| 513 |
+
**Nêu rõ trong paper**: Bảng 7.1 trình bày đầy đủ ablation grid, kèm phân tích sensitivity analysis cho từng hyperparameter.
|
| 514 |
|
| 515 |
+
### 8.5 Tính mới của OAP so với TRGP
|
| 516 |
|
| 517 |
+
OAP chia sẻ ý tưởng "nới null-space cho tasks tương quan" với TRGP. Điều này cần được nêu rõ trong Related Work để tránh bị xem là "re-invent".
|
| 518 |
|
| 519 |
+
**Điểm khác biệt cốt lõi** (chi tiết §3.4.1):
|
| 520 |
+
1. **Per-layer automatic**: TRGP dùng task-level similarity heuristic; OAP dùng $\rho_l$ per-layer per-chunk từ spectral analysis.
|
| 521 |
+
2. **Tích hợp routing gate**: TRGP không có routing → relaxation trực tiếp gây forgetting. OAP + hard Top-1 routing → forgetting bị gate bởi $p_e$ (Định lý 4).
|
| 522 |
+
3. **Kết hợp CPI**: TRGP standalone. OAP + CPI tạo **positive feedback loop ở cross-domain regime**: routing accuracy cao → an toàn nới β_l → shared learning tốt → routing tốt hơn. Ở same-domain regime: β_min bound worst-case (không phải unbounded reinforcement).
|
| 523 |
+
4. **LoRA-specific**: TRGP thiết kế cho full model. OAP chỉ tác động $A_t$ (frozen init) → minimal interference.
|
| 524 |
|
| 525 |
+
**Trình bày trong paper**: Phần Related Work nêu TRGP là tiền thân quan trọng, sau đó so sánh chi tiết bảng §3.4.1 để highlight novelty.
|
| 526 |
|
| 527 |
+
### 8.6 Giới hạn cấu trúc khác
|
| 528 |
|
| 529 |
+
**Capacity saturation.** $T_{\max} \leq d/(\bar{k}(1-\varepsilon))$. OAP giảm nhẹ (expanded search space), nhưng không giải hoàn toàn.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 530 |
|
| 531 |
+
**Same-domain routing vẫn khó hơn cross-domain.** CPI + OAP cải thiện đáng kể, nhưng khi $\tilde{C}_t \approx \bar{C}_{\text{old}}$ thì $D_t$ có eigenvalues nhỏ → routing margin thấp hơn cross-domain. Đây là giới hạn cấu trúc không thể vượt qua chỉ bằng spectral methods.
|
| 532 |
|
| 533 |
+
### 8.7 Hidden assumption: "AP gain từ OAP > forgetting cost" chưa được chứng minh lý thuyết
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 534 |
|
| 535 |
+
**Giả định ẩn**: Framework CPI+OAP ngầm giả định rằng $\Delta\text{AP}(\text{OAP gain}) \geq \text{FT\_cost}(\text{OAP relaxation})$ ở regime same-domain, tức là net AP dương sau khi tính cả forgetting tăng.
|
| 536 |
|
| 537 |
+
**Điều này chưa được chứng minh về mặt toán học.** Định lý 4 chỉ bound forgetting; Định lý 5 bound AP gain; nhưng không có định lý nào so sánh hai lượng này trực tiếp. Chứng minh tổng quát sẽ yêu cầu bound $\|B_t\|_F$ theo task gradient signal, sau đó so sánh scaling của AP gain (tỉ lệ shared variance recovered) và forgetting cost (tỉ lệ $p_e \times (1-\beta_l)$) — phân tích này phụ thuộc mạnh vào distributional assumptions.
|
| 538 |
|
| 539 |
+
**Argument chính thực tế**:
|
| 540 |
+
1. **Baseline so sánh đúng**: InfLoRA gốc (v10a) đã bị broken hoàn toàn trên same-domain (qqp=11.95, rte=10.11 vs root 76.96, 45.85) — SSE 70-90% phá hủy learning. OAP không cần beat lý thuyết; chỉ cần tốt hơn baseline đã thất bại. Đây là comparison point đúng.
|
| 541 |
+
2. **Empirical verification**: Ablation OAP-only (γ=0, η=0.5) trên Long Order3/SuperNI benchmarks sẽ xác nhận (hoặc bác bỏ) giả định net positive. Đây là observation thực nghiệm, không phải lý thuyết.
|
| 542 |
+
3. **Conservative fallback**: η=0 → InfLoRA gốc. Nếu OAP hurt net AP trên bất kỳ benchmark nào, khuyến nghị giữ η nhỏ cho benchmark đó.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 543 |
|
| 544 |
+
**Semi-formal sufficient condition từ Định lý 4 + 5**: Từ hai bounds:
|
| 545 |
+
- Định lý 4: $\text{FT}(s) \leq p_e \cdot (1-\beta_l) \cdot M$
|
| 546 |
+
- Định lý 5: $\Delta E[\|A_t h\|^2] \geq (1-\beta_l)^2 \cdot \text{tr}(P_{\text{old}} C_t A_t^\top A_t)$
|
| 547 |
|
| 548 |
+
Tỉ lệ AP_gain/FT_cost tỉ lệ với $(1-\beta_l) \cdot \text{SSE} \cdot \text{tr}(C_t) / p_e$. **Điều kiện đủ net-positive**:
|
| 549 |
+
$$\text{SSE}_t \cdot (1-\beta_l) > \frac{p_e \cdot c}{\text{tr}(C_t)}$$
|
| 550 |
+
trong đó $c$ là output scale constant. Với same-domain ($\text{SSE} \approx 0.7$-$0.9$) và CPI đảm bảo $p_e$ nhỏ, điều kiện này được thỏa mãn với biên độ lớn — đây là argument *bán hình thức*, không chỉ là empirical observation. Điều còn thiếu là bound tuyệt đối cho $c$ và $p_e$ theo hyperparameters — đây mới là phần thực sự là future work.
|
| 551 |
|
| 552 |
+
**Khuyến nghị paper**: "Định lý 4 và 5 cung cấp điều kiện đủ bán hình thức cho net-positive AP; ablation empirical verify điều kiện này trên mọi benchmark được kiểm tra."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
improve_gainlora/IDEA_Overall.md.bak
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SpecRoute: Định tuyến Phổ Dẫn dắt bởi Dữ liệu trong Học Liên tục với LoRA
|
| 2 |
+
|
| 3 |
+
> **Tài liệu thiết kế chính thức** — Ràng buộc: Zero-replay nghiêm ngặt. Theory-first.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# PHẦN I — TÌM HIỂU BÀI TOÁN
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
## 1. Bài toán và Ràng buộc
|
| 12 |
+
|
| 13 |
+
### 1.1 Bức tranh chung
|
| 14 |
+
|
| 15 |
+
Bài toán học liên tục với mô hình ngôn ngữ lớn (LLM) đặt ra yêu cầu: mô hình phải tiếp thu tuần tự $T$ task không đồng nhất — phân loại cảm xúc, suy luận ngôn ngữ, hỏi đáp — trong điều kiện dữ liệu các task trước không được lưu trữ. Bối cảnh này thuộc lớp bài toán **continual learning (CL)** với ràng buộc **zero-replay** nghiêm ngặt.
|
| 16 |
+
|
| 17 |
+
Paradigm phổ biến hiện nay: với mỗi task $t$, bổ sung một **LoRA adapter** $\Delta W_t = B_t A_t$ vào mô hình nền đóng băng; sau khi huấn luyện xong, đóng băng adapter và khởi tạo adapter mới cho task $t+1$.
|
| 18 |
+
|
| 19 |
+
Sau $T$ task, mô hình sở hữu $T$ adapter song song. Tại thời điểm suy luận (inference), task identity không được cung cấp; mô hình phải tự xác định adapter nào cần kích hoạt:
|
| 20 |
+
|
| 21 |
+
$$y = f\!\Bigl(W_0\, x \;+\; \sum_{t=1}^{T} w_t(x)\; B_t A_t\, x\Bigr)$$
|
| 22 |
+
|
| 23 |
+
Bài toán này có **ba thách thức đan xen**:
|
| 24 |
+
|
| 25 |
+
| Thách thức | Câu hỏi đặt ra |
|
| 26 |
+
|:----------:|--------------|
|
| 27 |
+
| **Routing** | Biết đây là input của task nào để chọn đúng adapter? |
|
| 28 |
+
| **Protection** | Đảm bảo adapter cũ không bị hỏng khi học task mới? |
|
| 29 |
+
| **Allocation** | Quản lý "dung lượng không gian" cho T adapters? |
|
| 30 |
+
|
| 31 |
+
### 1.2 Ràng buộc nghiêm ngặt
|
| 32 |
+
|
| 33 |
+
- **Zero-replay**: Tuyệt đối không dùng lại dữ liệu task cũ — dù là raw data, synthetic data, hay thống kê tóm tắt từ data cũ (mean, prototype).
|
| 34 |
+
- **No task ID at inference**: Mô hình phải tự routing mà không biết task nào đang được hỏi.
|
| 35 |
+
- **InfLoRA constraint**: $A_t$ bị đóng băng sau khi khởi tạo; chỉ $B_t$ được train.
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## 2. Baseline và Vấn đề
|
| 40 |
+
|
| 41 |
+
### 2.1 GainLoRA làm gì?
|
| 42 |
+
|
| 43 |
+
GainLoRA (NeurIPS 2025) tiếp cận ba thách thức với ba cơ chế riêng biệt:
|
| 44 |
+
|
| 45 |
+
**Routing** được thực hiện qua hai thành phần học được:
|
| 46 |
+
- **`trans_input`**: một MLP hai tầng ($d_\text{model} \to d_\text{hidden} \to d_\text{model}$, kích hoạt SiLU) biến đổi embedding trung bình của sequence thành một *query vector* $q \in \mathbb{R}^{d}$.
|
| 47 |
+
- **`prompt_key`**: một vector tham số $k_t \in \mathbb{R}^{d}$ học được per task, đóng vai trò *routing key*. Tại inference, query $q$ được tính cosine similarity với tất cả các key $\{k_1, \ldots, k_T\}$ (key của task hiện tại cộng các key cũ được lưu frozen trong `previous_prompts_keys`); kết quả đi qua sigmoid để tạo trọng số gating cho từng adapter.
|
| 48 |
+
|
| 49 |
+
**Protection** được thực hiện qua **GPM (Gradient Projection Memory)**: sau mỗi task, GPM thu thập ma trận covariance của activation trên các layer Attention, tính SVD, và lưu lại basis $U_t \in \mathbb{R}^{d \times r_t}$ spanning subspace của task $t$. Khi học task mới, mọi cập nhật gradient lên `lora_A` và lên chính `trans_input` đều bị **chiếu sang null-space** của các basis cũ ($\Delta W \leftarrow \Delta W - UU^\top \Delta W$), ngăn việc ghi đè lên kiến thức cũ.
|
| 50 |
+
|
| 51 |
+
**Allocation** được thực hiện qua dynamic threshold: tỉ lệ energy $\varepsilon_t$ tăng dần theo số task, quyết định bao nhiêu singular vectors được giữ lại trong GPM basis — task sau được phép chiếm ít subspace hơn task trước.
|
| 52 |
+
|
| 53 |
+
Tuy nhiên, kiến trúc này chứa đựng một mâu thuẫn nội tại.
|
| 54 |
+
|
| 55 |
+
### 2.2 Mâu thuẫn Cấu trúc
|
| 56 |
+
|
| 57 |
+
Routing của GainLoRA **phụ thuộc vào các tham số học được** (`trans_input` và `prompt_key`), dẫn đến một vòng lặp không thoát được: khi `trans_input` được cập nhật khi học task mới, query space dịch chuyển, làm mất alignment với các `prompt_key` cũ đã đóng băng. Để khắc phục, GPM phải bảo vệ cả `trans_input` — nhưng điều này tiêu thụ subspace vốn dành cho task learning, khiến task mới học kém hơn, lại làm `trans_input` thay đổi nhiều hơn, tạo vòng lặp:
|
| 58 |
+
|
| 59 |
+
$$\underbrace{\texttt{trans\_input}\ \text{drift}}_{\text{task mới}} \;\to\; \underbrace{\text{prompt\_key misalign}}_{\text{routing kém}} \;\to\; \underbrace{\text{GPM bảo vệ routing}}_{\text{tốn subspace}} \;\to\; \underbrace{\text{task kém hơn}}_{\text{lại drift nhiều hơn}} \;\to\; \cdots$$
|
| 60 |
+
|
| 61 |
+
Hơn nữa, để ổn định routing khi `trans_input` thay đổi, GainLoRA dùng **KL distillation**: lưu lại phân phối routing logit $\{p_s\}$ trên dữ liệu task cũ, sau đó minimize $D_\text{KL}(p_s^\text{stored} \| p_s^\text{current})$ — nghĩa là cần lưu trữ và tái sử dụng thông tin thống kê phụ thuộc data cũ, xấp xỉ vi phạm ràng buộc zero-replay.
|
| 62 |
+
|
| 63 |
+
### 2.3 Câu hỏi Nghiên cứu
|
| 64 |
+
|
| 65 |
+
Vòng lặp trên đặt ra câu hỏi căn bản: *liệu routing có thực sự cần được học hay không, hay cơ chế bảo vệ subspace đã ngầm định cung cấp tín hiệu routing mà không cần tham số bổ sung?* Câu hỏi này là xuất phát điểm cho đóng góp chính của SpecRoute.
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
## 3. Ý tưởng (High-Level)
|
| 70 |
+
|
| 71 |
+
### 3.1 Quan sát chính: Bảo vệ và Routing là Hai Mặt của Một Cấu trúc
|
| 72 |
+
|
| 73 |
+
GPM đảm bảo rằng các adapter của các task khác nhau chiếm **subspace gần như trực giao** trong không gian input — đây là cơ chế bảo vệ chống catastrophic forgetting.
|
| 74 |
+
|
| 75 |
+
Tuy nhiên, chính sự trực giao này đồng thời tạo ra một tín hiệu routing tự nhiên: nếu adapter $t$ hoạt động theo subspace $\mathrm{span}(V_t)$ và adapter $s$ theo $\mathrm{span}(V_s)$ với $V_t \perp V_s$, thì một input $h_t$ đặc trưng cho task $t$ sẽ có độ căn chỉnh (alignment) cao với $V_t$ và gần như bằng không với $V_s$. Do đó, đo mức độ căn chỉnh của input với subspace từng adapter là điều kiện đủ để routing — không cần thêm tham số học.
|
| 76 |
+
|
| 77 |
+
> **Duality Định tuyến–Bảo vệ**: Chống catastrophic forgetting và nhận diện task đều xuất phát từ cùng một cấu trúc trực giao subspace; hai mục tiêu này không mâu thuẫn mà bổ trợ lẫn nhau.
|
| 78 |
+
|
| 79 |
+
### 3.2 Nghịch lý của Khởi tạo Ngẫu nhiên
|
| 80 |
+
|
| 81 |
+
Tuy nhiên, tồn tại một nghịch lý: InfLoRA khởi tạo $A_t$ **ngẫu nhiên** trước khi chiếu vào null-space. Ma trận khởi tạo ngẫu nhiên không mang thông tin về phân phối dữ liệu task $t$ — nó chỉ chiếm một hướng tùy tiện trong không gian khả dụng. Hệ quả là affinity score của mọi adapter với một input bất kỳ sẽ xấp xỉ nhau theo kỳ vọng, triệt tiêu tín hiệu routing.
|
| 82 |
+
|
| 83 |
+
Đây là **GPM–Routing Paradox**: GPM đảm bảo trực giao subspace (điều kiện cần cho routing tốt), song khởi tạo ngẫu nhiên phá hủy tín hiệu routing ngay tại bước khởi đầu — trước khi huấn luyện bắt đầu.
|
| 84 |
+
|
| 85 |
+
### 3.3 Giải pháp: Khởi tạo Subspace Dẫn dắt bởi Dữ liệu
|
| 86 |
+
|
| 87 |
+
Nghịch lý trên được giải quyết bằng cách thay thế khởi tạo ngẫu nhiên bằng lời giải của bài toán tối ưu: *hướng nào trong không gian khả dụng (null-space) phù hợp nhất với phân phối dữ liệu task $t$?*
|
| 88 |
+
|
| 89 |
+
Lời giải dạng đóng là **top-$r$ eigenvectors của covariance activation của task $t$ được chiếu lên null-space**: trước khi huấn luyện task $t$, một lượt forward nhỏ trên dữ liệu hiện tại (không cập nhật tham số) được thực hiện để ước lượng covariance $C_t$; $A_t$ sau đó được đặt bằng các eigenvectors chính của $Q_{t-1}C_tQ_{t-1}$.
|
| 90 |
+
|
| 91 |
+
Đây là **C5 — Data-Informed Subspace Initialization**. Về mặt lý thuyết, C5 giải quyết paradox bằng cách đảm bảo $A_t$ mang tín hiệu đặc trưng task $t$ ngay từ bước khởi tạo, đồng thời tối ưu hóa variance captured trong null-space để $B_t$ học hiệu quả hơn.
|
| 92 |
+
|
| 93 |
+
### 3.4 Tương tác giữa Hai Đóng góp
|
| 94 |
+
|
| 95 |
+
Hai đóng góp không độc lập: chúng hình thành một vòng củng cố lẫn nhau. Đóng góp 1 (Duality) thiết lập rằng routing margin tỉ lệ thuận với $\kappa_{\min}(t^*)$, chính là chất lượng phổ của chuyên gia. Đóng góp 2 (C5) tối đa hóa $E[\alpha_t(h)]$ ngay từ khởi tạo, từ đó $B_t$ học được các singular values lớn hơn, $\kappa_{\min}(t^*)$ tăng, và routing margin cải thiện — điều này trực tiếp tăng cường bảo đảm định lượng trong Định lý 1. C5 không chỉ giải paradox mà còn **tăng cường** toàn bộ khung lý thuyết.
|
| 96 |
+
|
| 97 |
+
---
|
| 98 |
+
|
| 99 |
+
# PHẦN II — DETAIL KỸ THUẬT
|
| 100 |
+
|
| 101 |
+
---
|
| 102 |
+
|
| 103 |
+
## 4. Lý thuyết và Chứng minh
|
| 104 |
+
|
| 105 |
+
### 4.1 Spectral Signature và Affinity
|
| 106 |
+
|
| 107 |
+
**Định nghĩa 1** *(Spectral Signature).* Với expert đóng băng $\Delta W_t = B_t A_t$ và thin SVD $\Delta W_t = U_t \Sigma_t V_t^\top$, **spectral signature** là $\mathcal{S}_t = (V_t, \boldsymbol{\sigma}_t)$, trong đó:
|
| 108 |
+
- $V_t \in \mathbb{R}^{d \times r}$: **input receptive field** — $r$ hướng input mà expert xử lý.
|
| 109 |
+
- $\boldsymbol{\sigma}_t$: **sensitivity spectrum** — hệ số khuếch đại theo từng hướng.
|
| 110 |
+
|
| 111 |
+
**Định nghĩa 2** *(Spectral Affinity).* Độ tương hợp của input $h$ với expert $t$:
|
| 112 |
+
|
| 113 |
+
$$\alpha_t(h) = \frac{\sum_{i=1}^{r} \sigma_{t,i}^2\,(v_{t,i}^\top h)^2}{\bigl(\sum_{i=1}^{r} \sigma_{t,i}^2\bigr)\,\|h\|^2} = \frac{\|\Delta W_t\, h\|^2}{\|\Delta W_t\|_F^2\,\|h\|^2} \;\in\; [0,1]$$
|
| 114 |
+
|
| 115 |
+
**Ý nghĩa**: $\alpha_t(h)$ = phần "channel capacity" của expert $t$ được kích hoạt bởi $h$. Nếu $h \in \text{span}(V_t)$ thì $\alpha_t(h) \geq \kappa_{\min}(t) > 0$; nếu $h \perp \text{span}(V_t)$ thì $\alpha_t(h) = 0$ chính xác.
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
### 4.2 Định lý 1: Duality Định tuyến–Bảo vệ
|
| 120 |
+
|
| 121 |
+
**Định nghĩa 3** *(Subspace Overlap).* $\delta_{ij} = \|V_i^\top V_j\|_F^2 = \sum_k \cos^2\theta_{ij}^{(k)}$ với $\theta_{ij}^{(k)}$ là principal angles.
|
| 122 |
+
|
| 123 |
+
**Định lý 1** *(Routing–Protection Duality).* Nếu GPM đảm bảo $\delta_{ij} \leq \varepsilon$ $\forall i \neq j$, thì với unit input $h \in \mathrm{span}(V_{t^*})$:
|
| 124 |
+
|
| 125 |
+
$$\boxed{\alpha_{t^*}(h) - \max_{t \neq t^*} \alpha_t(h) \;\geq\; \underbrace{\kappa_{\min}(t^*)}_{\text{expert quality}} - \underbrace{\varepsilon\,\kappa_{\max}}_{\text{overlap noise}}}$$
|
| 126 |
+
|
| 127 |
+
trong đó $\kappa_{\min}(t) = \sigma_{t,\min}^2 / \sum_i \sigma_{t,i}^2$.
|
| 128 |
+
|
| 129 |
+
**Chứng minh.** *Cận dưới:* Viết $h = V_{t^*}c$, $\|c\|=1$ → $\alpha_{t^*}(h) = \sum_i \sigma_{t^*,i}^2 c_i^2 / \sum_i \sigma_{t^*,i}^2 \geq \kappa_{\min}(t^*)$.
|
| 130 |
+
*Cận trên cho expert sai:* $\|V_t^\top h\|^2 \leq \delta_{t,t^*} \leq \varepsilon$ → $\alpha_t(h) \leq \kappa_{\max}\varepsilon$. $\square$
|
| 131 |
+
|
| 132 |
+
**Hệ quả 1** *(Routing Confidence).* Với softmax nhiệt độ $\tau$:
|
| 133 |
+
$$w_{t^*}(h) \geq \frac{1}{1 + (T-1)e^{-m/\tau}}, \quad m = \kappa_{\min}(t^*) - \varepsilon\kappa_{\max}$$
|
| 134 |
+
|
| 135 |
+
**Hệ quả 2** *(Capacity Bound).* $T_{\max} \leq d / (\bar{k}(1-\varepsilon))$ với $\bar{k}$ là GPM effective rank trung bình per task. Với T5-small ($d=512$) và $\bar{k} \approx 50$: $T_{\max} \approx 10$ ở strict threshold — null-space saturation là rủi ro thực tế, không chỉ lý thuyết.
|
| 136 |
+
|
| 137 |
+
---
|
| 138 |
+
|
| 139 |
+
### 4.3 Mệnh đề: InfLoRA đảm bảo điều kiện Định lý 1
|
| 140 |
+
|
| 141 |
+
Reviewer thường lo ngại: *"GPM chỉ chiếu gradient, không đảm bảo subspace trực giao."* Điều này đúng cho GPM gradient projection, nhưng InfLoRA có cơ chế cứng hơn: **A-projection trực tiếp**.
|
| 142 |
+
|
| 143 |
+
**Mệnh đề 1** *(InfLoRA Orthogonality).* InfLoRA chiếu tất cả hàng của $A_t$ vào null-space của $P_{\text{old}} = \mathcal{B}\mathcal{B}^T$:
|
| 144 |
+
$$A_t \leftarrow A_t(I - P_{\text{old}}) \;\Rightarrow\; \text{rowspace}(A_t) \subseteq \text{null}(P_{\text{old}})$$
|
| 145 |
+
|
| 146 |
+
Vì $\text{rowspace}(B_tA_t) \subseteq \text{rowspace}(A_t)$ (nhân trái không mở rộng rowspace), suy ra:
|
| 147 |
+
$$\text{span}(V_t) \subseteq \text{null}(P_{\text{old}}) \approx \perp \text{span}(V_s) \;\forall s < t \;\square$$
|
| 148 |
+
|
| 149 |
+
**Chất lượng xấp xỉ (Davis–Kahan).** GPM capture xấp xỉ principal directions với sai số bị chặn bởi:
|
| 150 |
+
$$\sin\!\bigl(\Theta(\hat V_s, V_s)\bigr) \leq \|\hat C_s - C_s\|_2 / \delta_{\text{gap}}(C_s)$$
|
| 151 |
+
Margin thực tế bị giảm thêm $O(\|\Delta P\|_F/\delta_{\text{gap}})$ — nhỏ với tasks phân kỳ, lớn hơn với same-domain tasks (giới hạn cơ bản của mọi zero-replay CL).
|
| 152 |
+
|
| 153 |
+
---
|
| 154 |
+
|
| 155 |
+
### 4.4 Lemma 1: Differential Projection
|
| 156 |
+
|
| 157 |
+
**Lemma 1** *(Exact).* Với $A_t P_{t-1} = 0$ (InfLoRA constraint), với mọi $h \in \mathbb{R}^d$:
|
| 158 |
+
$$\|A_t h\|^2 = \|A_t Q_{t-1} h\|^2, \quad Q_{t-1} = I - P_{t-1}$$
|
| 159 |
+
|
| 160 |
+
**Chứng minh.** $A_t h = A_t(P_{t-1}h + Q_{t-1}h) = 0 + A_t Q_{t-1}h$. $\square$
|
| 161 |
+
|
| 162 |
+
**Hệ quả A** *(Current expert → old data bị reject tự nhiên).* Với $h \sim p_s$ ($s < t$), GPM capture ≥99.5% variance của $p_s$ → $\|Q_{t-1}h\|^2 \leq 0.005\,\text{tr}(C_s)$:
|
| 163 |
+
$$E_{h \sim p_s}[\alpha_t(h)] \leq \frac{0.005\,\text{tr}(C_s)}{r}$$
|
| 164 |
+
|
| 165 |
+
**Hệ quả B** *(Old expert → new data bị reject tự nhiên).* Vì $\text{rowspace}(A_s) \subseteq \text{range}(P_{t-1})$ (GPM-captured), suy ra $A_s Q_{t-1} = 0$, tức $\alpha_s(h_t)$ chỉ phụ thuộc vào phần $P_{t-1}h_t$ — phần variance task-t giải thích được bởi old subspace. Với cross-domain tasks: $\text{PEV}_{t,\text{old}} \ll 1$ → routing tự nhiên reject.
|
| 166 |
+
|
| 167 |
+
---
|
| 168 |
+
|
| 169 |
+
### 4.5 Định lý 2: C5 Routing Optimality
|
| 170 |
+
|
| 171 |
+
**Định nghĩa 4** *(Restricted Stiefel Manifold).* $\mathcal{A}_t = \{A \in \mathbb{R}^{r \times d} : AP_{t-1} = 0,\; AA^\top = I_r\}$.
|
| 172 |
+
|
| 173 |
+
**Định lý 2** *(C5 là Optimal Routing Key).* Với $\tilde{C}_t = Q_{t-1} C_t Q_{t-1}$:
|
| 174 |
+
$$\operatorname{argmax}_{A_t \in \mathcal{A}_t} E_{h \sim p_t}[\alpha_t(h)] = \text{top-}r\text{ eigenvectors của } \tilde{C}_t$$
|
| 175 |
+
|
| 176 |
+
**Chứng minh.** Từ Lemma 1: $E[\alpha_t(h)] = \text{tr}(A_t \tilde{C}_t A_t^\top)/r$. Với constraint $A_tA_t^\top = I_r$, đây là Constrained PCA tiêu chuẩn → lời giải là các top eigenvectors. $\square$
|
| 177 |
+
|
| 178 |
+
**Ý nghĩa kép:** C5 đồng thời tối ưu (1) **routing** — maximize $E[\alpha_t(h)]$, và (2) **learning** — maximize variance captured trong null-space → $B_t$ học hiệu quả hơn. Một initialization, hai mục tiêu.
|
| 179 |
+
|
| 180 |
+
---
|
| 181 |
+
|
| 182 |
+
### 4.6 Định lý 3: Explicit Routing Margin
|
| 183 |
+
|
| 184 |
+
**Định lý 3.** Đặt $\lambda_{\min}(\tilde{C}_t) = \lambda_r(\tilde{C}_t)$ là eigenvalue nhỏ nhất trong top-$r$ của $\tilde{C}_t$. Với C5 init và A-row routing:
|
| 185 |
+
$$\boxed{E_{h \sim p_t}[\alpha_t(h)] - \max_{s < t} E_{h \sim p_s}[\alpha_t(h)] \geq \frac{\lambda_{\min}(\tilde{C}_t)}{r} - \frac{0.005\,\bar\sigma^2}{r}}$$
|
| 186 |
+
|
| 187 |
+
**Lợi thế C5 so với random init:**
|
| 188 |
+
$$\frac{E[\alpha_t^\text{C5}]}{E[\alpha_t^\text{rand}]} = \underbrace{\frac{d'}{r}}_{\text{null-space factor}} \cdot \underbrace{\text{PEV}_r(\tilde{C}_t)}_{\text{task concentration}}$$
|
| 189 |
+
|
| 190 |
+
Với T5-small tại task 8 ($d' \approx 351$, $r=8$): tỷ lệ $\approx 44 \times \text{PEV}_8 \gg 1$.
|
| 191 |
+
|
| 192 |
+
Đáng chú ý: factor $d'/r$ **tăng** khi null-space thu hẹp ở các task cuối — C5 có tác động lớn nhất chính khi routing trở nên khó khăn nhất.
|
| 193 |
+
|
| 194 |
+
---
|
| 195 |
+
|
| 196 |
+
### 4.7 Two-Phase Routing
|
| 197 |
+
|
| 198 |
+
| Phase | Cơ chế | Lý do |
|
| 199 |
+
|-------|--------|-------|
|
| 200 |
+
| **Training** (task $t$) | Oracle: weight=1.0 cho current task | $A_t$ trong null-space → $\|A_t h_t\|^2 \approx 0$ → spectral routing kill gradient |
|
| 201 |
+
| **Inference** | Hard Top-1 calibrated A-row argmax | Task ID không có; dùng calibrated spectral affinity |
|
| 202 |
+
|
| 203 |
+
Việc sử dụng oracle routing trong huấn luyện là thực hành tiêu chuẩn trong CL — task identity luôn khả dụng tại thời điểm huấn luyện.
|
| 204 |
+
|
| 205 |
+
**Calibration Normalization** tại inference: Task đầu có $A_t$ trong full $d$-dim space; task cuối bị constrain vào null-space hẹp hơn → raw score không so sánh được. EMA scale thu thập trong training:
|
| 206 |
+
|
| 207 |
+
$$\alpha_t^{\text{cal}}(h) = \frac{\alpha_t(h)}{\hat\mu_t}, \quad \hat\mu_t = \text{EMA}\!\left[\frac{\|A_t h\|^2}{r\|h\|^2}\right]_{\text{training of } t}$$
|
| 208 |
+
|
| 209 |
+
**Drift-Free Guarantee (Mệnh đề 2).** $h$ từ frozen `embed_tokens`; $A_t$ đóng băng sau C5 init → $\alpha_t(h)$ bất biến hoàn toàn. Không cần frozen copies, không cần distillation.
|
| 210 |
+
|
| 211 |
+
---
|
| 212 |
+
|
| 213 |
+
## 5. Các Đóng góp
|
| 214 |
+
|
| 215 |
+
### Đóng góp 1: Khung Định tuyến Phổ Phi tham số (C1 + C2 + C3)
|
| 216 |
+
|
| 217 |
+
**Core claim**: Bảo vệ không gian con và routing phân biệt là **hai biểu hiện kép của cùng một cấu trúc phổ**. Không cần học routing; bảo vệ tốt tự động cho routing tốt.
|
| 218 |
+
|
| 219 |
+
Từ duality này, chúng tôi dẫn xuất routing hoàn toàn phi tham số có đảm bảo lý thuyết:
|
| 220 |
+
- Routing margin $\geq \kappa_{\min}(t^*) - \varepsilon\kappa_{\max}$ (Định lý 1).
|
| 221 |
+
- Confidence $w_{t^*} \geq 1-\delta$ với $\tau$ tường minh (Hệ quả 1).
|
| 222 |
+
- Capacity bound $T_{\max} \leq d/\bar{k}(1-\varepsilon)$ (Hệ quả 2).
|
| 223 |
+
- Routing drift = 0 theo cấu trúc (Mệnh đề 2).
|
| 224 |
+
|
| 225 |
+
**Nhận xét**: GainLoRA giải một bài toán không cần thiết: routing parameter learning là dư thừa vì cơ chế bảo vệ subspace đã ngầm định cung cấp tín hiệu routing. SpecRoute khai thác tính duality này để loại bỏ hoàn toàn overhead của learned routing.
|
| 226 |
+
|
| 227 |
+
---
|
| 228 |
+
|
| 229 |
+
**C1 — Spectral Expert Signatures**: Signature = $A_t$ trực tiếp (model parameter), không cần SVD post-training. Lý do: $\text{rowspace}(B_tA_t) \subseteq \text{rowspace}(A_t)$ → SVD của $B_tA_t$ chỉ thêm $\sigma$-weighting từ $B_t$ artifact, không có đảm bảo lý thuyết. Với C5 init, rows của $A_t$ **đã là** routing-optimal directions (Định lý 2). Loại bỏ overhead $O(dr^2)$ per task per layer.
|
| 230 |
+
|
| 231 |
+
**C2 — Data-Informed Differential Routing**: Routing formula thống nhất cho cả train lẫn inference:
|
| 232 |
+
$$t^* = \arg\max_t\, \alpha_t^{\text{cal}}(h) = \arg\max_t \frac{\|A_t h\|^2 / r\|h\|^2}{\hat\mu_t}$$
|
| 233 |
+
Training dùng oracle; inference dùng hard Top-1 calibrated argmax. A-row optimal từ Lemma 1 + Định lý 2. Loại bỏ hoàn toàn `prepare_inference_routing()`.
|
| 234 |
+
|
| 235 |
+
**C3 — Capacity-Aware Subspace Allocation**: Dynamic threshold:
|
| 236 |
+
$$\varepsilon_t = (1-\varepsilon_0)\cdot\frac{t}{T} + \varepsilon_0$$
|
| 237 |
+
Bảo vệ nghiêm ngặt dần khi task tích luỹ. Đánh đổi có nguyên tắc qua Hệ quả 2.
|
| 238 |
+
|
| 239 |
+
---
|
| 240 |
+
|
| 241 |
+
### Đóng góp 2: Data-Informed Subspace Initialization (C5)
|
| 242 |
+
|
| 243 |
+
**Core claim**: Khởi tạo $A_t$ giải bài toán Constrained PCA trên restricted Grassmannian — lời giải dạng đóng, tối ưu cả routing lẫn learning, zero-replay compliant.
|
| 244 |
+
|
| 245 |
+
$$\max_{A_t \in \mathcal{A}_t}\;\text{tr}(A_t \tilde{C}_t A_t^\top) \quad\Rightarrow\quad A_t = \text{top-}r\text{ eigenvecs của } \tilde{C}_t = Q_{t-1}C_tQ_{t-1}$$
|
| 246 |
+
|
| 247 |
+
**Tại sao đây là đóng góp thực sự**: Không phải chỉ "better init". C5 là lời giải của một bài toán tối ưu có ràng buộc trên Grassmannian — có closed-form, có optimality proof, kết nối trực tiếp với routing theory qua Định lý 3. Init tốt hơn → $B_t$ học tốt hơn → $\sigma_{t,i}$ lớn hơn → $\kappa_{\min}(t^*)$ tăng → routing margin tăng.
|
| 248 |
+
|
| 249 |
+
**Zero-replay compliance**: $C_t$ tính từ activation của dữ liệu task *hiện tại* — luôn available trong CL protocol, không phải replay. Cùng loại thông tin với GPM bases (second moment của activations) đã được community accept.
|
| 250 |
+
|
| 251 |
+
**C4 — Gradient Preconditioning** *(chi tiết triển khai)*: Sau khi chiếu $A_t$ vào null-space, column space không còn trực giao �� gradient $\nabla_B\mathcal{L}$ bị biến dạng. Áp dụng preconditioner một lần sau `get_reg_matrix()`:
|
| 252 |
+
$$\tilde\nabla_B = \nabla_B\mathcal{L} \cdot (AA^T + \epsilon I)^{-1/2}$$
|
| 253 |
+
|
| 254 |
+
---
|
| 255 |
+
|
| 256 |
+
## 6. Kiến trúc và Thay đổi Kỹ thuật
|
| 257 |
+
|
| 258 |
+
### 6.1 So sánh với GainLoRA
|
| 259 |
+
|
| 260 |
+
| Thành phần | GainLoRA | SpecRoute | Lý do thay đổi |
|
| 261 |
+
|------------|----------|-----------|----------------|
|
| 262 |
+
| MLP `trans_input` | Learned routing projection | ❌ Loại bỏ | Duality: A-row affinity đủ |
|
| 263 |
+
| `prompt_key` | Learned per-task key | ❌ Loại bỏ | $A_t$ = signature trực tiếp |
|
| 264 |
+
| `previous_trans_input` | Frozen MLP copies | ❌ Loại bỏ | Routing bất biến theo cấu trúc |
|
| 265 |
+
| KL distillation | Replay-based routing loss | ❌ Loại bỏ | Không learned routing → không drift |
|
| 266 |
+
| GPM trên routing params | Subspace reserved for routing | ❌ Loại bỏ | Không có routing params cần bảo vệ |
|
| 267 |
+
| SVD post-training | `prepare_inference_routing()` | ❌ Loại bỏ | $A_t$ là signature (Định lý 2) |
|
| 268 |
+
| — | — | **✅ C5: Data-informed init** | Giải GPM–Routing Paradox |
|
| 269 |
+
| — | — | **✅ C4: Gradient precond.** | Sửa condition number sau projection |
|
| 270 |
+
| — | — | **✅ Calibration EMA** | Scale invariant routing |
|
| 271 |
+
|
| 272 |
+
**Net effect**: Toàn bộ subspace và compute budget dành cho routing infrastructure được thu hồi cho task learning.
|
| 273 |
+
|
| 274 |
+
### 6.2 Pipeline Huấn luyện
|
| 275 |
+
|
| 276 |
+
**Task 1:**
|
| 277 |
+
1. Load pretrained model + fresh LoRA ($A$: Kaiming, $B$: zeros).
|
| 278 |
+
2. Train chuẩn (`lora_B` only) — single expert, không routing.
|
| 279 |
+
3. Sau training: cập nhật GPM bases.
|
| 280 |
+
4. Lưu: LoRA weights + GPM reg files.
|
| 281 |
+
|
| 282 |
+
**Task $t \geq 2$:**
|
| 283 |
+
1. Load model + load tất cả LoRA weights cũ (frozen).
|
| 284 |
+
2. **[C5]** Pre-task forward (100 batches, no grad):
|
| 285 |
+
- Thu thập $C_t = \sum h(x)h(x)^T / N$
|
| 286 |
+
- Tính $\tilde C_t = Q_{t-1}C_tQ_{t-1}$
|
| 287 |
+
- $A_t \leftarrow$ top-$r$ eigenvecs của $\tilde C_t$ (fallback: Kaiming nếu max_eigval < 1e-6)
|
| 288 |
+
3. **[C4]** Precompute preconditioner $(A_tA_t^T + \epsilon I)^{-1/2}$.
|
| 289 |
+
4. Train `lora_B` với oracle routing + gradient preconditioning. EMA $\hat\mu_t$ thu thập tự động.
|
| 290 |
+
5. Sau training: cập nhật GPM bases (200 batches).
|
| 291 |
+
6. Lưu artifacts.
|
| 292 |
+
|
| 293 |
+
### 6.3 Mapping Lý thuyết → Code
|
| 294 |
+
|
| 295 |
+
| Lý thuyết | Implementation | File |
|
| 296 |
+
|-----------|---------------|------|
|
| 297 |
+
| Spectral signature $\mathcal{S}_t = A_t$ | `lora_A` weights (frozen after C5) | `t5_specroute.py` |
|
| 298 |
+
| Affinity $\alpha_t^{\text{cal}}(h)$, hard Top-1 | `compute_spectral_routing()` | `t5_specroute.py` |
|
| 299 |
+
| Oracle routing (training) | `weights[:, 0] = 1.0` | `compute_spectral_routing()` |
|
| 300 |
+
| EMA calibration $\hat\mu_t$ | EMA fit scale, stored in signatures | `compute_spectral_routing()` |
|
| 301 |
+
| Drift-free input $h$ | `embed_tokens(input_ids)` → mean-pool | `T5Stack.forward()` |
|
| 302 |
+
| GPM + InfLoRA null-space | `get_reg_matrix()` | `cl_trainer_specroute.py` |
|
| 303 |
+
| Dynamic ESA threshold | `(1−ε₀)·t/T + ε₀` | `cl_trainer_specroute.py` |
|
| 304 |
+
| C4: Preconditioner | `precompute_preconditioners()` → eigh | `cl_trainer_specroute.py` |
|
| 305 |
+
| C5: Data-informed init | `pre_task_data_collection()` → `eigh(Q@C@Q)` → `lora_A.data` | `cl_trainer_specroute.py` |
|
| 306 |
+
|
| 307 |
+
---
|
| 308 |
+
|
| 309 |
+
## 7. Thiết lập Thực nghiệm
|
| 310 |
+
|
| 311 |
+
| Hạng mục | Giá trị |
|
| 312 |
+
|----------|---------|
|
| 313 |
+
| **Mô hình** | `google/flan-t5-small` (60M params), `flan-t5-large` (783M) |
|
| 314 |
+
| **Benchmarks** | SuperNI (15 tasks, 4 orderings), Long Sequence (15 tasks, 2 orderings) |
|
| 315 |
+
| **Metrics** | AP — Average Performance ↑, FT — Forgetting ↓ |
|
| 316 |
+
| **LoRA** | $r=8$, target Q+V attention projections |
|
| 317 |
+
| **Routing** | Training: oracle (task weight=1.0); Inference: hard Top-1 calibrated A-row |
|
| 318 |
+
| **C5** | $N_\text{batch}=100$, `torch.linalg.eigh` trên projected covariance |
|
| 319 |
+
| **C4** | Gradient preconditioning bật (`--use_preconditioning True`), $\epsilon=10^{-6}$ |
|
| 320 |
+
| **ESA threshold** | $\varepsilon_0 = 0.995$ (dynamic) |
|
| 321 |
+
| **GPM repr.** | 200 batches |
|
| 322 |
+
| **Precision** | fp32 + `gradient_checkpointing` |
|
| 323 |
+
| **Batch size** | P100 16GB: BSZ=8, GA=4 (eff. 32); T4: BSZ=2, GA=8 |
|
| 324 |
+
| **Thời gian** | SuperNI T5-small ≈ 2–3h; Long ≈ 3–4h (P100) |
|
| 325 |
+
| **Baselines** | GainLoRA (ROOT), InfLoRA, O-LoRA, EWC, L2P — same BSZ/LR/scheduler |
|
| 326 |
+
|
| 327 |
+
**Scalability note**: C5 eigdecomp là $O(d^2)$ per layer per task.
|
| 328 |
+
- T5-small ($d=512$): chấp nhận được.
|
| 329 |
+
- LLaMA-7B ($d=4096$): dùng randomized SVD/Lanczos → $O(dr)$.
|
| 330 |
+
|
| 331 |
+
---
|
| 332 |
+
|
| 333 |
+
## 8. Giới hạn đã biết
|
| 334 |
+
|
| 335 |
+
**Same-domain routing (structural limit).** Với tasks cùng domain (yelp/amazon/imdb, TF-IDF cosine ≈ 0.89), input $h$ của imdb nằm chủ yếu trong subspace của yelp (PEV cao). Routing margin → ~0 cho cặp này. Đây là **giới hạn cơ bản của mọi zero-replay parameter-free routing** — Bretagnolle–Huber bound đảm bảo $P_e \geq \frac{1}{2}(1 - \sqrt{1 - e^{-D_{KL}}})$ → unclassifiable khi $D_{KL}(p_\text{imdb} \| p_\text{yelp}) \approx 0$.
|
| 336 |
+
|
| 337 |
+
**Capacity saturation.** GPM effective rank $k_t \approx 30$–$80$ dims/task. Worst case 15 tasks × 80 = 1200 > 512 = $d$ → null-space collapse ở tasks cuối. Dynamic threshold (C3) giảm nhẹ nhưng không giải hoàn toàn.
|
improve_gainlora/RUN_GUIDE_DIAGNOSTIC.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SpecRoute Diagnostic Run Guide
|
| 2 |
+
|
| 3 |
+
## Quick Start — Priority Experiment
|
| 4 |
+
|
| 5 |
+
**Run Long Sequence Order 3 (T5-small) first** — hardest benchmark with many same-domain tasks (yelp/amazon/imdb/sst2 all sentiment).
|
| 6 |
+
|
| 7 |
+
### On H100 / A100:
|
| 8 |
+
|
| 9 |
+
```bash
|
| 10 |
+
cd /path/to/Continual/improve_gainlora
|
| 11 |
+
|
| 12 |
+
# Using T5_small scripts (has --do_predict in all 15 tasks = full diagnostics)
|
| 13 |
+
bash T5_small/gen_script_long_order3_t5_small_specroute.sh 0 google/flan-t5-small
|
| 14 |
+
|
| 15 |
+
# OR using top-level scripts (--do_predict only in task 1)
|
| 16 |
+
bash gen_script_long_order3_t5_specroute.sh 0 google/flan-t5-small
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
> **Recommendation**: Use `T5_small/` scripts — they have `--do_predict` in all 15 blocks,
|
| 20 |
+
> so routing diagnostics (`routing_decisions.pt`) are saved for every task.
|
| 21 |
+
> Top-level scripts only save routing data for task 1.
|
| 22 |
+
|
| 23 |
+
### On Kaggle / Colab (T4 GPU):
|
| 24 |
+
|
| 25 |
+
```bash
|
| 26 |
+
bash setup_kaggle_colab.sh # install deps
|
| 27 |
+
bash T5_small/gen_script_long_order3_t5_small_specroute.sh 0 google/flan-t5-small
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
## All Experiments
|
| 33 |
+
|
| 34 |
+
| Script | Model | Benchmark | Priority |
|
| 35 |
+
|--------|-------|-----------|----------|
|
| 36 |
+
| `T5_small/gen_script_long_order3_t5_small_specroute.sh` | flan-t5-small | Long Seq (15 tasks, order 3) | **1st** |
|
| 37 |
+
| `T5_small/gen_script_long_order4_t5_small_specroute.sh` | flan-t5-small | Long Seq (15 tasks, order 4) | 2nd |
|
| 38 |
+
| `T5_small/gen_script_superni_order1_t5_small_specroute.sh` | flan-t5-small | SuperNI (15 tasks, order 1) | 3rd |
|
| 39 |
+
| `T5_small/gen_script_superni_order2_t5_small_specroute.sh` | flan-t5-small | SuperNI (15 tasks, order 2) | 4th |
|
| 40 |
+
| `gen_script_superni_order1_llama_specroute.sh` | Llama-2-7B | SuperNI order 1 | Later |
|
| 41 |
+
| `gen_script_superni_order2_llama_specroute.sh` | Llama-2-7B | SuperNI order 2 | Later |
|
| 42 |
+
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
## CPI/OAP Parameters (already set in all scripts)
|
| 46 |
+
|
| 47 |
+
| Parameter | Value | Meaning |
|
| 48 |
+
|-----------|-------|---------|
|
| 49 |
+
| `--cpi_gamma` | 0.5 | CPI contrastive weight (γ in Def. 3) |
|
| 50 |
+
| `--oap_eta` | 0.5 | OAP projection strength (η in Def. 4) |
|
| 51 |
+
| `--oap_beta_min` | 0.3 | OAP minimum retention floor (β_min in Thm. 4) |
|
| 52 |
+
| `--oap_warmup` | 3 | Tasks before full OAP kicks in (empirical safeguard) |
|
| 53 |
+
|
| 54 |
+
To change parameters:
|
| 55 |
+
```bash
|
| 56 |
+
python _patch_cpi_oap.py --gamma 0.5 --eta 0.5 --beta_min 0.3 --warmup 3
|
| 57 |
+
# This patches top-level scripts only. For T5_small, edit manually or extend the script.
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## Diagnostic Outputs
|
| 63 |
+
|
| 64 |
+
### 1. CPI/OAP Init Diagnostics (during training, task ≥ 2)
|
| 65 |
+
|
| 66 |
+
**Log lines** (grep for these in stdout):
|
| 67 |
+
```
|
| 68 |
+
[DIAG-INIT] Layer N chunk K: ρ_l=0.1234, β_l=0.7000, SSE_before=0.45, SSE_after=0.12, λ_min+/r=0.000123, n_pos=6/8
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
| Metric | What it tells you | Healthy range |
|
| 72 |
+
|--------|-------------------|---------------|
|
| 73 |
+
| `ρ_l` | Domain proximity to old tasks (weighted) | 0.0–1.0 (higher = more overlap) |
|
| 74 |
+
| `β_l` | OAP retention factor for layer l | ≥ β_min (0.3). Higher ρ → higher β |
|
| 75 |
+
| `SSE_before` | Subspace overlap BEFORE OAP | Varies |
|
| 76 |
+
| `SSE_after` | Subspace overlap AFTER OAP | Should be < SSE_before |
|
| 77 |
+
| `λ_min+/r` | CPI routing margin (Thm. 3 lower bound) | > 1e-5. If ≈ 0, CPI failing |
|
| 78 |
+
| `n_pos/total` | Positive eigenvalues in D_t | ≥ r (lora_r=8). If < r, falling back to Kaiming |
|
| 79 |
+
|
| 80 |
+
**Saved file**: `<output_dir>/saved_weights/init_diagnostics.pt`
|
| 81 |
+
- List of dicts, one per layer, with per-chunk diagnostics
|
| 82 |
+
|
| 83 |
+
### 2. Routing Diagnostics (during prediction, requires `--do_predict`)
|
| 84 |
+
|
| 85 |
+
**Log lines**:
|
| 86 |
+
```
|
| 87 |
+
[DIAG-ROUTING] Task amazon (id=1): routed_to_current=0.850 (850/1000) n_tasks=2
|
| 88 |
+
task_idx=0: 0.850
|
| 89 |
+
task_idx=1: 0.150
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
| Metric | What it tells you | Healthy range |
|
| 93 |
+
|--------|-------------------|---------------|
|
| 94 |
+
| `routed_to_current` | Fraction correctly routed to current task's expert | > 0.7 |
|
| 95 |
+
| `p_e = 1 - routed_to_current` | Routing error rate (Thm. 4 input) | < 0.3 |
|
| 96 |
+
|
| 97 |
+
**Saved file**: `<output_dir>/saved_weights/routing_decisions.pt`
|
| 98 |
+
- Tensor of routing indices (0 = current task, 1+ = old tasks)
|
| 99 |
+
|
| 100 |
+
### 3. Standard Metrics
|
| 101 |
+
|
| 102 |
+
After all 15 tasks complete, stdout contains `predict_exact_match_for_<task>` lines.
|
| 103 |
+
Use the scoring script:
|
| 104 |
+
```bash
|
| 105 |
+
# Parse from log file
|
| 106 |
+
python ../parse_and_score_v2.py <logfile>
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
---
|
| 110 |
+
|
| 111 |
+
## Post-Run Analysis
|
| 112 |
+
|
| 113 |
+
### Quick analysis script:
|
| 114 |
+
|
| 115 |
+
```bash
|
| 116 |
+
python analyze_diagnostics.py gen_script_long_order3_t5_small_specroute
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
This reads all `init_diagnostics.pt` and `routing_decisions.pt` files and prints:
|
| 120 |
+
- Per-task CPI/OAP health (ρ, β, SSE, λ_min+/r, eigenvalue count)
|
| 121 |
+
- Per-task routing error (p_e)
|
| 122 |
+
- Trend analysis (is p_e increasing? Is λ_min+/r collapsing?)
|
| 123 |
+
- Summary table
|
| 124 |
+
|
| 125 |
+
### Manual inspection:
|
| 126 |
+
|
| 127 |
+
```python
|
| 128 |
+
import torch
|
| 129 |
+
|
| 130 |
+
# Load init diagnostics for task 5
|
| 131 |
+
diag = torch.load('logs_and_outputs/gen_script_long_order3_t5_small_specroute/outputs/5-copa/saved_weights/init_diagnostics.pt')
|
| 132 |
+
for layer_idx, layer_data in enumerate(diag):
|
| 133 |
+
for chunk_idx, d in layer_data.items():
|
| 134 |
+
print(f"Layer {layer_idx} chunk {chunk_idx}: ρ={d['rho_l']:.4f} β={d['beta_l']:.4f} λ+/r={d['lambda_min_pos_over_r']:.6f}")
|
| 135 |
+
|
| 136 |
+
# Load routing decisions for task 10
|
| 137 |
+
rd = torch.load('logs_and_outputs/gen_script_long_order3_t5_small_specroute/outputs/10-dbpedia/saved_weights/routing_decisions.pt')
|
| 138 |
+
p_e = 1.0 - (rd == 0).float().mean().item()
|
| 139 |
+
print(f"p_e = {p_e:.3f}")
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
---
|
| 143 |
+
|
| 144 |
+
## Ablation Grid (§7.1)
|
| 145 |
+
|
| 146 |
+
Run 4 configs to isolate CPI vs OAP contribution:
|
| 147 |
+
|
| 148 |
+
| Config | γ | η | What it tests |
|
| 149 |
+
|--------|---|---|---------------|
|
| 150 |
+
| baseline | 0 | 0 | Pure spectral routing (no CPI, no OAP) |
|
| 151 |
+
| CPI only | 0.5 | 0 | CPI init without OAP projection |
|
| 152 |
+
| OAP only | 0 | 0.5 | OAP projection without CPI init |
|
| 153 |
+
| full | 0.5 | 0.5 | Full SpecRoute (default) |
|
| 154 |
+
|
| 155 |
+
To run the baseline config:
|
| 156 |
+
```bash
|
| 157 |
+
python _patch_cpi_oap.py --gamma 0 --eta 0
|
| 158 |
+
# Then run the same gen_script with different --run_name to separate outputs
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
> Note: When γ=0, CPI falls back to standard Kaiming init.
|
| 162 |
+
> When η=0, OAP is skipped (β_l always = 1, no projection applied).
|
| 163 |
+
|
| 164 |
+
---
|
| 165 |
+
|
| 166 |
+
## What to Report Back
|
| 167 |
+
|
| 168 |
+
After the first experiment (Long Order 3 T5-small) finishes:
|
| 169 |
+
|
| 170 |
+
1. **Final AP and Forgetting**: run `python ../parse_and_score_v2.py <logfile>`
|
| 171 |
+
2. **Diagnostic summary**: run `python analyze_diagnostics.py gen_script_long_order3_t5_small_specroute`
|
| 172 |
+
3. **Key questions to answer**:
|
| 173 |
+
- Is `p_e` staying below 0.3 across all 15 tasks?
|
| 174 |
+
- Is `λ_min+/r` maintaining a healthy margin (> 1e-5)?
|
| 175 |
+
- Does SSE decrease after OAP (SSE_after < SSE_before)?
|
| 176 |
+
- Is β_l respecting the β_min=0.3 floor?
|
| 177 |
+
- Any tasks with routing accuracy < 0.5? (indicates method failure)
|
| 178 |
+
|
| 179 |
+
4. **If things look bad** (p_e > 0.3 and rising):
|
| 180 |
+
→ We discuss Option 1: decoupled routing, prototype-based routing, or hierarchical routing
|
| 181 |
+
|
| 182 |
+
5. **If things look good** (p_e < 0.3, stable):
|
| 183 |
+
→ Proceed to remaining experiments (Order 4, SuperNI, Llama)
|
| 184 |
+
|
| 185 |
+
---
|
| 186 |
+
|
| 187 |
+
## Output Directory Structure
|
| 188 |
+
|
| 189 |
+
```
|
| 190 |
+
logs_and_outputs/gen_script_long_order3_t5_small_specroute/
|
| 191 |
+
outputs/
|
| 192 |
+
task_order.txt
|
| 193 |
+
1-yelp/
|
| 194 |
+
saved_weights/
|
| 195 |
+
routing_decisions.pt # routing stats (if --do_predict)
|
| 196 |
+
init_diagnostics.pt # CPI/OAP diagnostics (task >= 2)
|
| 197 |
+
spectral_signatures.pt # frozen A matrices + calibration
|
| 198 |
+
...
|
| 199 |
+
2-amazon/
|
| 200 |
+
saved_weights/
|
| 201 |
+
init_diagnostics.pt
|
| 202 |
+
routing_decisions.pt
|
| 203 |
+
...
|
| 204 |
+
...
|
| 205 |
+
15-wic/
|
| 206 |
+
saved_weights/
|
| 207 |
+
...
|
| 208 |
+
```
|
improve_gainlora/T5_small/gen_script_long_order3_t5_small_specroute.sh
CHANGED
|
@@ -114,6 +114,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
--threshold 0.995 \
|
| 118 |
--transthreshold 0.995 \
|
| 119 |
$FP16_FLAG
|
|
@@ -170,6 +174,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 170 |
--data_replay_freq -1 \
|
| 171 |
--mlp_hidden_dim 100 \
|
| 172 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
--threshold 0.995 \
|
| 174 |
--transthreshold 0.995 \
|
| 175 |
$FP16_FLAG
|
|
@@ -226,6 +234,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 226 |
--data_replay_freq -1 \
|
| 227 |
--mlp_hidden_dim 100 \
|
| 228 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
--threshold 0.995 \
|
| 230 |
--transthreshold 0.995 \
|
| 231 |
$FP16_FLAG
|
|
@@ -282,6 +294,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 282 |
--data_replay_freq -1 \
|
| 283 |
--mlp_hidden_dim 100 \
|
| 284 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
--threshold 0.995 \
|
| 286 |
--transthreshold 0.995 \
|
| 287 |
$FP16_FLAG
|
|
@@ -338,6 +354,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 338 |
--data_replay_freq -1 \
|
| 339 |
--mlp_hidden_dim 100 \
|
| 340 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
--threshold 0.995 \
|
| 342 |
--transthreshold 0.995 \
|
| 343 |
$FP16_FLAG
|
|
@@ -394,6 +414,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 394 |
--data_replay_freq -1 \
|
| 395 |
--mlp_hidden_dim 100 \
|
| 396 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
--threshold 0.995 \
|
| 398 |
--transthreshold 0.995 \
|
| 399 |
$FP16_FLAG
|
|
@@ -450,6 +474,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 450 |
--data_replay_freq -1 \
|
| 451 |
--mlp_hidden_dim 100 \
|
| 452 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
--threshold 0.995 \
|
| 454 |
--transthreshold 0.995 \
|
| 455 |
$FP16_FLAG
|
|
@@ -506,6 +534,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 506 |
--data_replay_freq -1 \
|
| 507 |
--mlp_hidden_dim 100 \
|
| 508 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 509 |
--threshold 0.995 \
|
| 510 |
--transthreshold 0.995 \
|
| 511 |
$FP16_FLAG
|
|
@@ -562,6 +594,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 562 |
--data_replay_freq -1 \
|
| 563 |
--mlp_hidden_dim 100 \
|
| 564 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 565 |
--threshold 0.995 \
|
| 566 |
--transthreshold 0.995 \
|
| 567 |
$FP16_FLAG
|
|
@@ -618,6 +654,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 618 |
--data_replay_freq -1 \
|
| 619 |
--mlp_hidden_dim 100 \
|
| 620 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 621 |
--threshold 0.995 \
|
| 622 |
--transthreshold 0.995 \
|
| 623 |
$FP16_FLAG
|
|
@@ -674,6 +714,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 674 |
--data_replay_freq -1 \
|
| 675 |
--mlp_hidden_dim 100 \
|
| 676 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 677 |
--threshold 0.995 \
|
| 678 |
--transthreshold 0.995 \
|
| 679 |
$FP16_FLAG
|
|
@@ -730,6 +774,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 730 |
--data_replay_freq -1 \
|
| 731 |
--mlp_hidden_dim 100 \
|
| 732 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 733 |
--threshold 0.995 \
|
| 734 |
--transthreshold 0.995 \
|
| 735 |
$FP16_FLAG
|
|
@@ -786,6 +834,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 786 |
--data_replay_freq -1 \
|
| 787 |
--mlp_hidden_dim 100 \
|
| 788 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 789 |
--threshold 0.995 \
|
| 790 |
--transthreshold 0.995 \
|
| 791 |
$FP16_FLAG
|
|
@@ -842,6 +894,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 842 |
--data_replay_freq -1 \
|
| 843 |
--mlp_hidden_dim 100 \
|
| 844 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 845 |
--threshold 0.995 \
|
| 846 |
--transthreshold 0.995 \
|
| 847 |
$FP16_FLAG
|
|
@@ -898,6 +954,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 898 |
--data_replay_freq -1 \
|
| 899 |
--mlp_hidden_dim 100 \
|
| 900 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 901 |
--threshold 0.995 \
|
| 902 |
--transthreshold 0.995 \
|
| 903 |
$FP16_FLAG
|
|
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
| 117 |
+
--cpi_gamma 0.5 \
|
| 118 |
+
--oap_eta 0.5 \
|
| 119 |
+
--oap_beta_min 0.3 \
|
| 120 |
+
--oap_warmup 3 \
|
| 121 |
--threshold 0.995 \
|
| 122 |
--transthreshold 0.995 \
|
| 123 |
$FP16_FLAG
|
|
|
|
| 174 |
--data_replay_freq -1 \
|
| 175 |
--mlp_hidden_dim 100 \
|
| 176 |
--model_name specroute \
|
| 177 |
+
--cpi_gamma 0.5 \
|
| 178 |
+
--oap_eta 0.5 \
|
| 179 |
+
--oap_beta_min 0.3 \
|
| 180 |
+
--oap_warmup 3 \
|
| 181 |
--threshold 0.995 \
|
| 182 |
--transthreshold 0.995 \
|
| 183 |
$FP16_FLAG
|
|
|
|
| 234 |
--data_replay_freq -1 \
|
| 235 |
--mlp_hidden_dim 100 \
|
| 236 |
--model_name specroute \
|
| 237 |
+
--cpi_gamma 0.5 \
|
| 238 |
+
--oap_eta 0.5 \
|
| 239 |
+
--oap_beta_min 0.3 \
|
| 240 |
+
--oap_warmup 3 \
|
| 241 |
--threshold 0.995 \
|
| 242 |
--transthreshold 0.995 \
|
| 243 |
$FP16_FLAG
|
|
|
|
| 294 |
--data_replay_freq -1 \
|
| 295 |
--mlp_hidden_dim 100 \
|
| 296 |
--model_name specroute \
|
| 297 |
+
--cpi_gamma 0.5 \
|
| 298 |
+
--oap_eta 0.5 \
|
| 299 |
+
--oap_beta_min 0.3 \
|
| 300 |
+
--oap_warmup 3 \
|
| 301 |
--threshold 0.995 \
|
| 302 |
--transthreshold 0.995 \
|
| 303 |
$FP16_FLAG
|
|
|
|
| 354 |
--data_replay_freq -1 \
|
| 355 |
--mlp_hidden_dim 100 \
|
| 356 |
--model_name specroute \
|
| 357 |
+
--cpi_gamma 0.5 \
|
| 358 |
+
--oap_eta 0.5 \
|
| 359 |
+
--oap_beta_min 0.3 \
|
| 360 |
+
--oap_warmup 3 \
|
| 361 |
--threshold 0.995 \
|
| 362 |
--transthreshold 0.995 \
|
| 363 |
$FP16_FLAG
|
|
|
|
| 414 |
--data_replay_freq -1 \
|
| 415 |
--mlp_hidden_dim 100 \
|
| 416 |
--model_name specroute \
|
| 417 |
+
--cpi_gamma 0.5 \
|
| 418 |
+
--oap_eta 0.5 \
|
| 419 |
+
--oap_beta_min 0.3 \
|
| 420 |
+
--oap_warmup 3 \
|
| 421 |
--threshold 0.995 \
|
| 422 |
--transthreshold 0.995 \
|
| 423 |
$FP16_FLAG
|
|
|
|
| 474 |
--data_replay_freq -1 \
|
| 475 |
--mlp_hidden_dim 100 \
|
| 476 |
--model_name specroute \
|
| 477 |
+
--cpi_gamma 0.5 \
|
| 478 |
+
--oap_eta 0.5 \
|
| 479 |
+
--oap_beta_min 0.3 \
|
| 480 |
+
--oap_warmup 3 \
|
| 481 |
--threshold 0.995 \
|
| 482 |
--transthreshold 0.995 \
|
| 483 |
$FP16_FLAG
|
|
|
|
| 534 |
--data_replay_freq -1 \
|
| 535 |
--mlp_hidden_dim 100 \
|
| 536 |
--model_name specroute \
|
| 537 |
+
--cpi_gamma 0.5 \
|
| 538 |
+
--oap_eta 0.5 \
|
| 539 |
+
--oap_beta_min 0.3 \
|
| 540 |
+
--oap_warmup 3 \
|
| 541 |
--threshold 0.995 \
|
| 542 |
--transthreshold 0.995 \
|
| 543 |
$FP16_FLAG
|
|
|
|
| 594 |
--data_replay_freq -1 \
|
| 595 |
--mlp_hidden_dim 100 \
|
| 596 |
--model_name specroute \
|
| 597 |
+
--cpi_gamma 0.5 \
|
| 598 |
+
--oap_eta 0.5 \
|
| 599 |
+
--oap_beta_min 0.3 \
|
| 600 |
+
--oap_warmup 3 \
|
| 601 |
--threshold 0.995 \
|
| 602 |
--transthreshold 0.995 \
|
| 603 |
$FP16_FLAG
|
|
|
|
| 654 |
--data_replay_freq -1 \
|
| 655 |
--mlp_hidden_dim 100 \
|
| 656 |
--model_name specroute \
|
| 657 |
+
--cpi_gamma 0.5 \
|
| 658 |
+
--oap_eta 0.5 \
|
| 659 |
+
--oap_beta_min 0.3 \
|
| 660 |
+
--oap_warmup 3 \
|
| 661 |
--threshold 0.995 \
|
| 662 |
--transthreshold 0.995 \
|
| 663 |
$FP16_FLAG
|
|
|
|
| 714 |
--data_replay_freq -1 \
|
| 715 |
--mlp_hidden_dim 100 \
|
| 716 |
--model_name specroute \
|
| 717 |
+
--cpi_gamma 0.5 \
|
| 718 |
+
--oap_eta 0.5 \
|
| 719 |
+
--oap_beta_min 0.3 \
|
| 720 |
+
--oap_warmup 3 \
|
| 721 |
--threshold 0.995 \
|
| 722 |
--transthreshold 0.995 \
|
| 723 |
$FP16_FLAG
|
|
|
|
| 774 |
--data_replay_freq -1 \
|
| 775 |
--mlp_hidden_dim 100 \
|
| 776 |
--model_name specroute \
|
| 777 |
+
--cpi_gamma 0.5 \
|
| 778 |
+
--oap_eta 0.5 \
|
| 779 |
+
--oap_beta_min 0.3 \
|
| 780 |
+
--oap_warmup 3 \
|
| 781 |
--threshold 0.995 \
|
| 782 |
--transthreshold 0.995 \
|
| 783 |
$FP16_FLAG
|
|
|
|
| 834 |
--data_replay_freq -1 \
|
| 835 |
--mlp_hidden_dim 100 \
|
| 836 |
--model_name specroute \
|
| 837 |
+
--cpi_gamma 0.5 \
|
| 838 |
+
--oap_eta 0.5 \
|
| 839 |
+
--oap_beta_min 0.3 \
|
| 840 |
+
--oap_warmup 3 \
|
| 841 |
--threshold 0.995 \
|
| 842 |
--transthreshold 0.995 \
|
| 843 |
$FP16_FLAG
|
|
|
|
| 894 |
--data_replay_freq -1 \
|
| 895 |
--mlp_hidden_dim 100 \
|
| 896 |
--model_name specroute \
|
| 897 |
+
--cpi_gamma 0.5 \
|
| 898 |
+
--oap_eta 0.5 \
|
| 899 |
+
--oap_beta_min 0.3 \
|
| 900 |
+
--oap_warmup 3 \
|
| 901 |
--threshold 0.995 \
|
| 902 |
--transthreshold 0.995 \
|
| 903 |
$FP16_FLAG
|
|
|
|
| 954 |
--data_replay_freq -1 \
|
| 955 |
--mlp_hidden_dim 100 \
|
| 956 |
--model_name specroute \
|
| 957 |
+
--cpi_gamma 0.5 \
|
| 958 |
+
--oap_eta 0.5 \
|
| 959 |
+
--oap_beta_min 0.3 \
|
| 960 |
+
--oap_warmup 3 \
|
| 961 |
--threshold 0.995 \
|
| 962 |
--transthreshold 0.995 \
|
| 963 |
$FP16_FLAG
|
improve_gainlora/T5_small/gen_script_long_order3_t5_small_specroute_v10a.sh
CHANGED
|
@@ -114,6 +114,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
--routing_mode learned \
|
| 118 |
--threshold 0.995 \
|
| 119 |
--transthreshold 0.995 \
|
|
@@ -173,6 +177,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 173 |
--data_replay_freq -1 \
|
| 174 |
--mlp_hidden_dim 100 \
|
| 175 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
--routing_mode learned \
|
| 177 |
--threshold 0.995 \
|
| 178 |
--transthreshold 0.995 \
|
|
@@ -232,6 +240,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 232 |
--data_replay_freq -1 \
|
| 233 |
--mlp_hidden_dim 100 \
|
| 234 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
--routing_mode learned \
|
| 236 |
--threshold 0.995 \
|
| 237 |
--transthreshold 0.995 \
|
|
@@ -291,6 +303,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 291 |
--data_replay_freq -1 \
|
| 292 |
--mlp_hidden_dim 100 \
|
| 293 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
--routing_mode learned \
|
| 295 |
--threshold 0.995 \
|
| 296 |
--transthreshold 0.995 \
|
|
@@ -350,6 +366,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 350 |
--data_replay_freq -1 \
|
| 351 |
--mlp_hidden_dim 100 \
|
| 352 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 353 |
--routing_mode learned \
|
| 354 |
--threshold 0.995 \
|
| 355 |
--transthreshold 0.995 \
|
|
@@ -409,6 +429,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 409 |
--data_replay_freq -1 \
|
| 410 |
--mlp_hidden_dim 100 \
|
| 411 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
--routing_mode learned \
|
| 413 |
--threshold 0.995 \
|
| 414 |
--transthreshold 0.995 \
|
|
@@ -468,6 +492,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 468 |
--data_replay_freq -1 \
|
| 469 |
--mlp_hidden_dim 100 \
|
| 470 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 471 |
--routing_mode learned \
|
| 472 |
--threshold 0.995 \
|
| 473 |
--transthreshold 0.995 \
|
|
@@ -527,6 +555,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 527 |
--data_replay_freq -1 \
|
| 528 |
--mlp_hidden_dim 100 \
|
| 529 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 530 |
--routing_mode learned \
|
| 531 |
--threshold 0.995 \
|
| 532 |
--transthreshold 0.995 \
|
|
@@ -586,6 +618,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 586 |
--data_replay_freq -1 \
|
| 587 |
--mlp_hidden_dim 100 \
|
| 588 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
--routing_mode learned \
|
| 590 |
--threshold 0.995 \
|
| 591 |
--transthreshold 0.995 \
|
|
@@ -645,6 +681,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 645 |
--data_replay_freq -1 \
|
| 646 |
--mlp_hidden_dim 100 \
|
| 647 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 648 |
--routing_mode learned \
|
| 649 |
--threshold 0.995 \
|
| 650 |
--transthreshold 0.995 \
|
|
@@ -704,6 +744,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 704 |
--data_replay_freq -1 \
|
| 705 |
--mlp_hidden_dim 100 \
|
| 706 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 707 |
--routing_mode learned \
|
| 708 |
--threshold 0.995 \
|
| 709 |
--transthreshold 0.995 \
|
|
@@ -763,6 +807,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 763 |
--data_replay_freq -1 \
|
| 764 |
--mlp_hidden_dim 100 \
|
| 765 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 766 |
--routing_mode learned \
|
| 767 |
--threshold 0.995 \
|
| 768 |
--transthreshold 0.995 \
|
|
@@ -822,6 +870,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 822 |
--data_replay_freq -1 \
|
| 823 |
--mlp_hidden_dim 100 \
|
| 824 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 825 |
--routing_mode learned \
|
| 826 |
--threshold 0.995 \
|
| 827 |
--transthreshold 0.995 \
|
|
@@ -881,6 +933,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 881 |
--data_replay_freq -1 \
|
| 882 |
--mlp_hidden_dim 100 \
|
| 883 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 884 |
--routing_mode learned \
|
| 885 |
--threshold 0.995 \
|
| 886 |
--transthreshold 0.995 \
|
|
@@ -940,6 +996,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 940 |
--data_replay_freq -1 \
|
| 941 |
--mlp_hidden_dim 100 \
|
| 942 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 943 |
--routing_mode learned \
|
| 944 |
--threshold 0.995 \
|
| 945 |
--transthreshold 0.995 \
|
|
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
| 117 |
+
--cpi_gamma 0.5 \
|
| 118 |
+
--oap_eta 0.5 \
|
| 119 |
+
--oap_beta_min 0.3 \
|
| 120 |
+
--oap_warmup 3 \
|
| 121 |
--routing_mode learned \
|
| 122 |
--threshold 0.995 \
|
| 123 |
--transthreshold 0.995 \
|
|
|
|
| 177 |
--data_replay_freq -1 \
|
| 178 |
--mlp_hidden_dim 100 \
|
| 179 |
--model_name specroute \
|
| 180 |
+
--cpi_gamma 0.5 \
|
| 181 |
+
--oap_eta 0.5 \
|
| 182 |
+
--oap_beta_min 0.3 \
|
| 183 |
+
--oap_warmup 3 \
|
| 184 |
--routing_mode learned \
|
| 185 |
--threshold 0.995 \
|
| 186 |
--transthreshold 0.995 \
|
|
|
|
| 240 |
--data_replay_freq -1 \
|
| 241 |
--mlp_hidden_dim 100 \
|
| 242 |
--model_name specroute \
|
| 243 |
+
--cpi_gamma 0.5 \
|
| 244 |
+
--oap_eta 0.5 \
|
| 245 |
+
--oap_beta_min 0.3 \
|
| 246 |
+
--oap_warmup 3 \
|
| 247 |
--routing_mode learned \
|
| 248 |
--threshold 0.995 \
|
| 249 |
--transthreshold 0.995 \
|
|
|
|
| 303 |
--data_replay_freq -1 \
|
| 304 |
--mlp_hidden_dim 100 \
|
| 305 |
--model_name specroute \
|
| 306 |
+
--cpi_gamma 0.5 \
|
| 307 |
+
--oap_eta 0.5 \
|
| 308 |
+
--oap_beta_min 0.3 \
|
| 309 |
+
--oap_warmup 3 \
|
| 310 |
--routing_mode learned \
|
| 311 |
--threshold 0.995 \
|
| 312 |
--transthreshold 0.995 \
|
|
|
|
| 366 |
--data_replay_freq -1 \
|
| 367 |
--mlp_hidden_dim 100 \
|
| 368 |
--model_name specroute \
|
| 369 |
+
--cpi_gamma 0.5 \
|
| 370 |
+
--oap_eta 0.5 \
|
| 371 |
+
--oap_beta_min 0.3 \
|
| 372 |
+
--oap_warmup 3 \
|
| 373 |
--routing_mode learned \
|
| 374 |
--threshold 0.995 \
|
| 375 |
--transthreshold 0.995 \
|
|
|
|
| 429 |
--data_replay_freq -1 \
|
| 430 |
--mlp_hidden_dim 100 \
|
| 431 |
--model_name specroute \
|
| 432 |
+
--cpi_gamma 0.5 \
|
| 433 |
+
--oap_eta 0.5 \
|
| 434 |
+
--oap_beta_min 0.3 \
|
| 435 |
+
--oap_warmup 3 \
|
| 436 |
--routing_mode learned \
|
| 437 |
--threshold 0.995 \
|
| 438 |
--transthreshold 0.995 \
|
|
|
|
| 492 |
--data_replay_freq -1 \
|
| 493 |
--mlp_hidden_dim 100 \
|
| 494 |
--model_name specroute \
|
| 495 |
+
--cpi_gamma 0.5 \
|
| 496 |
+
--oap_eta 0.5 \
|
| 497 |
+
--oap_beta_min 0.3 \
|
| 498 |
+
--oap_warmup 3 \
|
| 499 |
--routing_mode learned \
|
| 500 |
--threshold 0.995 \
|
| 501 |
--transthreshold 0.995 \
|
|
|
|
| 555 |
--data_replay_freq -1 \
|
| 556 |
--mlp_hidden_dim 100 \
|
| 557 |
--model_name specroute \
|
| 558 |
+
--cpi_gamma 0.5 \
|
| 559 |
+
--oap_eta 0.5 \
|
| 560 |
+
--oap_beta_min 0.3 \
|
| 561 |
+
--oap_warmup 3 \
|
| 562 |
--routing_mode learned \
|
| 563 |
--threshold 0.995 \
|
| 564 |
--transthreshold 0.995 \
|
|
|
|
| 618 |
--data_replay_freq -1 \
|
| 619 |
--mlp_hidden_dim 100 \
|
| 620 |
--model_name specroute \
|
| 621 |
+
--cpi_gamma 0.5 \
|
| 622 |
+
--oap_eta 0.5 \
|
| 623 |
+
--oap_beta_min 0.3 \
|
| 624 |
+
--oap_warmup 3 \
|
| 625 |
--routing_mode learned \
|
| 626 |
--threshold 0.995 \
|
| 627 |
--transthreshold 0.995 \
|
|
|
|
| 681 |
--data_replay_freq -1 \
|
| 682 |
--mlp_hidden_dim 100 \
|
| 683 |
--model_name specroute \
|
| 684 |
+
--cpi_gamma 0.5 \
|
| 685 |
+
--oap_eta 0.5 \
|
| 686 |
+
--oap_beta_min 0.3 \
|
| 687 |
+
--oap_warmup 3 \
|
| 688 |
--routing_mode learned \
|
| 689 |
--threshold 0.995 \
|
| 690 |
--transthreshold 0.995 \
|
|
|
|
| 744 |
--data_replay_freq -1 \
|
| 745 |
--mlp_hidden_dim 100 \
|
| 746 |
--model_name specroute \
|
| 747 |
+
--cpi_gamma 0.5 \
|
| 748 |
+
--oap_eta 0.5 \
|
| 749 |
+
--oap_beta_min 0.3 \
|
| 750 |
+
--oap_warmup 3 \
|
| 751 |
--routing_mode learned \
|
| 752 |
--threshold 0.995 \
|
| 753 |
--transthreshold 0.995 \
|
|
|
|
| 807 |
--data_replay_freq -1 \
|
| 808 |
--mlp_hidden_dim 100 \
|
| 809 |
--model_name specroute \
|
| 810 |
+
--cpi_gamma 0.5 \
|
| 811 |
+
--oap_eta 0.5 \
|
| 812 |
+
--oap_beta_min 0.3 \
|
| 813 |
+
--oap_warmup 3 \
|
| 814 |
--routing_mode learned \
|
| 815 |
--threshold 0.995 \
|
| 816 |
--transthreshold 0.995 \
|
|
|
|
| 870 |
--data_replay_freq -1 \
|
| 871 |
--mlp_hidden_dim 100 \
|
| 872 |
--model_name specroute \
|
| 873 |
+
--cpi_gamma 0.5 \
|
| 874 |
+
--oap_eta 0.5 \
|
| 875 |
+
--oap_beta_min 0.3 \
|
| 876 |
+
--oap_warmup 3 \
|
| 877 |
--routing_mode learned \
|
| 878 |
--threshold 0.995 \
|
| 879 |
--transthreshold 0.995 \
|
|
|
|
| 933 |
--data_replay_freq -1 \
|
| 934 |
--mlp_hidden_dim 100 \
|
| 935 |
--model_name specroute \
|
| 936 |
+
--cpi_gamma 0.5 \
|
| 937 |
+
--oap_eta 0.5 \
|
| 938 |
+
--oap_beta_min 0.3 \
|
| 939 |
+
--oap_warmup 3 \
|
| 940 |
--routing_mode learned \
|
| 941 |
--threshold 0.995 \
|
| 942 |
--transthreshold 0.995 \
|
|
|
|
| 996 |
--data_replay_freq -1 \
|
| 997 |
--mlp_hidden_dim 100 \
|
| 998 |
--model_name specroute \
|
| 999 |
+
--cpi_gamma 0.5 \
|
| 1000 |
+
--oap_eta 0.5 \
|
| 1001 |
+
--oap_beta_min 0.3 \
|
| 1002 |
+
--oap_warmup 3 \
|
| 1003 |
--routing_mode learned \
|
| 1004 |
--threshold 0.995 \
|
| 1005 |
--transthreshold 0.995 \
|
improve_gainlora/T5_small/gen_script_long_order3_t5_small_specroute_v10b.sh
CHANGED
|
@@ -114,6 +114,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
--routing_mode grassmann \
|
| 118 |
--threshold 0.995 \
|
| 119 |
--transthreshold 0.995 \
|
|
@@ -171,6 +175,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 171 |
--data_replay_freq -1 \
|
| 172 |
--mlp_hidden_dim 100 \
|
| 173 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
--routing_mode grassmann \
|
| 175 |
--threshold 0.995 \
|
| 176 |
--transthreshold 0.995 \
|
|
@@ -228,6 +236,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 228 |
--data_replay_freq -1 \
|
| 229 |
--mlp_hidden_dim 100 \
|
| 230 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
--routing_mode grassmann \
|
| 232 |
--threshold 0.995 \
|
| 233 |
--transthreshold 0.995 \
|
|
@@ -285,6 +297,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 285 |
--data_replay_freq -1 \
|
| 286 |
--mlp_hidden_dim 100 \
|
| 287 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
--routing_mode grassmann \
|
| 289 |
--threshold 0.995 \
|
| 290 |
--transthreshold 0.995 \
|
|
@@ -342,6 +358,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 342 |
--data_replay_freq -1 \
|
| 343 |
--mlp_hidden_dim 100 \
|
| 344 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
--routing_mode grassmann \
|
| 346 |
--threshold 0.995 \
|
| 347 |
--transthreshold 0.995 \
|
|
@@ -399,6 +419,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 399 |
--data_replay_freq -1 \
|
| 400 |
--mlp_hidden_dim 100 \
|
| 401 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
--routing_mode grassmann \
|
| 403 |
--threshold 0.995 \
|
| 404 |
--transthreshold 0.995 \
|
|
@@ -456,6 +480,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 456 |
--data_replay_freq -1 \
|
| 457 |
--mlp_hidden_dim 100 \
|
| 458 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 459 |
--routing_mode grassmann \
|
| 460 |
--threshold 0.995 \
|
| 461 |
--transthreshold 0.995 \
|
|
@@ -513,6 +541,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 513 |
--data_replay_freq -1 \
|
| 514 |
--mlp_hidden_dim 100 \
|
| 515 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 516 |
--routing_mode grassmann \
|
| 517 |
--threshold 0.995 \
|
| 518 |
--transthreshold 0.995 \
|
|
@@ -570,6 +602,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 570 |
--data_replay_freq -1 \
|
| 571 |
--mlp_hidden_dim 100 \
|
| 572 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 573 |
--routing_mode grassmann \
|
| 574 |
--threshold 0.995 \
|
| 575 |
--transthreshold 0.995 \
|
|
@@ -627,6 +663,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 627 |
--data_replay_freq -1 \
|
| 628 |
--mlp_hidden_dim 100 \
|
| 629 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 630 |
--routing_mode grassmann \
|
| 631 |
--threshold 0.995 \
|
| 632 |
--transthreshold 0.995 \
|
|
@@ -684,6 +724,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 684 |
--data_replay_freq -1 \
|
| 685 |
--mlp_hidden_dim 100 \
|
| 686 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 687 |
--routing_mode grassmann \
|
| 688 |
--threshold 0.995 \
|
| 689 |
--transthreshold 0.995 \
|
|
@@ -741,6 +785,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 741 |
--data_replay_freq -1 \
|
| 742 |
--mlp_hidden_dim 100 \
|
| 743 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 744 |
--routing_mode grassmann \
|
| 745 |
--threshold 0.995 \
|
| 746 |
--transthreshold 0.995 \
|
|
@@ -798,6 +846,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 798 |
--data_replay_freq -1 \
|
| 799 |
--mlp_hidden_dim 100 \
|
| 800 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 801 |
--routing_mode grassmann \
|
| 802 |
--threshold 0.995 \
|
| 803 |
--transthreshold 0.995 \
|
|
@@ -855,6 +907,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 855 |
--data_replay_freq -1 \
|
| 856 |
--mlp_hidden_dim 100 \
|
| 857 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 858 |
--routing_mode grassmann \
|
| 859 |
--threshold 0.995 \
|
| 860 |
--transthreshold 0.995 \
|
|
@@ -912,6 +968,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 912 |
--data_replay_freq -1 \
|
| 913 |
--mlp_hidden_dim 100 \
|
| 914 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 915 |
--routing_mode grassmann \
|
| 916 |
--threshold 0.995 \
|
| 917 |
--transthreshold 0.995 \
|
|
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
| 117 |
+
--cpi_gamma 0.5 \
|
| 118 |
+
--oap_eta 0.5 \
|
| 119 |
+
--oap_beta_min 0.3 \
|
| 120 |
+
--oap_warmup 3 \
|
| 121 |
--routing_mode grassmann \
|
| 122 |
--threshold 0.995 \
|
| 123 |
--transthreshold 0.995 \
|
|
|
|
| 175 |
--data_replay_freq -1 \
|
| 176 |
--mlp_hidden_dim 100 \
|
| 177 |
--model_name specroute \
|
| 178 |
+
--cpi_gamma 0.5 \
|
| 179 |
+
--oap_eta 0.5 \
|
| 180 |
+
--oap_beta_min 0.3 \
|
| 181 |
+
--oap_warmup 3 \
|
| 182 |
--routing_mode grassmann \
|
| 183 |
--threshold 0.995 \
|
| 184 |
--transthreshold 0.995 \
|
|
|
|
| 236 |
--data_replay_freq -1 \
|
| 237 |
--mlp_hidden_dim 100 \
|
| 238 |
--model_name specroute \
|
| 239 |
+
--cpi_gamma 0.5 \
|
| 240 |
+
--oap_eta 0.5 \
|
| 241 |
+
--oap_beta_min 0.3 \
|
| 242 |
+
--oap_warmup 3 \
|
| 243 |
--routing_mode grassmann \
|
| 244 |
--threshold 0.995 \
|
| 245 |
--transthreshold 0.995 \
|
|
|
|
| 297 |
--data_replay_freq -1 \
|
| 298 |
--mlp_hidden_dim 100 \
|
| 299 |
--model_name specroute \
|
| 300 |
+
--cpi_gamma 0.5 \
|
| 301 |
+
--oap_eta 0.5 \
|
| 302 |
+
--oap_beta_min 0.3 \
|
| 303 |
+
--oap_warmup 3 \
|
| 304 |
--routing_mode grassmann \
|
| 305 |
--threshold 0.995 \
|
| 306 |
--transthreshold 0.995 \
|
|
|
|
| 358 |
--data_replay_freq -1 \
|
| 359 |
--mlp_hidden_dim 100 \
|
| 360 |
--model_name specroute \
|
| 361 |
+
--cpi_gamma 0.5 \
|
| 362 |
+
--oap_eta 0.5 \
|
| 363 |
+
--oap_beta_min 0.3 \
|
| 364 |
+
--oap_warmup 3 \
|
| 365 |
--routing_mode grassmann \
|
| 366 |
--threshold 0.995 \
|
| 367 |
--transthreshold 0.995 \
|
|
|
|
| 419 |
--data_replay_freq -1 \
|
| 420 |
--mlp_hidden_dim 100 \
|
| 421 |
--model_name specroute \
|
| 422 |
+
--cpi_gamma 0.5 \
|
| 423 |
+
--oap_eta 0.5 \
|
| 424 |
+
--oap_beta_min 0.3 \
|
| 425 |
+
--oap_warmup 3 \
|
| 426 |
--routing_mode grassmann \
|
| 427 |
--threshold 0.995 \
|
| 428 |
--transthreshold 0.995 \
|
|
|
|
| 480 |
--data_replay_freq -1 \
|
| 481 |
--mlp_hidden_dim 100 \
|
| 482 |
--model_name specroute \
|
| 483 |
+
--cpi_gamma 0.5 \
|
| 484 |
+
--oap_eta 0.5 \
|
| 485 |
+
--oap_beta_min 0.3 \
|
| 486 |
+
--oap_warmup 3 \
|
| 487 |
--routing_mode grassmann \
|
| 488 |
--threshold 0.995 \
|
| 489 |
--transthreshold 0.995 \
|
|
|
|
| 541 |
--data_replay_freq -1 \
|
| 542 |
--mlp_hidden_dim 100 \
|
| 543 |
--model_name specroute \
|
| 544 |
+
--cpi_gamma 0.5 \
|
| 545 |
+
--oap_eta 0.5 \
|
| 546 |
+
--oap_beta_min 0.3 \
|
| 547 |
+
--oap_warmup 3 \
|
| 548 |
--routing_mode grassmann \
|
| 549 |
--threshold 0.995 \
|
| 550 |
--transthreshold 0.995 \
|
|
|
|
| 602 |
--data_replay_freq -1 \
|
| 603 |
--mlp_hidden_dim 100 \
|
| 604 |
--model_name specroute \
|
| 605 |
+
--cpi_gamma 0.5 \
|
| 606 |
+
--oap_eta 0.5 \
|
| 607 |
+
--oap_beta_min 0.3 \
|
| 608 |
+
--oap_warmup 3 \
|
| 609 |
--routing_mode grassmann \
|
| 610 |
--threshold 0.995 \
|
| 611 |
--transthreshold 0.995 \
|
|
|
|
| 663 |
--data_replay_freq -1 \
|
| 664 |
--mlp_hidden_dim 100 \
|
| 665 |
--model_name specroute \
|
| 666 |
+
--cpi_gamma 0.5 \
|
| 667 |
+
--oap_eta 0.5 \
|
| 668 |
+
--oap_beta_min 0.3 \
|
| 669 |
+
--oap_warmup 3 \
|
| 670 |
--routing_mode grassmann \
|
| 671 |
--threshold 0.995 \
|
| 672 |
--transthreshold 0.995 \
|
|
|
|
| 724 |
--data_replay_freq -1 \
|
| 725 |
--mlp_hidden_dim 100 \
|
| 726 |
--model_name specroute \
|
| 727 |
+
--cpi_gamma 0.5 \
|
| 728 |
+
--oap_eta 0.5 \
|
| 729 |
+
--oap_beta_min 0.3 \
|
| 730 |
+
--oap_warmup 3 \
|
| 731 |
--routing_mode grassmann \
|
| 732 |
--threshold 0.995 \
|
| 733 |
--transthreshold 0.995 \
|
|
|
|
| 785 |
--data_replay_freq -1 \
|
| 786 |
--mlp_hidden_dim 100 \
|
| 787 |
--model_name specroute \
|
| 788 |
+
--cpi_gamma 0.5 \
|
| 789 |
+
--oap_eta 0.5 \
|
| 790 |
+
--oap_beta_min 0.3 \
|
| 791 |
+
--oap_warmup 3 \
|
| 792 |
--routing_mode grassmann \
|
| 793 |
--threshold 0.995 \
|
| 794 |
--transthreshold 0.995 \
|
|
|
|
| 846 |
--data_replay_freq -1 \
|
| 847 |
--mlp_hidden_dim 100 \
|
| 848 |
--model_name specroute \
|
| 849 |
+
--cpi_gamma 0.5 \
|
| 850 |
+
--oap_eta 0.5 \
|
| 851 |
+
--oap_beta_min 0.3 \
|
| 852 |
+
--oap_warmup 3 \
|
| 853 |
--routing_mode grassmann \
|
| 854 |
--threshold 0.995 \
|
| 855 |
--transthreshold 0.995 \
|
|
|
|
| 907 |
--data_replay_freq -1 \
|
| 908 |
--mlp_hidden_dim 100 \
|
| 909 |
--model_name specroute \
|
| 910 |
+
--cpi_gamma 0.5 \
|
| 911 |
+
--oap_eta 0.5 \
|
| 912 |
+
--oap_beta_min 0.3 \
|
| 913 |
+
--oap_warmup 3 \
|
| 914 |
--routing_mode grassmann \
|
| 915 |
--threshold 0.995 \
|
| 916 |
--transthreshold 0.995 \
|
|
|
|
| 968 |
--data_replay_freq -1 \
|
| 969 |
--mlp_hidden_dim 100 \
|
| 970 |
--model_name specroute \
|
| 971 |
+
--cpi_gamma 0.5 \
|
| 972 |
+
--oap_eta 0.5 \
|
| 973 |
+
--oap_beta_min 0.3 \
|
| 974 |
+
--oap_warmup 3 \
|
| 975 |
--routing_mode grassmann \
|
| 976 |
--threshold 0.995 \
|
| 977 |
--transthreshold 0.995 \
|
improve_gainlora/T5_small/gen_script_long_order3_t5_small_specroute_v11.sh
CHANGED
|
@@ -114,6 +114,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
--routing_mode learned \
|
| 118 |
--threshold 0.995 \
|
| 119 |
--transthreshold 0.995 \
|
|
@@ -173,6 +177,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 173 |
--data_replay_freq -1 \
|
| 174 |
--mlp_hidden_dim 100 \
|
| 175 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
--routing_mode learned \
|
| 177 |
--threshold 0.995 \
|
| 178 |
--transthreshold 0.995 \
|
|
@@ -232,6 +240,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 232 |
--data_replay_freq -1 \
|
| 233 |
--mlp_hidden_dim 100 \
|
| 234 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
--routing_mode learned \
|
| 236 |
--threshold 0.995 \
|
| 237 |
--transthreshold 0.995 \
|
|
@@ -291,6 +303,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 291 |
--data_replay_freq -1 \
|
| 292 |
--mlp_hidden_dim 100 \
|
| 293 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
--routing_mode learned \
|
| 295 |
--threshold 0.995 \
|
| 296 |
--transthreshold 0.995 \
|
|
@@ -350,6 +366,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 350 |
--data_replay_freq -1 \
|
| 351 |
--mlp_hidden_dim 100 \
|
| 352 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 353 |
--routing_mode learned \
|
| 354 |
--threshold 0.995 \
|
| 355 |
--transthreshold 0.995 \
|
|
@@ -409,6 +429,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 409 |
--data_replay_freq -1 \
|
| 410 |
--mlp_hidden_dim 100 \
|
| 411 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
--routing_mode learned \
|
| 413 |
--threshold 0.995 \
|
| 414 |
--transthreshold 0.995 \
|
|
@@ -468,6 +492,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 468 |
--data_replay_freq -1 \
|
| 469 |
--mlp_hidden_dim 100 \
|
| 470 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 471 |
--routing_mode learned \
|
| 472 |
--threshold 0.995 \
|
| 473 |
--transthreshold 0.995 \
|
|
@@ -527,6 +555,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 527 |
--data_replay_freq -1 \
|
| 528 |
--mlp_hidden_dim 100 \
|
| 529 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 530 |
--routing_mode learned \
|
| 531 |
--threshold 0.995 \
|
| 532 |
--transthreshold 0.995 \
|
|
@@ -586,6 +618,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 586 |
--data_replay_freq -1 \
|
| 587 |
--mlp_hidden_dim 100 \
|
| 588 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
--routing_mode learned \
|
| 590 |
--threshold 0.995 \
|
| 591 |
--transthreshold 0.995 \
|
|
@@ -645,6 +681,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 645 |
--data_replay_freq -1 \
|
| 646 |
--mlp_hidden_dim 100 \
|
| 647 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 648 |
--routing_mode learned \
|
| 649 |
--threshold 0.995 \
|
| 650 |
--transthreshold 0.995 \
|
|
@@ -704,6 +744,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 704 |
--data_replay_freq -1 \
|
| 705 |
--mlp_hidden_dim 100 \
|
| 706 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 707 |
--routing_mode learned \
|
| 708 |
--threshold 0.995 \
|
| 709 |
--transthreshold 0.995 \
|
|
@@ -763,6 +807,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 763 |
--data_replay_freq -1 \
|
| 764 |
--mlp_hidden_dim 100 \
|
| 765 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 766 |
--routing_mode learned \
|
| 767 |
--threshold 0.995 \
|
| 768 |
--transthreshold 0.995 \
|
|
@@ -822,6 +870,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 822 |
--data_replay_freq -1 \
|
| 823 |
--mlp_hidden_dim 100 \
|
| 824 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 825 |
--routing_mode learned \
|
| 826 |
--threshold 0.995 \
|
| 827 |
--transthreshold 0.995 \
|
|
@@ -881,6 +933,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 881 |
--data_replay_freq -1 \
|
| 882 |
--mlp_hidden_dim 100 \
|
| 883 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 884 |
--routing_mode learned \
|
| 885 |
--threshold 0.995 \
|
| 886 |
--transthreshold 0.995 \
|
|
@@ -940,6 +996,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 940 |
--data_replay_freq -1 \
|
| 941 |
--mlp_hidden_dim 100 \
|
| 942 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 943 |
--routing_mode learned \
|
| 944 |
--threshold 0.995 \
|
| 945 |
--transthreshold 0.995 \
|
|
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
| 117 |
+
--cpi_gamma 0.5 \
|
| 118 |
+
--oap_eta 0.5 \
|
| 119 |
+
--oap_beta_min 0.3 \
|
| 120 |
+
--oap_warmup 3 \
|
| 121 |
--routing_mode learned \
|
| 122 |
--threshold 0.995 \
|
| 123 |
--transthreshold 0.995 \
|
|
|
|
| 177 |
--data_replay_freq -1 \
|
| 178 |
--mlp_hidden_dim 100 \
|
| 179 |
--model_name specroute \
|
| 180 |
+
--cpi_gamma 0.5 \
|
| 181 |
+
--oap_eta 0.5 \
|
| 182 |
+
--oap_beta_min 0.3 \
|
| 183 |
+
--oap_warmup 3 \
|
| 184 |
--routing_mode learned \
|
| 185 |
--threshold 0.995 \
|
| 186 |
--transthreshold 0.995 \
|
|
|
|
| 240 |
--data_replay_freq -1 \
|
| 241 |
--mlp_hidden_dim 100 \
|
| 242 |
--model_name specroute \
|
| 243 |
+
--cpi_gamma 0.5 \
|
| 244 |
+
--oap_eta 0.5 \
|
| 245 |
+
--oap_beta_min 0.3 \
|
| 246 |
+
--oap_warmup 3 \
|
| 247 |
--routing_mode learned \
|
| 248 |
--threshold 0.995 \
|
| 249 |
--transthreshold 0.995 \
|
|
|
|
| 303 |
--data_replay_freq -1 \
|
| 304 |
--mlp_hidden_dim 100 \
|
| 305 |
--model_name specroute \
|
| 306 |
+
--cpi_gamma 0.5 \
|
| 307 |
+
--oap_eta 0.5 \
|
| 308 |
+
--oap_beta_min 0.3 \
|
| 309 |
+
--oap_warmup 3 \
|
| 310 |
--routing_mode learned \
|
| 311 |
--threshold 0.995 \
|
| 312 |
--transthreshold 0.995 \
|
|
|
|
| 366 |
--data_replay_freq -1 \
|
| 367 |
--mlp_hidden_dim 100 \
|
| 368 |
--model_name specroute \
|
| 369 |
+
--cpi_gamma 0.5 \
|
| 370 |
+
--oap_eta 0.5 \
|
| 371 |
+
--oap_beta_min 0.3 \
|
| 372 |
+
--oap_warmup 3 \
|
| 373 |
--routing_mode learned \
|
| 374 |
--threshold 0.995 \
|
| 375 |
--transthreshold 0.995 \
|
|
|
|
| 429 |
--data_replay_freq -1 \
|
| 430 |
--mlp_hidden_dim 100 \
|
| 431 |
--model_name specroute \
|
| 432 |
+
--cpi_gamma 0.5 \
|
| 433 |
+
--oap_eta 0.5 \
|
| 434 |
+
--oap_beta_min 0.3 \
|
| 435 |
+
--oap_warmup 3 \
|
| 436 |
--routing_mode learned \
|
| 437 |
--threshold 0.995 \
|
| 438 |
--transthreshold 0.995 \
|
|
|
|
| 492 |
--data_replay_freq -1 \
|
| 493 |
--mlp_hidden_dim 100 \
|
| 494 |
--model_name specroute \
|
| 495 |
+
--cpi_gamma 0.5 \
|
| 496 |
+
--oap_eta 0.5 \
|
| 497 |
+
--oap_beta_min 0.3 \
|
| 498 |
+
--oap_warmup 3 \
|
| 499 |
--routing_mode learned \
|
| 500 |
--threshold 0.995 \
|
| 501 |
--transthreshold 0.995 \
|
|
|
|
| 555 |
--data_replay_freq -1 \
|
| 556 |
--mlp_hidden_dim 100 \
|
| 557 |
--model_name specroute \
|
| 558 |
+
--cpi_gamma 0.5 \
|
| 559 |
+
--oap_eta 0.5 \
|
| 560 |
+
--oap_beta_min 0.3 \
|
| 561 |
+
--oap_warmup 3 \
|
| 562 |
--routing_mode learned \
|
| 563 |
--threshold 0.995 \
|
| 564 |
--transthreshold 0.995 \
|
|
|
|
| 618 |
--data_replay_freq -1 \
|
| 619 |
--mlp_hidden_dim 100 \
|
| 620 |
--model_name specroute \
|
| 621 |
+
--cpi_gamma 0.5 \
|
| 622 |
+
--oap_eta 0.5 \
|
| 623 |
+
--oap_beta_min 0.3 \
|
| 624 |
+
--oap_warmup 3 \
|
| 625 |
--routing_mode learned \
|
| 626 |
--threshold 0.995 \
|
| 627 |
--transthreshold 0.995 \
|
|
|
|
| 681 |
--data_replay_freq -1 \
|
| 682 |
--mlp_hidden_dim 100 \
|
| 683 |
--model_name specroute \
|
| 684 |
+
--cpi_gamma 0.5 \
|
| 685 |
+
--oap_eta 0.5 \
|
| 686 |
+
--oap_beta_min 0.3 \
|
| 687 |
+
--oap_warmup 3 \
|
| 688 |
--routing_mode learned \
|
| 689 |
--threshold 0.995 \
|
| 690 |
--transthreshold 0.995 \
|
|
|
|
| 744 |
--data_replay_freq -1 \
|
| 745 |
--mlp_hidden_dim 100 \
|
| 746 |
--model_name specroute \
|
| 747 |
+
--cpi_gamma 0.5 \
|
| 748 |
+
--oap_eta 0.5 \
|
| 749 |
+
--oap_beta_min 0.3 \
|
| 750 |
+
--oap_warmup 3 \
|
| 751 |
--routing_mode learned \
|
| 752 |
--threshold 0.995 \
|
| 753 |
--transthreshold 0.995 \
|
|
|
|
| 807 |
--data_replay_freq -1 \
|
| 808 |
--mlp_hidden_dim 100 \
|
| 809 |
--model_name specroute \
|
| 810 |
+
--cpi_gamma 0.5 \
|
| 811 |
+
--oap_eta 0.5 \
|
| 812 |
+
--oap_beta_min 0.3 \
|
| 813 |
+
--oap_warmup 3 \
|
| 814 |
--routing_mode learned \
|
| 815 |
--threshold 0.995 \
|
| 816 |
--transthreshold 0.995 \
|
|
|
|
| 870 |
--data_replay_freq -1 \
|
| 871 |
--mlp_hidden_dim 100 \
|
| 872 |
--model_name specroute \
|
| 873 |
+
--cpi_gamma 0.5 \
|
| 874 |
+
--oap_eta 0.5 \
|
| 875 |
+
--oap_beta_min 0.3 \
|
| 876 |
+
--oap_warmup 3 \
|
| 877 |
--routing_mode learned \
|
| 878 |
--threshold 0.995 \
|
| 879 |
--transthreshold 0.995 \
|
|
|
|
| 933 |
--data_replay_freq -1 \
|
| 934 |
--mlp_hidden_dim 100 \
|
| 935 |
--model_name specroute \
|
| 936 |
+
--cpi_gamma 0.5 \
|
| 937 |
+
--oap_eta 0.5 \
|
| 938 |
+
--oap_beta_min 0.3 \
|
| 939 |
+
--oap_warmup 3 \
|
| 940 |
--routing_mode learned \
|
| 941 |
--threshold 0.995 \
|
| 942 |
--transthreshold 0.995 \
|
|
|
|
| 996 |
--data_replay_freq -1 \
|
| 997 |
--mlp_hidden_dim 100 \
|
| 998 |
--model_name specroute \
|
| 999 |
+
--cpi_gamma 0.5 \
|
| 1000 |
+
--oap_eta 0.5 \
|
| 1001 |
+
--oap_beta_min 0.3 \
|
| 1002 |
+
--oap_warmup 3 \
|
| 1003 |
--routing_mode learned \
|
| 1004 |
--threshold 0.995 \
|
| 1005 |
--transthreshold 0.995 \
|
improve_gainlora/T5_small/gen_script_long_order4_t5_small_specroute.sh
CHANGED
|
@@ -114,6 +114,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
--threshold 0.995 \
|
| 118 |
--transthreshold 0.995 \
|
| 119 |
$FP16_FLAG
|
|
@@ -170,6 +174,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 170 |
--data_replay_freq -1 \
|
| 171 |
--mlp_hidden_dim 100 \
|
| 172 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
--threshold 0.995 \
|
| 174 |
--transthreshold 0.995 \
|
| 175 |
$FP16_FLAG
|
|
@@ -226,6 +234,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 226 |
--data_replay_freq -1 \
|
| 227 |
--mlp_hidden_dim 100 \
|
| 228 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
--threshold 0.995 \
|
| 230 |
--transthreshold 0.995 \
|
| 231 |
$FP16_FLAG
|
|
@@ -282,6 +294,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 282 |
--data_replay_freq -1 \
|
| 283 |
--mlp_hidden_dim 100 \
|
| 284 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
--threshold 0.995 \
|
| 286 |
--transthreshold 0.995 \
|
| 287 |
$FP16_FLAG
|
|
@@ -338,6 +354,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 338 |
--data_replay_freq -1 \
|
| 339 |
--mlp_hidden_dim 100 \
|
| 340 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
--threshold 0.995 \
|
| 342 |
--transthreshold 0.995 \
|
| 343 |
$FP16_FLAG
|
|
@@ -394,6 +414,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 394 |
--data_replay_freq -1 \
|
| 395 |
--mlp_hidden_dim 100 \
|
| 396 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
--threshold 0.995 \
|
| 398 |
--transthreshold 0.995 \
|
| 399 |
$FP16_FLAG
|
|
@@ -450,6 +474,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 450 |
--data_replay_freq -1 \
|
| 451 |
--mlp_hidden_dim 100 \
|
| 452 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
--threshold 0.995 \
|
| 454 |
--transthreshold 0.995 \
|
| 455 |
$FP16_FLAG
|
|
@@ -506,6 +534,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 506 |
--data_replay_freq -1 \
|
| 507 |
--mlp_hidden_dim 100 \
|
| 508 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 509 |
--threshold 0.995 \
|
| 510 |
--transthreshold 0.995 \
|
| 511 |
$FP16_FLAG
|
|
@@ -562,6 +594,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 562 |
--data_replay_freq -1 \
|
| 563 |
--mlp_hidden_dim 100 \
|
| 564 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 565 |
--threshold 0.995 \
|
| 566 |
--transthreshold 0.995 \
|
| 567 |
$FP16_FLAG
|
|
@@ -618,6 +654,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 618 |
--data_replay_freq -1 \
|
| 619 |
--mlp_hidden_dim 100 \
|
| 620 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 621 |
--threshold 0.995 \
|
| 622 |
--transthreshold 0.995 \
|
| 623 |
$FP16_FLAG
|
|
@@ -674,6 +714,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 674 |
--data_replay_freq -1 \
|
| 675 |
--mlp_hidden_dim 100 \
|
| 676 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 677 |
--threshold 0.995 \
|
| 678 |
--transthreshold 0.995 \
|
| 679 |
$FP16_FLAG
|
|
@@ -730,6 +774,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 730 |
--data_replay_freq -1 \
|
| 731 |
--mlp_hidden_dim 100 \
|
| 732 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 733 |
--threshold 0.995 \
|
| 734 |
--transthreshold 0.995 \
|
| 735 |
$FP16_FLAG
|
|
@@ -786,6 +834,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 786 |
--data_replay_freq -1 \
|
| 787 |
--mlp_hidden_dim 100 \
|
| 788 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 789 |
--threshold 0.995 \
|
| 790 |
--transthreshold 0.995 \
|
| 791 |
$FP16_FLAG
|
|
@@ -842,6 +894,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 842 |
--data_replay_freq -1 \
|
| 843 |
--mlp_hidden_dim 100 \
|
| 844 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 845 |
--threshold 0.995 \
|
| 846 |
--transthreshold 0.995 \
|
| 847 |
$FP16_FLAG
|
|
@@ -898,6 +954,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 898 |
--data_replay_freq -1 \
|
| 899 |
--mlp_hidden_dim 100 \
|
| 900 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 901 |
--threshold 0.995 \
|
| 902 |
--transthreshold 0.995 \
|
| 903 |
$FP16_FLAG
|
|
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
| 117 |
+
--cpi_gamma 0.5 \
|
| 118 |
+
--oap_eta 0.5 \
|
| 119 |
+
--oap_beta_min 0.3 \
|
| 120 |
+
--oap_warmup 3 \
|
| 121 |
--threshold 0.995 \
|
| 122 |
--transthreshold 0.995 \
|
| 123 |
$FP16_FLAG
|
|
|
|
| 174 |
--data_replay_freq -1 \
|
| 175 |
--mlp_hidden_dim 100 \
|
| 176 |
--model_name specroute \
|
| 177 |
+
--cpi_gamma 0.5 \
|
| 178 |
+
--oap_eta 0.5 \
|
| 179 |
+
--oap_beta_min 0.3 \
|
| 180 |
+
--oap_warmup 3 \
|
| 181 |
--threshold 0.995 \
|
| 182 |
--transthreshold 0.995 \
|
| 183 |
$FP16_FLAG
|
|
|
|
| 234 |
--data_replay_freq -1 \
|
| 235 |
--mlp_hidden_dim 100 \
|
| 236 |
--model_name specroute \
|
| 237 |
+
--cpi_gamma 0.5 \
|
| 238 |
+
--oap_eta 0.5 \
|
| 239 |
+
--oap_beta_min 0.3 \
|
| 240 |
+
--oap_warmup 3 \
|
| 241 |
--threshold 0.995 \
|
| 242 |
--transthreshold 0.995 \
|
| 243 |
$FP16_FLAG
|
|
|
|
| 294 |
--data_replay_freq -1 \
|
| 295 |
--mlp_hidden_dim 100 \
|
| 296 |
--model_name specroute \
|
| 297 |
+
--cpi_gamma 0.5 \
|
| 298 |
+
--oap_eta 0.5 \
|
| 299 |
+
--oap_beta_min 0.3 \
|
| 300 |
+
--oap_warmup 3 \
|
| 301 |
--threshold 0.995 \
|
| 302 |
--transthreshold 0.995 \
|
| 303 |
$FP16_FLAG
|
|
|
|
| 354 |
--data_replay_freq -1 \
|
| 355 |
--mlp_hidden_dim 100 \
|
| 356 |
--model_name specroute \
|
| 357 |
+
--cpi_gamma 0.5 \
|
| 358 |
+
--oap_eta 0.5 \
|
| 359 |
+
--oap_beta_min 0.3 \
|
| 360 |
+
--oap_warmup 3 \
|
| 361 |
--threshold 0.995 \
|
| 362 |
--transthreshold 0.995 \
|
| 363 |
$FP16_FLAG
|
|
|
|
| 414 |
--data_replay_freq -1 \
|
| 415 |
--mlp_hidden_dim 100 \
|
| 416 |
--model_name specroute \
|
| 417 |
+
--cpi_gamma 0.5 \
|
| 418 |
+
--oap_eta 0.5 \
|
| 419 |
+
--oap_beta_min 0.3 \
|
| 420 |
+
--oap_warmup 3 \
|
| 421 |
--threshold 0.995 \
|
| 422 |
--transthreshold 0.995 \
|
| 423 |
$FP16_FLAG
|
|
|
|
| 474 |
--data_replay_freq -1 \
|
| 475 |
--mlp_hidden_dim 100 \
|
| 476 |
--model_name specroute \
|
| 477 |
+
--cpi_gamma 0.5 \
|
| 478 |
+
--oap_eta 0.5 \
|
| 479 |
+
--oap_beta_min 0.3 \
|
| 480 |
+
--oap_warmup 3 \
|
| 481 |
--threshold 0.995 \
|
| 482 |
--transthreshold 0.995 \
|
| 483 |
$FP16_FLAG
|
|
|
|
| 534 |
--data_replay_freq -1 \
|
| 535 |
--mlp_hidden_dim 100 \
|
| 536 |
--model_name specroute \
|
| 537 |
+
--cpi_gamma 0.5 \
|
| 538 |
+
--oap_eta 0.5 \
|
| 539 |
+
--oap_beta_min 0.3 \
|
| 540 |
+
--oap_warmup 3 \
|
| 541 |
--threshold 0.995 \
|
| 542 |
--transthreshold 0.995 \
|
| 543 |
$FP16_FLAG
|
|
|
|
| 594 |
--data_replay_freq -1 \
|
| 595 |
--mlp_hidden_dim 100 \
|
| 596 |
--model_name specroute \
|
| 597 |
+
--cpi_gamma 0.5 \
|
| 598 |
+
--oap_eta 0.5 \
|
| 599 |
+
--oap_beta_min 0.3 \
|
| 600 |
+
--oap_warmup 3 \
|
| 601 |
--threshold 0.995 \
|
| 602 |
--transthreshold 0.995 \
|
| 603 |
$FP16_FLAG
|
|
|
|
| 654 |
--data_replay_freq -1 \
|
| 655 |
--mlp_hidden_dim 100 \
|
| 656 |
--model_name specroute \
|
| 657 |
+
--cpi_gamma 0.5 \
|
| 658 |
+
--oap_eta 0.5 \
|
| 659 |
+
--oap_beta_min 0.3 \
|
| 660 |
+
--oap_warmup 3 \
|
| 661 |
--threshold 0.995 \
|
| 662 |
--transthreshold 0.995 \
|
| 663 |
$FP16_FLAG
|
|
|
|
| 714 |
--data_replay_freq -1 \
|
| 715 |
--mlp_hidden_dim 100 \
|
| 716 |
--model_name specroute \
|
| 717 |
+
--cpi_gamma 0.5 \
|
| 718 |
+
--oap_eta 0.5 \
|
| 719 |
+
--oap_beta_min 0.3 \
|
| 720 |
+
--oap_warmup 3 \
|
| 721 |
--threshold 0.995 \
|
| 722 |
--transthreshold 0.995 \
|
| 723 |
$FP16_FLAG
|
|
|
|
| 774 |
--data_replay_freq -1 \
|
| 775 |
--mlp_hidden_dim 100 \
|
| 776 |
--model_name specroute \
|
| 777 |
+
--cpi_gamma 0.5 \
|
| 778 |
+
--oap_eta 0.5 \
|
| 779 |
+
--oap_beta_min 0.3 \
|
| 780 |
+
--oap_warmup 3 \
|
| 781 |
--threshold 0.995 \
|
| 782 |
--transthreshold 0.995 \
|
| 783 |
$FP16_FLAG
|
|
|
|
| 834 |
--data_replay_freq -1 \
|
| 835 |
--mlp_hidden_dim 100 \
|
| 836 |
--model_name specroute \
|
| 837 |
+
--cpi_gamma 0.5 \
|
| 838 |
+
--oap_eta 0.5 \
|
| 839 |
+
--oap_beta_min 0.3 \
|
| 840 |
+
--oap_warmup 3 \
|
| 841 |
--threshold 0.995 \
|
| 842 |
--transthreshold 0.995 \
|
| 843 |
$FP16_FLAG
|
|
|
|
| 894 |
--data_replay_freq -1 \
|
| 895 |
--mlp_hidden_dim 100 \
|
| 896 |
--model_name specroute \
|
| 897 |
+
--cpi_gamma 0.5 \
|
| 898 |
+
--oap_eta 0.5 \
|
| 899 |
+
--oap_beta_min 0.3 \
|
| 900 |
+
--oap_warmup 3 \
|
| 901 |
--threshold 0.995 \
|
| 902 |
--transthreshold 0.995 \
|
| 903 |
$FP16_FLAG
|
|
|
|
| 954 |
--data_replay_freq -1 \
|
| 955 |
--mlp_hidden_dim 100 \
|
| 956 |
--model_name specroute \
|
| 957 |
+
--cpi_gamma 0.5 \
|
| 958 |
+
--oap_eta 0.5 \
|
| 959 |
+
--oap_beta_min 0.3 \
|
| 960 |
+
--oap_warmup 3 \
|
| 961 |
--threshold 0.995 \
|
| 962 |
--transthreshold 0.995 \
|
| 963 |
$FP16_FLAG
|
improve_gainlora/T5_small/gen_script_superni_order1_t5_small_specroute.sh
CHANGED
|
@@ -125,6 +125,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 125 |
--data_replay_freq -1 \
|
| 126 |
--mlp_hidden_dim 100 \
|
| 127 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
--threshold 0.995 \
|
| 129 |
--transthreshold 0.995 \
|
| 130 |
$FP16_FLAG
|
|
@@ -178,6 +182,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 178 |
--data_replay_freq -1 \
|
| 179 |
--mlp_hidden_dim 100 \
|
| 180 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
--threshold 0.995 \
|
| 182 |
--transthreshold 0.995 \
|
| 183 |
$FP16_FLAG
|
|
@@ -231,6 +239,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 231 |
--data_replay_freq -1 \
|
| 232 |
--mlp_hidden_dim 100 \
|
| 233 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
--threshold 0.995 \
|
| 235 |
--transthreshold 0.995 \
|
| 236 |
$FP16_FLAG
|
|
@@ -284,6 +296,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 284 |
--data_replay_freq -1 \
|
| 285 |
--mlp_hidden_dim 100 \
|
| 286 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
--threshold 0.995 \
|
| 288 |
--transthreshold 0.995 \
|
| 289 |
$FP16_FLAG
|
|
@@ -337,6 +353,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 337 |
--data_replay_freq -1 \
|
| 338 |
--mlp_hidden_dim 100 \
|
| 339 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
--threshold 0.995 \
|
| 341 |
--transthreshold 0.995 \
|
| 342 |
$FP16_FLAG
|
|
@@ -390,6 +410,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 390 |
--data_replay_freq -1 \
|
| 391 |
--mlp_hidden_dim 100 \
|
| 392 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
--threshold 0.995 \
|
| 394 |
--transthreshold 0.995 \
|
| 395 |
$FP16_FLAG
|
|
@@ -443,6 +467,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 443 |
--data_replay_freq -1 \
|
| 444 |
--mlp_hidden_dim 100 \
|
| 445 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
--threshold 0.995 \
|
| 447 |
--transthreshold 0.995 \
|
| 448 |
$FP16_FLAG
|
|
@@ -496,6 +524,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 496 |
--data_replay_freq -1 \
|
| 497 |
--mlp_hidden_dim 100 \
|
| 498 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 499 |
--threshold 0.995 \
|
| 500 |
--transthreshold 0.995 \
|
| 501 |
$FP16_FLAG
|
|
@@ -549,6 +581,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 549 |
--data_replay_freq -1 \
|
| 550 |
--mlp_hidden_dim 100 \
|
| 551 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 552 |
--threshold 0.995 \
|
| 553 |
--transthreshold 0.995 \
|
| 554 |
$FP16_FLAG
|
|
@@ -602,6 +638,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 602 |
--data_replay_freq -1 \
|
| 603 |
--mlp_hidden_dim 100 \
|
| 604 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 605 |
--threshold 0.995 \
|
| 606 |
--transthreshold 0.995 \
|
| 607 |
$FP16_FLAG
|
|
@@ -655,6 +695,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 655 |
--data_replay_freq -1 \
|
| 656 |
--mlp_hidden_dim 100 \
|
| 657 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 658 |
--threshold 0.995 \
|
| 659 |
--transthreshold 0.995 \
|
| 660 |
$FP16_FLAG
|
|
@@ -708,6 +752,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 708 |
--data_replay_freq -1 \
|
| 709 |
--mlp_hidden_dim 100 \
|
| 710 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 711 |
--threshold 0.995 \
|
| 712 |
--transthreshold 0.995 \
|
| 713 |
$FP16_FLAG
|
|
@@ -761,6 +809,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 761 |
--data_replay_freq -1 \
|
| 762 |
--mlp_hidden_dim 100 \
|
| 763 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 764 |
--threshold 0.995 \
|
| 765 |
--transthreshold 0.995 \
|
| 766 |
$FP16_FLAG
|
|
@@ -814,6 +866,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 814 |
--data_replay_freq -1 \
|
| 815 |
--mlp_hidden_dim 100 \
|
| 816 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 817 |
--threshold 0.995 \
|
| 818 |
--transthreshold 0.995 \
|
| 819 |
$FP16_FLAG
|
|
@@ -867,6 +923,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 867 |
--data_replay_freq -1 \
|
| 868 |
--mlp_hidden_dim 100 \
|
| 869 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 870 |
--threshold 0.995 \
|
| 871 |
--transthreshold 0.995 \
|
| 872 |
$FP16_FLAG
|
|
|
|
| 125 |
--data_replay_freq -1 \
|
| 126 |
--mlp_hidden_dim 100 \
|
| 127 |
--model_name specroute \
|
| 128 |
+
--cpi_gamma 0.5 \
|
| 129 |
+
--oap_eta 0.5 \
|
| 130 |
+
--oap_beta_min 0.3 \
|
| 131 |
+
--oap_warmup 3 \
|
| 132 |
--threshold 0.995 \
|
| 133 |
--transthreshold 0.995 \
|
| 134 |
$FP16_FLAG
|
|
|
|
| 182 |
--data_replay_freq -1 \
|
| 183 |
--mlp_hidden_dim 100 \
|
| 184 |
--model_name specroute \
|
| 185 |
+
--cpi_gamma 0.5 \
|
| 186 |
+
--oap_eta 0.5 \
|
| 187 |
+
--oap_beta_min 0.3 \
|
| 188 |
+
--oap_warmup 3 \
|
| 189 |
--threshold 0.995 \
|
| 190 |
--transthreshold 0.995 \
|
| 191 |
$FP16_FLAG
|
|
|
|
| 239 |
--data_replay_freq -1 \
|
| 240 |
--mlp_hidden_dim 100 \
|
| 241 |
--model_name specroute \
|
| 242 |
+
--cpi_gamma 0.5 \
|
| 243 |
+
--oap_eta 0.5 \
|
| 244 |
+
--oap_beta_min 0.3 \
|
| 245 |
+
--oap_warmup 3 \
|
| 246 |
--threshold 0.995 \
|
| 247 |
--transthreshold 0.995 \
|
| 248 |
$FP16_FLAG
|
|
|
|
| 296 |
--data_replay_freq -1 \
|
| 297 |
--mlp_hidden_dim 100 \
|
| 298 |
--model_name specroute \
|
| 299 |
+
--cpi_gamma 0.5 \
|
| 300 |
+
--oap_eta 0.5 \
|
| 301 |
+
--oap_beta_min 0.3 \
|
| 302 |
+
--oap_warmup 3 \
|
| 303 |
--threshold 0.995 \
|
| 304 |
--transthreshold 0.995 \
|
| 305 |
$FP16_FLAG
|
|
|
|
| 353 |
--data_replay_freq -1 \
|
| 354 |
--mlp_hidden_dim 100 \
|
| 355 |
--model_name specroute \
|
| 356 |
+
--cpi_gamma 0.5 \
|
| 357 |
+
--oap_eta 0.5 \
|
| 358 |
+
--oap_beta_min 0.3 \
|
| 359 |
+
--oap_warmup 3 \
|
| 360 |
--threshold 0.995 \
|
| 361 |
--transthreshold 0.995 \
|
| 362 |
$FP16_FLAG
|
|
|
|
| 410 |
--data_replay_freq -1 \
|
| 411 |
--mlp_hidden_dim 100 \
|
| 412 |
--model_name specroute \
|
| 413 |
+
--cpi_gamma 0.5 \
|
| 414 |
+
--oap_eta 0.5 \
|
| 415 |
+
--oap_beta_min 0.3 \
|
| 416 |
+
--oap_warmup 3 \
|
| 417 |
--threshold 0.995 \
|
| 418 |
--transthreshold 0.995 \
|
| 419 |
$FP16_FLAG
|
|
|
|
| 467 |
--data_replay_freq -1 \
|
| 468 |
--mlp_hidden_dim 100 \
|
| 469 |
--model_name specroute \
|
| 470 |
+
--cpi_gamma 0.5 \
|
| 471 |
+
--oap_eta 0.5 \
|
| 472 |
+
--oap_beta_min 0.3 \
|
| 473 |
+
--oap_warmup 3 \
|
| 474 |
--threshold 0.995 \
|
| 475 |
--transthreshold 0.995 \
|
| 476 |
$FP16_FLAG
|
|
|
|
| 524 |
--data_replay_freq -1 \
|
| 525 |
--mlp_hidden_dim 100 \
|
| 526 |
--model_name specroute \
|
| 527 |
+
--cpi_gamma 0.5 \
|
| 528 |
+
--oap_eta 0.5 \
|
| 529 |
+
--oap_beta_min 0.3 \
|
| 530 |
+
--oap_warmup 3 \
|
| 531 |
--threshold 0.995 \
|
| 532 |
--transthreshold 0.995 \
|
| 533 |
$FP16_FLAG
|
|
|
|
| 581 |
--data_replay_freq -1 \
|
| 582 |
--mlp_hidden_dim 100 \
|
| 583 |
--model_name specroute \
|
| 584 |
+
--cpi_gamma 0.5 \
|
| 585 |
+
--oap_eta 0.5 \
|
| 586 |
+
--oap_beta_min 0.3 \
|
| 587 |
+
--oap_warmup 3 \
|
| 588 |
--threshold 0.995 \
|
| 589 |
--transthreshold 0.995 \
|
| 590 |
$FP16_FLAG
|
|
|
|
| 638 |
--data_replay_freq -1 \
|
| 639 |
--mlp_hidden_dim 100 \
|
| 640 |
--model_name specroute \
|
| 641 |
+
--cpi_gamma 0.5 \
|
| 642 |
+
--oap_eta 0.5 \
|
| 643 |
+
--oap_beta_min 0.3 \
|
| 644 |
+
--oap_warmup 3 \
|
| 645 |
--threshold 0.995 \
|
| 646 |
--transthreshold 0.995 \
|
| 647 |
$FP16_FLAG
|
|
|
|
| 695 |
--data_replay_freq -1 \
|
| 696 |
--mlp_hidden_dim 100 \
|
| 697 |
--model_name specroute \
|
| 698 |
+
--cpi_gamma 0.5 \
|
| 699 |
+
--oap_eta 0.5 \
|
| 700 |
+
--oap_beta_min 0.3 \
|
| 701 |
+
--oap_warmup 3 \
|
| 702 |
--threshold 0.995 \
|
| 703 |
--transthreshold 0.995 \
|
| 704 |
$FP16_FLAG
|
|
|
|
| 752 |
--data_replay_freq -1 \
|
| 753 |
--mlp_hidden_dim 100 \
|
| 754 |
--model_name specroute \
|
| 755 |
+
--cpi_gamma 0.5 \
|
| 756 |
+
--oap_eta 0.5 \
|
| 757 |
+
--oap_beta_min 0.3 \
|
| 758 |
+
--oap_warmup 3 \
|
| 759 |
--threshold 0.995 \
|
| 760 |
--transthreshold 0.995 \
|
| 761 |
$FP16_FLAG
|
|
|
|
| 809 |
--data_replay_freq -1 \
|
| 810 |
--mlp_hidden_dim 100 \
|
| 811 |
--model_name specroute \
|
| 812 |
+
--cpi_gamma 0.5 \
|
| 813 |
+
--oap_eta 0.5 \
|
| 814 |
+
--oap_beta_min 0.3 \
|
| 815 |
+
--oap_warmup 3 \
|
| 816 |
--threshold 0.995 \
|
| 817 |
--transthreshold 0.995 \
|
| 818 |
$FP16_FLAG
|
|
|
|
| 866 |
--data_replay_freq -1 \
|
| 867 |
--mlp_hidden_dim 100 \
|
| 868 |
--model_name specroute \
|
| 869 |
+
--cpi_gamma 0.5 \
|
| 870 |
+
--oap_eta 0.5 \
|
| 871 |
+
--oap_beta_min 0.3 \
|
| 872 |
+
--oap_warmup 3 \
|
| 873 |
--threshold 0.995 \
|
| 874 |
--transthreshold 0.995 \
|
| 875 |
$FP16_FLAG
|
|
|
|
| 923 |
--data_replay_freq -1 \
|
| 924 |
--mlp_hidden_dim 100 \
|
| 925 |
--model_name specroute \
|
| 926 |
+
--cpi_gamma 0.5 \
|
| 927 |
+
--oap_eta 0.5 \
|
| 928 |
+
--oap_beta_min 0.3 \
|
| 929 |
+
--oap_warmup 3 \
|
| 930 |
--threshold 0.995 \
|
| 931 |
--transthreshold 0.995 \
|
| 932 |
$FP16_FLAG
|
improve_gainlora/T5_small/gen_script_superni_order2_t5_small_specroute.sh
CHANGED
|
@@ -114,6 +114,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
--threshold 0.995 \
|
| 118 |
--transthreshold 0.995 \
|
| 119 |
$FP16_FLAG
|
|
@@ -166,6 +170,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 166 |
--data_replay_freq -1 \
|
| 167 |
--mlp_hidden_dim 100 \
|
| 168 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
--threshold 0.995 \
|
| 170 |
--transthreshold 0.995 \
|
| 171 |
$FP16_FLAG
|
|
@@ -218,6 +226,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 218 |
--data_replay_freq -1 \
|
| 219 |
--mlp_hidden_dim 100 \
|
| 220 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
--threshold 0.995 \
|
| 222 |
--transthreshold 0.995 \
|
| 223 |
$FP16_FLAG
|
|
@@ -270,6 +282,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 270 |
--data_replay_freq -1 \
|
| 271 |
--mlp_hidden_dim 100 \
|
| 272 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
--threshold 0.995 \
|
| 274 |
--transthreshold 0.995 \
|
| 275 |
$FP16_FLAG
|
|
@@ -322,6 +338,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 322 |
--data_replay_freq -1 \
|
| 323 |
--mlp_hidden_dim 100 \
|
| 324 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
--threshold 0.995 \
|
| 326 |
--transthreshold 0.995 \
|
| 327 |
$FP16_FLAG
|
|
@@ -374,6 +394,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 374 |
--data_replay_freq -1 \
|
| 375 |
--mlp_hidden_dim 100 \
|
| 376 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
--threshold 0.995 \
|
| 378 |
--transthreshold 0.995 \
|
| 379 |
$FP16_FLAG
|
|
@@ -426,6 +450,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 426 |
--data_replay_freq -1 \
|
| 427 |
--mlp_hidden_dim 100 \
|
| 428 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 429 |
--threshold 0.995 \
|
| 430 |
--transthreshold 0.995 \
|
| 431 |
$FP16_FLAG
|
|
@@ -478,6 +506,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 478 |
--data_replay_freq -1 \
|
| 479 |
--mlp_hidden_dim 100 \
|
| 480 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
--threshold 0.995 \
|
| 482 |
--transthreshold 0.995 \
|
| 483 |
$FP16_FLAG
|
|
@@ -530,6 +562,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 530 |
--data_replay_freq -1 \
|
| 531 |
--mlp_hidden_dim 100 \
|
| 532 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 533 |
--threshold 0.995 \
|
| 534 |
--transthreshold 0.995 \
|
| 535 |
$FP16_FLAG
|
|
@@ -582,6 +618,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 582 |
--data_replay_freq -1 \
|
| 583 |
--mlp_hidden_dim 100 \
|
| 584 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
--threshold 0.995 \
|
| 586 |
--transthreshold 0.995 \
|
| 587 |
$FP16_FLAG
|
|
@@ -634,6 +674,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 634 |
--data_replay_freq -1 \
|
| 635 |
--mlp_hidden_dim 100 \
|
| 636 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 637 |
--threshold 0.995 \
|
| 638 |
--transthreshold 0.995 \
|
| 639 |
$FP16_FLAG
|
|
@@ -686,6 +730,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 686 |
--data_replay_freq -1 \
|
| 687 |
--mlp_hidden_dim 100 \
|
| 688 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 689 |
--threshold 0.995 \
|
| 690 |
--transthreshold 0.995 \
|
| 691 |
$FP16_FLAG
|
|
@@ -738,6 +786,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 738 |
--data_replay_freq -1 \
|
| 739 |
--mlp_hidden_dim 100 \
|
| 740 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 741 |
--threshold 0.995 \
|
| 742 |
--transthreshold 0.995 \
|
| 743 |
$FP16_FLAG
|
|
@@ -790,6 +842,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 790 |
--data_replay_freq -1 \
|
| 791 |
--mlp_hidden_dim 100 \
|
| 792 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 793 |
--threshold 0.995 \
|
| 794 |
--transthreshold 0.995 \
|
| 795 |
$FP16_FLAG
|
|
@@ -842,6 +898,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 842 |
--data_replay_freq -1 \
|
| 843 |
--mlp_hidden_dim 100 \
|
| 844 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 845 |
--threshold 0.995 \
|
| 846 |
--transthreshold 0.995 \
|
| 847 |
$FP16_FLAG
|
|
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
| 117 |
+
--cpi_gamma 0.5 \
|
| 118 |
+
--oap_eta 0.5 \
|
| 119 |
+
--oap_beta_min 0.3 \
|
| 120 |
+
--oap_warmup 3 \
|
| 121 |
--threshold 0.995 \
|
| 122 |
--transthreshold 0.995 \
|
| 123 |
$FP16_FLAG
|
|
|
|
| 170 |
--data_replay_freq -1 \
|
| 171 |
--mlp_hidden_dim 100 \
|
| 172 |
--model_name specroute \
|
| 173 |
+
--cpi_gamma 0.5 \
|
| 174 |
+
--oap_eta 0.5 \
|
| 175 |
+
--oap_beta_min 0.3 \
|
| 176 |
+
--oap_warmup 3 \
|
| 177 |
--threshold 0.995 \
|
| 178 |
--transthreshold 0.995 \
|
| 179 |
$FP16_FLAG
|
|
|
|
| 226 |
--data_replay_freq -1 \
|
| 227 |
--mlp_hidden_dim 100 \
|
| 228 |
--model_name specroute \
|
| 229 |
+
--cpi_gamma 0.5 \
|
| 230 |
+
--oap_eta 0.5 \
|
| 231 |
+
--oap_beta_min 0.3 \
|
| 232 |
+
--oap_warmup 3 \
|
| 233 |
--threshold 0.995 \
|
| 234 |
--transthreshold 0.995 \
|
| 235 |
$FP16_FLAG
|
|
|
|
| 282 |
--data_replay_freq -1 \
|
| 283 |
--mlp_hidden_dim 100 \
|
| 284 |
--model_name specroute \
|
| 285 |
+
--cpi_gamma 0.5 \
|
| 286 |
+
--oap_eta 0.5 \
|
| 287 |
+
--oap_beta_min 0.3 \
|
| 288 |
+
--oap_warmup 3 \
|
| 289 |
--threshold 0.995 \
|
| 290 |
--transthreshold 0.995 \
|
| 291 |
$FP16_FLAG
|
|
|
|
| 338 |
--data_replay_freq -1 \
|
| 339 |
--mlp_hidden_dim 100 \
|
| 340 |
--model_name specroute \
|
| 341 |
+
--cpi_gamma 0.5 \
|
| 342 |
+
--oap_eta 0.5 \
|
| 343 |
+
--oap_beta_min 0.3 \
|
| 344 |
+
--oap_warmup 3 \
|
| 345 |
--threshold 0.995 \
|
| 346 |
--transthreshold 0.995 \
|
| 347 |
$FP16_FLAG
|
|
|
|
| 394 |
--data_replay_freq -1 \
|
| 395 |
--mlp_hidden_dim 100 \
|
| 396 |
--model_name specroute \
|
| 397 |
+
--cpi_gamma 0.5 \
|
| 398 |
+
--oap_eta 0.5 \
|
| 399 |
+
--oap_beta_min 0.3 \
|
| 400 |
+
--oap_warmup 3 \
|
| 401 |
--threshold 0.995 \
|
| 402 |
--transthreshold 0.995 \
|
| 403 |
$FP16_FLAG
|
|
|
|
| 450 |
--data_replay_freq -1 \
|
| 451 |
--mlp_hidden_dim 100 \
|
| 452 |
--model_name specroute \
|
| 453 |
+
--cpi_gamma 0.5 \
|
| 454 |
+
--oap_eta 0.5 \
|
| 455 |
+
--oap_beta_min 0.3 \
|
| 456 |
+
--oap_warmup 3 \
|
| 457 |
--threshold 0.995 \
|
| 458 |
--transthreshold 0.995 \
|
| 459 |
$FP16_FLAG
|
|
|
|
| 506 |
--data_replay_freq -1 \
|
| 507 |
--mlp_hidden_dim 100 \
|
| 508 |
--model_name specroute \
|
| 509 |
+
--cpi_gamma 0.5 \
|
| 510 |
+
--oap_eta 0.5 \
|
| 511 |
+
--oap_beta_min 0.3 \
|
| 512 |
+
--oap_warmup 3 \
|
| 513 |
--threshold 0.995 \
|
| 514 |
--transthreshold 0.995 \
|
| 515 |
$FP16_FLAG
|
|
|
|
| 562 |
--data_replay_freq -1 \
|
| 563 |
--mlp_hidden_dim 100 \
|
| 564 |
--model_name specroute \
|
| 565 |
+
--cpi_gamma 0.5 \
|
| 566 |
+
--oap_eta 0.5 \
|
| 567 |
+
--oap_beta_min 0.3 \
|
| 568 |
+
--oap_warmup 3 \
|
| 569 |
--threshold 0.995 \
|
| 570 |
--transthreshold 0.995 \
|
| 571 |
$FP16_FLAG
|
|
|
|
| 618 |
--data_replay_freq -1 \
|
| 619 |
--mlp_hidden_dim 100 \
|
| 620 |
--model_name specroute \
|
| 621 |
+
--cpi_gamma 0.5 \
|
| 622 |
+
--oap_eta 0.5 \
|
| 623 |
+
--oap_beta_min 0.3 \
|
| 624 |
+
--oap_warmup 3 \
|
| 625 |
--threshold 0.995 \
|
| 626 |
--transthreshold 0.995 \
|
| 627 |
$FP16_FLAG
|
|
|
|
| 674 |
--data_replay_freq -1 \
|
| 675 |
--mlp_hidden_dim 100 \
|
| 676 |
--model_name specroute \
|
| 677 |
+
--cpi_gamma 0.5 \
|
| 678 |
+
--oap_eta 0.5 \
|
| 679 |
+
--oap_beta_min 0.3 \
|
| 680 |
+
--oap_warmup 3 \
|
| 681 |
--threshold 0.995 \
|
| 682 |
--transthreshold 0.995 \
|
| 683 |
$FP16_FLAG
|
|
|
|
| 730 |
--data_replay_freq -1 \
|
| 731 |
--mlp_hidden_dim 100 \
|
| 732 |
--model_name specroute \
|
| 733 |
+
--cpi_gamma 0.5 \
|
| 734 |
+
--oap_eta 0.5 \
|
| 735 |
+
--oap_beta_min 0.3 \
|
| 736 |
+
--oap_warmup 3 \
|
| 737 |
--threshold 0.995 \
|
| 738 |
--transthreshold 0.995 \
|
| 739 |
$FP16_FLAG
|
|
|
|
| 786 |
--data_replay_freq -1 \
|
| 787 |
--mlp_hidden_dim 100 \
|
| 788 |
--model_name specroute \
|
| 789 |
+
--cpi_gamma 0.5 \
|
| 790 |
+
--oap_eta 0.5 \
|
| 791 |
+
--oap_beta_min 0.3 \
|
| 792 |
+
--oap_warmup 3 \
|
| 793 |
--threshold 0.995 \
|
| 794 |
--transthreshold 0.995 \
|
| 795 |
$FP16_FLAG
|
|
|
|
| 842 |
--data_replay_freq -1 \
|
| 843 |
--mlp_hidden_dim 100 \
|
| 844 |
--model_name specroute \
|
| 845 |
+
--cpi_gamma 0.5 \
|
| 846 |
+
--oap_eta 0.5 \
|
| 847 |
+
--oap_beta_min 0.3 \
|
| 848 |
+
--oap_warmup 3 \
|
| 849 |
--threshold 0.995 \
|
| 850 |
--transthreshold 0.995 \
|
| 851 |
$FP16_FLAG
|
|
|
|
| 898 |
--data_replay_freq -1 \
|
| 899 |
--mlp_hidden_dim 100 \
|
| 900 |
--model_name specroute \
|
| 901 |
+
--cpi_gamma 0.5 \
|
| 902 |
+
--oap_eta 0.5 \
|
| 903 |
+
--oap_beta_min 0.3 \
|
| 904 |
+
--oap_warmup 3 \
|
| 905 |
--threshold 0.995 \
|
| 906 |
--transthreshold 0.995 \
|
| 907 |
$FP16_FLAG
|
improve_gainlora/_patch_cpi_oap.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Patch all specroute gen_scripts to add CPI+OAP parameters.
|
| 2 |
+
Usage: python _patch_cpi_oap.py [--gamma 0.5] [--eta 0.5] [--beta_min 0.3] [--warmup 3]
|
| 3 |
+
"""
|
| 4 |
+
import re, os, sys
|
| 5 |
+
|
| 6 |
+
BASE = os.path.dirname(os.path.abspath(__file__))
|
| 7 |
+
|
| 8 |
+
# Default values
|
| 9 |
+
GAMMA = 0.5
|
| 10 |
+
ETA = 0.5
|
| 11 |
+
BETA_MIN = 0.3
|
| 12 |
+
WARMUP = 3
|
| 13 |
+
|
| 14 |
+
# Parse CLI overrides
|
| 15 |
+
args = sys.argv[1:]
|
| 16 |
+
i = 0
|
| 17 |
+
while i < len(args):
|
| 18 |
+
if args[i] == '--gamma' and i + 1 < len(args):
|
| 19 |
+
GAMMA = float(args[i+1]); i += 2
|
| 20 |
+
elif args[i] == '--eta' and i + 1 < len(args):
|
| 21 |
+
ETA = float(args[i+1]); i += 2
|
| 22 |
+
elif args[i] == '--beta_min' and i + 1 < len(args):
|
| 23 |
+
BETA_MIN = float(args[i+1]); i += 2
|
| 24 |
+
elif args[i] == '--warmup' and i + 1 < len(args):
|
| 25 |
+
WARMUP = int(args[i+1]); i += 2
|
| 26 |
+
else:
|
| 27 |
+
i += 1
|
| 28 |
+
|
| 29 |
+
CPI_OAP_BLOCK = (
|
| 30 |
+
f' --cpi_gamma {GAMMA} \\\n'
|
| 31 |
+
f' --oap_eta {ETA} \\\n'
|
| 32 |
+
f' --oap_beta_min {BETA_MIN} \\\n'
|
| 33 |
+
f' --oap_warmup {WARMUP} \\\n'
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
# Find all specroute gen scripts
|
| 37 |
+
scripts = sorted([
|
| 38 |
+
os.path.join(BASE, f) for f in os.listdir(BASE)
|
| 39 |
+
if f.startswith('gen_script_') and 'specroute' in f and f.endswith('.sh')
|
| 40 |
+
])
|
| 41 |
+
|
| 42 |
+
ANCHOR = re.compile(r'( --model_name specroute \\\n)')
|
| 43 |
+
|
| 44 |
+
for script_path in scripts:
|
| 45 |
+
with open(script_path) as f:
|
| 46 |
+
content = f.read()
|
| 47 |
+
|
| 48 |
+
if '--cpi_gamma' in content:
|
| 49 |
+
# Already patched — update values
|
| 50 |
+
content = re.sub(r'--cpi_gamma [\d.]+', f'--cpi_gamma {GAMMA}', content)
|
| 51 |
+
content = re.sub(r'--oap_eta [\d.]+', f'--oap_eta {ETA}', content)
|
| 52 |
+
content = re.sub(r'--oap_beta_min [\d.]+', f'--oap_beta_min {BETA_MIN}', content)
|
| 53 |
+
content = re.sub(r'--oap_warmup \d+', f'--oap_warmup {WARMUP}', content)
|
| 54 |
+
action = 'UPDATED'
|
| 55 |
+
else:
|
| 56 |
+
# Insert CPI+OAP params after --model_name specroute
|
| 57 |
+
matches = list(ANCHOR.finditer(content))
|
| 58 |
+
if not matches:
|
| 59 |
+
print(f'SKIP (no anchor): {os.path.basename(script_path)}')
|
| 60 |
+
continue
|
| 61 |
+
# Insert after each occurrence (multiple task blocks)
|
| 62 |
+
for m in reversed(matches):
|
| 63 |
+
insert_pos = m.end()
|
| 64 |
+
content = content[:insert_pos] + CPI_OAP_BLOCK + content[insert_pos:]
|
| 65 |
+
action = 'PATCHED'
|
| 66 |
+
|
| 67 |
+
with open(script_path, 'w') as f:
|
| 68 |
+
f.write(content)
|
| 69 |
+
|
| 70 |
+
n_blocks = len(ANCHOR.findall(content)) if action == 'UPDATED' else len(matches)
|
| 71 |
+
print(f'{action} ({n_blocks} blocks): {os.path.basename(script_path)} '
|
| 72 |
+
f'[gamma={GAMMA}, eta={ETA}, beta_min={BETA_MIN}, warmup={WARMUP}]')
|
improve_gainlora/analyze_diagnostics.py
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Post-hoc diagnostic analysis for SpecRoute experiments.
|
| 3 |
+
|
| 4 |
+
Reads init_diagnostics.pt and routing_decisions.pt from each task output
|
| 5 |
+
and prints a comprehensive report.
|
| 6 |
+
|
| 7 |
+
Usage:
|
| 8 |
+
python analyze_diagnostics.py <run_name>
|
| 9 |
+
python analyze_diagnostics.py gen_script_long_order3_t5_specroute
|
| 10 |
+
|
| 11 |
+
Output:
|
| 12 |
+
Per-task CPI/OAP diagnostics (ρ_l, β_l, SSE, λ_min+, eigenvalue health)
|
| 13 |
+
Per-task routing accuracy (p_e estimate from routing decisions)
|
| 14 |
+
"""
|
| 15 |
+
import os, sys, torch, json
|
| 16 |
+
import numpy as np
|
| 17 |
+
|
| 18 |
+
def load_diag(task_dir):
|
| 19 |
+
"""Load diagnostics from a task output directory."""
|
| 20 |
+
diag_path = os.path.join(task_dir, 'init_diagnostics.pt')
|
| 21 |
+
routing_path = os.path.join(task_dir, 'saved_weights', 'routing_decisions.pt')
|
| 22 |
+
init_diag = torch.load(diag_path, map_location='cpu') if os.path.exists(diag_path) else None
|
| 23 |
+
routing = torch.load(routing_path, map_location='cpu') if os.path.exists(routing_path) else None
|
| 24 |
+
return init_diag, routing
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def analyze_init_diag(init_diag, task_name, task_idx):
|
| 28 |
+
"""Analyze CPI/OAP initialization diagnostics."""
|
| 29 |
+
if init_diag is None:
|
| 30 |
+
print(f' [INIT] No init diagnostics (task 1 or missing file)')
|
| 31 |
+
return {}
|
| 32 |
+
|
| 33 |
+
all_rho, all_beta, all_sse_b, all_sse_a = [], [], [], []
|
| 34 |
+
all_lmin, all_npos, all_ntotal = [], [], []
|
| 35 |
+
|
| 36 |
+
for layer_idx, layer_diag in enumerate(init_diag):
|
| 37 |
+
for chunk_idx, d in layer_diag.items():
|
| 38 |
+
all_rho.append(d['rho_l'])
|
| 39 |
+
all_beta.append(d['beta_l'])
|
| 40 |
+
all_sse_b.append(d['sse_before'])
|
| 41 |
+
all_sse_a.append(d['sse_after'])
|
| 42 |
+
all_lmin.append(d['lambda_min_pos_over_r'])
|
| 43 |
+
all_npos.append(d['n_pos_eigvals'])
|
| 44 |
+
all_ntotal.append(d['n_total_eigvals'])
|
| 45 |
+
|
| 46 |
+
summary = {
|
| 47 |
+
'rho_l_mean': np.mean(all_rho),
|
| 48 |
+
'rho_l_max': np.max(all_rho),
|
| 49 |
+
'beta_l_mean': np.mean(all_beta),
|
| 50 |
+
'beta_l_min': np.min(all_beta),
|
| 51 |
+
'sse_before_mean': np.mean(all_sse_b),
|
| 52 |
+
'sse_after_mean': np.mean(all_sse_a),
|
| 53 |
+
'lambda_min_pos_over_r_mean': np.mean(all_lmin),
|
| 54 |
+
'lambda_min_pos_over_r_min': np.min(all_lmin),
|
| 55 |
+
'n_pos_mean': np.mean(all_npos),
|
| 56 |
+
'n_total': all_ntotal[0] if all_ntotal else 0,
|
| 57 |
+
'n_layers': len(init_diag),
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
print(f' [INIT] ρ_l: mean={summary["rho_l_mean"]:.4f} max={summary["rho_l_max"]:.4f}')
|
| 61 |
+
print(f' β_l: mean={summary["beta_l_mean"]:.4f} min={summary["beta_l_min"]:.4f}')
|
| 62 |
+
print(f' SSE: {summary["sse_before_mean"]:.4f} → {summary["sse_after_mean"]:.4f} (OAP reduction)')
|
| 63 |
+
print(f' λ_min+/r: mean={summary["lambda_min_pos_over_r_mean"]:.6f} min={summary["lambda_min_pos_over_r_min"]:.6f} (Thm3 routing margin)')
|
| 64 |
+
print(f' Eigenvalues: {summary["n_pos_mean"]:.1f}/{summary["n_total"]} positive (avg across layers)')
|
| 65 |
+
|
| 66 |
+
# Health checks
|
| 67 |
+
if summary['lambda_min_pos_over_r_min'] < 1e-5:
|
| 68 |
+
print(f' ⚠ WARNING: λ_min+/r very small → CPI routing margin weak for some layers')
|
| 69 |
+
if summary['n_pos_mean'] < 8:
|
| 70 |
+
print(f' ⚠ WARNING: Few positive eigenvalues → CPI falling back to Kaiming on some layers')
|
| 71 |
+
|
| 72 |
+
return summary
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def analyze_routing(routing, task_name, task_idx, n_old_tasks):
|
| 76 |
+
"""Analyze routing decisions for p_e estimation."""
|
| 77 |
+
if routing is None:
|
| 78 |
+
print(f' [ROUTE] No routing data (first task or missing file)')
|
| 79 |
+
return {}
|
| 80 |
+
|
| 81 |
+
n_total = len(routing)
|
| 82 |
+
# In SpecRoute, current task is always index 0 at prediction time.
|
| 83 |
+
# But during eval, the model evaluates on the CURRENT task's test set,
|
| 84 |
+
# so correct routing = index 0 (current expert).
|
| 85 |
+
routed_to_current = (routing == 0).float().mean().item()
|
| 86 |
+
p_e = 1.0 - routed_to_current
|
| 87 |
+
|
| 88 |
+
summary = {
|
| 89 |
+
'n_samples': n_total,
|
| 90 |
+
'routed_to_current': routed_to_current,
|
| 91 |
+
'p_e': p_e,
|
| 92 |
+
'n_tasks_available': n_old_tasks + 1,
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
print(f' [ROUTE] Routed to current: {routed_to_current:.3f} ({int((routing==0).sum())}/{n_total})')
|
| 96 |
+
print(f' p_e (routing error): {p_e:.3f} (n_tasks={n_old_tasks+1})')
|
| 97 |
+
|
| 98 |
+
# Distribution
|
| 99 |
+
for t in range(n_old_tasks + 1):
|
| 100 |
+
frac = (routing == t).float().mean().item()
|
| 101 |
+
if frac > 0.001:
|
| 102 |
+
label = 'CURRENT' if t == 0 else f'old_{t}'
|
| 103 |
+
print(f' task_idx={t} ({label}): {frac:.3f}')
|
| 104 |
+
|
| 105 |
+
# Health checks
|
| 106 |
+
if p_e > 0.3:
|
| 107 |
+
print(f' ⚠ WARNING: High routing error (p_e={p_e:.3f}) — forgetting risk')
|
| 108 |
+
if p_e > 0.5:
|
| 109 |
+
print(f' 🚨 CRITICAL: Routing worse than random for 2-class! Method likely failing.')
|
| 110 |
+
|
| 111 |
+
return summary
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def main():
|
| 115 |
+
if len(sys.argv) < 2:
|
| 116 |
+
print('Usage: python analyze_diagnostics.py <run_name>')
|
| 117 |
+
print(' e.g.: python analyze_diagnostics.py gen_script_long_order3_t5_specroute')
|
| 118 |
+
sys.exit(1)
|
| 119 |
+
|
| 120 |
+
run_name = sys.argv[1]
|
| 121 |
+
base_dir = os.path.join('logs_and_outputs', run_name, 'outputs')
|
| 122 |
+
|
| 123 |
+
if not os.path.isdir(base_dir):
|
| 124 |
+
print(f'ERROR: {base_dir} not found')
|
| 125 |
+
sys.exit(1)
|
| 126 |
+
|
| 127 |
+
# Discover task directories (sorted by task index)
|
| 128 |
+
task_dirs = sorted([
|
| 129 |
+
d for d in os.listdir(base_dir)
|
| 130 |
+
if os.path.isdir(os.path.join(base_dir, d)) and d[0].isdigit()
|
| 131 |
+
], key=lambda x: int(x.split('-')[0]))
|
| 132 |
+
|
| 133 |
+
print('=' * 70)
|
| 134 |
+
print(f'SpecRoute Diagnostic Report: {run_name}')
|
| 135 |
+
print(f'Tasks found: {len(task_dirs)}')
|
| 136 |
+
print('=' * 70)
|
| 137 |
+
|
| 138 |
+
all_summaries = []
|
| 139 |
+
|
| 140 |
+
for task_dir_name in task_dirs:
|
| 141 |
+
task_dir = os.path.join(base_dir, task_dir_name)
|
| 142 |
+
task_idx = int(task_dir_name.split('-')[0])
|
| 143 |
+
task_name = '-'.join(task_dir_name.split('-')[1:])
|
| 144 |
+
|
| 145 |
+
print(f'\n--- Task {task_idx}: {task_name} ---')
|
| 146 |
+
|
| 147 |
+
# Try saved_weights subdir first, then task_dir itself
|
| 148 |
+
sw_dir = os.path.join(task_dir, 'saved_weights')
|
| 149 |
+
diag_dir = sw_dir if os.path.isdir(sw_dir) else task_dir
|
| 150 |
+
|
| 151 |
+
init_diag_path = os.path.join(diag_dir, 'init_diagnostics.pt')
|
| 152 |
+
init_diag = torch.load(init_diag_path, map_location='cpu') if os.path.exists(init_diag_path) else None
|
| 153 |
+
|
| 154 |
+
routing_path = os.path.join(diag_dir, 'routing_decisions.pt')
|
| 155 |
+
routing = torch.load(routing_path, map_location='cpu') if os.path.exists(routing_path) else None
|
| 156 |
+
|
| 157 |
+
init_summary = analyze_init_diag(init_diag, task_name, task_idx)
|
| 158 |
+
route_summary = analyze_routing(routing, task_name, task_idx, task_idx - 1)
|
| 159 |
+
|
| 160 |
+
all_summaries.append({
|
| 161 |
+
'task_idx': task_idx, 'task_name': task_name,
|
| 162 |
+
'init': init_summary, 'routing': route_summary,
|
| 163 |
+
})
|
| 164 |
+
|
| 165 |
+
# Global summary table
|
| 166 |
+
print('\n' + '=' * 70)
|
| 167 |
+
print('SUMMARY TABLE')
|
| 168 |
+
print('=' * 70)
|
| 169 |
+
print(f'{"Task":<20} {"ρ_l":>6} {"β_l":>6} {"SSE→":>10} {"λ+/r":>8} {"p_e":>6} {"n_pos":>6}')
|
| 170 |
+
print('-' * 70)
|
| 171 |
+
for s in all_summaries:
|
| 172 |
+
i = s['init']
|
| 173 |
+
r = s['routing']
|
| 174 |
+
rho = f'{i.get("rho_l_mean", 0):.3f}' if i else '-'
|
| 175 |
+
beta = f'{i.get("beta_l_mean", 0):.3f}' if i else '-'
|
| 176 |
+
sse = f'{i.get("sse_before_mean", 0):.2f}→{i.get("sse_after_mean", 0):.2f}' if i else '-'
|
| 177 |
+
lmin = f'{i.get("lambda_min_pos_over_r_mean", 0):.5f}' if i else '-'
|
| 178 |
+
pe = f'{r.get("p_e", 0):.3f}' if r else '-'
|
| 179 |
+
npos = f'{i.get("n_pos_mean", 0):.0f}' if i else '-'
|
| 180 |
+
print(f'{s["task_name"]:<20} {rho:>6} {beta:>6} {sse:>10} {lmin:>8} {pe:>6} {npos:>6}')
|
| 181 |
+
|
| 182 |
+
# Trend analysis
|
| 183 |
+
p_e_values = [s['routing'].get('p_e', None) for s in all_summaries if s['routing']]
|
| 184 |
+
if len(p_e_values) >= 3:
|
| 185 |
+
first_half = np.mean(p_e_values[:len(p_e_values)//2])
|
| 186 |
+
second_half = np.mean(p_e_values[len(p_e_values)//2:])
|
| 187 |
+
print(f'\n[TREND] p_e first half: {first_half:.3f}, second half: {second_half:.3f}')
|
| 188 |
+
if second_half > first_half * 1.5:
|
| 189 |
+
print(' ⚠ p_e increasing significantly — routing degrades with more tasks')
|
| 190 |
+
else:
|
| 191 |
+
print(' ✓ p_e stable across tasks')
|
| 192 |
+
|
| 193 |
+
lmin_values = [s['init'].get('lambda_min_pos_over_r_min', None) for s in all_summaries if s['init']]
|
| 194 |
+
if len(lmin_values) >= 3:
|
| 195 |
+
first_half = np.mean(lmin_values[:len(lmin_values)//2])
|
| 196 |
+
second_half = np.mean(lmin_values[len(lmin_values)//2:])
|
| 197 |
+
print(f'[TREND] λ_min+/r first half: {first_half:.6f}, second half: {second_half:.6f}')
|
| 198 |
+
if second_half < first_half * 0.1:
|
| 199 |
+
print(' ⚠ CPI margin collapsing — may need stronger γ or new routing approach')
|
| 200 |
+
|
| 201 |
+
print('\n' + '=' * 70)
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
if __name__ == '__main__':
|
| 205 |
+
main()
|
improve_gainlora/gen_script_long_order3_t5_specroute.sh
CHANGED
|
@@ -110,6 +110,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 110 |
--data_replay_freq -1 \
|
| 111 |
--mlp_hidden_dim 100 \
|
| 112 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
--threshold 0.995 \
|
| 114 |
--transthreshold 0.995 \
|
| 115 |
$FP16_FLAG
|
|
@@ -167,6 +171,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 167 |
--data_replay_freq -1 \
|
| 168 |
--mlp_hidden_dim 100 \
|
| 169 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
--threshold 0.995 \
|
| 171 |
--transthreshold 0.995 \
|
| 172 |
$FP16_FLAG
|
|
@@ -224,6 +232,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 224 |
--data_replay_freq -1 \
|
| 225 |
--mlp_hidden_dim 100 \
|
| 226 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
--threshold 0.995 \
|
| 228 |
--transthreshold 0.995 \
|
| 229 |
$FP16_FLAG
|
|
@@ -281,6 +293,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 281 |
--data_replay_freq -1 \
|
| 282 |
--mlp_hidden_dim 100 \
|
| 283 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
--threshold 0.995 \
|
| 285 |
--transthreshold 0.995 \
|
| 286 |
$FP16_FLAG
|
|
@@ -338,6 +354,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 338 |
--data_replay_freq -1 \
|
| 339 |
--mlp_hidden_dim 100 \
|
| 340 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
--threshold 0.995 \
|
| 342 |
--transthreshold 0.995 \
|
| 343 |
$FP16_FLAG
|
|
@@ -395,6 +415,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 395 |
--data_replay_freq -1 \
|
| 396 |
--mlp_hidden_dim 100 \
|
| 397 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
--threshold 0.995 \
|
| 399 |
--transthreshold 0.995 \
|
| 400 |
$FP16_FLAG
|
|
@@ -452,6 +476,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 452 |
--data_replay_freq -1 \
|
| 453 |
--mlp_hidden_dim 100 \
|
| 454 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
--threshold 0.995 \
|
| 456 |
--transthreshold 0.995 \
|
| 457 |
$FP16_FLAG
|
|
@@ -509,6 +537,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 509 |
--data_replay_freq -1 \
|
| 510 |
--mlp_hidden_dim 100 \
|
| 511 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 512 |
--threshold 0.995 \
|
| 513 |
--transthreshold 0.995 \
|
| 514 |
$FP16_FLAG
|
|
@@ -566,6 +598,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 566 |
--data_replay_freq -1 \
|
| 567 |
--mlp_hidden_dim 100 \
|
| 568 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 569 |
--threshold 0.995 \
|
| 570 |
--transthreshold 0.995 \
|
| 571 |
$FP16_FLAG
|
|
@@ -623,6 +659,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 623 |
--data_replay_freq -1 \
|
| 624 |
--mlp_hidden_dim 100 \
|
| 625 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 626 |
--threshold 0.995 \
|
| 627 |
--transthreshold 0.995 \
|
| 628 |
$FP16_FLAG
|
|
@@ -680,6 +720,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 680 |
--data_replay_freq -1 \
|
| 681 |
--mlp_hidden_dim 100 \
|
| 682 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 683 |
--threshold 0.995 \
|
| 684 |
--transthreshold 0.995 \
|
| 685 |
$FP16_FLAG
|
|
@@ -737,6 +781,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 737 |
--data_replay_freq -1 \
|
| 738 |
--mlp_hidden_dim 100 \
|
| 739 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 740 |
--threshold 0.995 \
|
| 741 |
--transthreshold 0.995 \
|
| 742 |
$FP16_FLAG
|
|
@@ -794,6 +842,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 794 |
--data_replay_freq -1 \
|
| 795 |
--mlp_hidden_dim 100 \
|
| 796 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 797 |
--threshold 0.995 \
|
| 798 |
--transthreshold 0.995 \
|
| 799 |
$FP16_FLAG
|
|
@@ -851,6 +903,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 851 |
--data_replay_freq -1 \
|
| 852 |
--mlp_hidden_dim 100 \
|
| 853 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 854 |
--threshold 0.995 \
|
| 855 |
--transthreshold 0.995 \
|
| 856 |
$FP16_FLAG
|
|
@@ -908,6 +964,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 908 |
--data_replay_freq -1 \
|
| 909 |
--mlp_hidden_dim 100 \
|
| 910 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 911 |
--threshold 0.995 \
|
| 912 |
--transthreshold 0.995 \
|
| 913 |
$FP16_FLAG
|
|
|
|
| 110 |
--data_replay_freq -1 \
|
| 111 |
--mlp_hidden_dim 100 \
|
| 112 |
--model_name specroute \
|
| 113 |
+
--cpi_gamma 0.5 \
|
| 114 |
+
--oap_eta 0.5 \
|
| 115 |
+
--oap_beta_min 0.3 \
|
| 116 |
+
--oap_warmup 3 \
|
| 117 |
--threshold 0.995 \
|
| 118 |
--transthreshold 0.995 \
|
| 119 |
$FP16_FLAG
|
|
|
|
| 171 |
--data_replay_freq -1 \
|
| 172 |
--mlp_hidden_dim 100 \
|
| 173 |
--model_name specroute \
|
| 174 |
+
--cpi_gamma 0.5 \
|
| 175 |
+
--oap_eta 0.5 \
|
| 176 |
+
--oap_beta_min 0.3 \
|
| 177 |
+
--oap_warmup 3 \
|
| 178 |
--threshold 0.995 \
|
| 179 |
--transthreshold 0.995 \
|
| 180 |
$FP16_FLAG
|
|
|
|
| 232 |
--data_replay_freq -1 \
|
| 233 |
--mlp_hidden_dim 100 \
|
| 234 |
--model_name specroute \
|
| 235 |
+
--cpi_gamma 0.5 \
|
| 236 |
+
--oap_eta 0.5 \
|
| 237 |
+
--oap_beta_min 0.3 \
|
| 238 |
+
--oap_warmup 3 \
|
| 239 |
--threshold 0.995 \
|
| 240 |
--transthreshold 0.995 \
|
| 241 |
$FP16_FLAG
|
|
|
|
| 293 |
--data_replay_freq -1 \
|
| 294 |
--mlp_hidden_dim 100 \
|
| 295 |
--model_name specroute \
|
| 296 |
+
--cpi_gamma 0.5 \
|
| 297 |
+
--oap_eta 0.5 \
|
| 298 |
+
--oap_beta_min 0.3 \
|
| 299 |
+
--oap_warmup 3 \
|
| 300 |
--threshold 0.995 \
|
| 301 |
--transthreshold 0.995 \
|
| 302 |
$FP16_FLAG
|
|
|
|
| 354 |
--data_replay_freq -1 \
|
| 355 |
--mlp_hidden_dim 100 \
|
| 356 |
--model_name specroute \
|
| 357 |
+
--cpi_gamma 0.5 \
|
| 358 |
+
--oap_eta 0.5 \
|
| 359 |
+
--oap_beta_min 0.3 \
|
| 360 |
+
--oap_warmup 3 \
|
| 361 |
--threshold 0.995 \
|
| 362 |
--transthreshold 0.995 \
|
| 363 |
$FP16_FLAG
|
|
|
|
| 415 |
--data_replay_freq -1 \
|
| 416 |
--mlp_hidden_dim 100 \
|
| 417 |
--model_name specroute \
|
| 418 |
+
--cpi_gamma 0.5 \
|
| 419 |
+
--oap_eta 0.5 \
|
| 420 |
+
--oap_beta_min 0.3 \
|
| 421 |
+
--oap_warmup 3 \
|
| 422 |
--threshold 0.995 \
|
| 423 |
--transthreshold 0.995 \
|
| 424 |
$FP16_FLAG
|
|
|
|
| 476 |
--data_replay_freq -1 \
|
| 477 |
--mlp_hidden_dim 100 \
|
| 478 |
--model_name specroute \
|
| 479 |
+
--cpi_gamma 0.5 \
|
| 480 |
+
--oap_eta 0.5 \
|
| 481 |
+
--oap_beta_min 0.3 \
|
| 482 |
+
--oap_warmup 3 \
|
| 483 |
--threshold 0.995 \
|
| 484 |
--transthreshold 0.995 \
|
| 485 |
$FP16_FLAG
|
|
|
|
| 537 |
--data_replay_freq -1 \
|
| 538 |
--mlp_hidden_dim 100 \
|
| 539 |
--model_name specroute \
|
| 540 |
+
--cpi_gamma 0.5 \
|
| 541 |
+
--oap_eta 0.5 \
|
| 542 |
+
--oap_beta_min 0.3 \
|
| 543 |
+
--oap_warmup 3 \
|
| 544 |
--threshold 0.995 \
|
| 545 |
--transthreshold 0.995 \
|
| 546 |
$FP16_FLAG
|
|
|
|
| 598 |
--data_replay_freq -1 \
|
| 599 |
--mlp_hidden_dim 100 \
|
| 600 |
--model_name specroute \
|
| 601 |
+
--cpi_gamma 0.5 \
|
| 602 |
+
--oap_eta 0.5 \
|
| 603 |
+
--oap_beta_min 0.3 \
|
| 604 |
+
--oap_warmup 3 \
|
| 605 |
--threshold 0.995 \
|
| 606 |
--transthreshold 0.995 \
|
| 607 |
$FP16_FLAG
|
|
|
|
| 659 |
--data_replay_freq -1 \
|
| 660 |
--mlp_hidden_dim 100 \
|
| 661 |
--model_name specroute \
|
| 662 |
+
--cpi_gamma 0.5 \
|
| 663 |
+
--oap_eta 0.5 \
|
| 664 |
+
--oap_beta_min 0.3 \
|
| 665 |
+
--oap_warmup 3 \
|
| 666 |
--threshold 0.995 \
|
| 667 |
--transthreshold 0.995 \
|
| 668 |
$FP16_FLAG
|
|
|
|
| 720 |
--data_replay_freq -1 \
|
| 721 |
--mlp_hidden_dim 100 \
|
| 722 |
--model_name specroute \
|
| 723 |
+
--cpi_gamma 0.5 \
|
| 724 |
+
--oap_eta 0.5 \
|
| 725 |
+
--oap_beta_min 0.3 \
|
| 726 |
+
--oap_warmup 3 \
|
| 727 |
--threshold 0.995 \
|
| 728 |
--transthreshold 0.995 \
|
| 729 |
$FP16_FLAG
|
|
|
|
| 781 |
--data_replay_freq -1 \
|
| 782 |
--mlp_hidden_dim 100 \
|
| 783 |
--model_name specroute \
|
| 784 |
+
--cpi_gamma 0.5 \
|
| 785 |
+
--oap_eta 0.5 \
|
| 786 |
+
--oap_beta_min 0.3 \
|
| 787 |
+
--oap_warmup 3 \
|
| 788 |
--threshold 0.995 \
|
| 789 |
--transthreshold 0.995 \
|
| 790 |
$FP16_FLAG
|
|
|
|
| 842 |
--data_replay_freq -1 \
|
| 843 |
--mlp_hidden_dim 100 \
|
| 844 |
--model_name specroute \
|
| 845 |
+
--cpi_gamma 0.5 \
|
| 846 |
+
--oap_eta 0.5 \
|
| 847 |
+
--oap_beta_min 0.3 \
|
| 848 |
+
--oap_warmup 3 \
|
| 849 |
--threshold 0.995 \
|
| 850 |
--transthreshold 0.995 \
|
| 851 |
$FP16_FLAG
|
|
|
|
| 903 |
--data_replay_freq -1 \
|
| 904 |
--mlp_hidden_dim 100 \
|
| 905 |
--model_name specroute \
|
| 906 |
+
--cpi_gamma 0.5 \
|
| 907 |
+
--oap_eta 0.5 \
|
| 908 |
+
--oap_beta_min 0.3 \
|
| 909 |
+
--oap_warmup 3 \
|
| 910 |
--threshold 0.995 \
|
| 911 |
--transthreshold 0.995 \
|
| 912 |
$FP16_FLAG
|
|
|
|
| 964 |
--data_replay_freq -1 \
|
| 965 |
--mlp_hidden_dim 100 \
|
| 966 |
--model_name specroute \
|
| 967 |
+
--cpi_gamma 0.5 \
|
| 968 |
+
--oap_eta 0.5 \
|
| 969 |
+
--oap_beta_min 0.3 \
|
| 970 |
+
--oap_warmup 3 \
|
| 971 |
--threshold 0.995 \
|
| 972 |
--transthreshold 0.995 \
|
| 973 |
$FP16_FLAG
|
improve_gainlora/gen_script_long_order4_t5_specroute.sh
CHANGED
|
@@ -110,6 +110,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 110 |
--data_replay_freq -1 \
|
| 111 |
--mlp_hidden_dim 100 \
|
| 112 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
--threshold 0.995 \
|
| 114 |
--transthreshold 0.995 \
|
| 115 |
$FP16_FLAG
|
|
@@ -167,6 +171,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 167 |
--data_replay_freq -1 \
|
| 168 |
--mlp_hidden_dim 100 \
|
| 169 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
--threshold 0.995 \
|
| 171 |
--transthreshold 0.995 \
|
| 172 |
$FP16_FLAG
|
|
@@ -224,6 +232,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 224 |
--data_replay_freq -1 \
|
| 225 |
--mlp_hidden_dim 100 \
|
| 226 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
--threshold 0.995 \
|
| 228 |
--transthreshold 0.995 \
|
| 229 |
$FP16_FLAG
|
|
@@ -281,6 +293,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 281 |
--data_replay_freq -1 \
|
| 282 |
--mlp_hidden_dim 100 \
|
| 283 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
--threshold 0.995 \
|
| 285 |
--transthreshold 0.995 \
|
| 286 |
$FP16_FLAG
|
|
@@ -338,6 +354,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 338 |
--data_replay_freq -1 \
|
| 339 |
--mlp_hidden_dim 100 \
|
| 340 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
--threshold 0.995 \
|
| 342 |
--transthreshold 0.995 \
|
| 343 |
$FP16_FLAG
|
|
@@ -395,6 +415,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 395 |
--data_replay_freq -1 \
|
| 396 |
--mlp_hidden_dim 100 \
|
| 397 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
--threshold 0.995 \
|
| 399 |
--transthreshold 0.995 \
|
| 400 |
$FP16_FLAG
|
|
@@ -452,6 +476,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 452 |
--data_replay_freq -1 \
|
| 453 |
--mlp_hidden_dim 100 \
|
| 454 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
--threshold 0.995 \
|
| 456 |
--transthreshold 0.995 \
|
| 457 |
$FP16_FLAG
|
|
@@ -509,6 +537,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 509 |
--data_replay_freq -1 \
|
| 510 |
--mlp_hidden_dim 100 \
|
| 511 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 512 |
--threshold 0.995 \
|
| 513 |
--transthreshold 0.995 \
|
| 514 |
$FP16_FLAG
|
|
@@ -566,6 +598,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 566 |
--data_replay_freq -1 \
|
| 567 |
--mlp_hidden_dim 100 \
|
| 568 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 569 |
--threshold 0.995 \
|
| 570 |
--transthreshold 0.995 \
|
| 571 |
$FP16_FLAG
|
|
@@ -623,6 +659,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 623 |
--data_replay_freq -1 \
|
| 624 |
--mlp_hidden_dim 100 \
|
| 625 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 626 |
--threshold 0.995 \
|
| 627 |
--transthreshold 0.995 \
|
| 628 |
$FP16_FLAG
|
|
@@ -680,6 +720,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 680 |
--data_replay_freq -1 \
|
| 681 |
--mlp_hidden_dim 100 \
|
| 682 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 683 |
--threshold 0.995 \
|
| 684 |
--transthreshold 0.995 \
|
| 685 |
$FP16_FLAG
|
|
@@ -737,6 +781,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 737 |
--data_replay_freq -1 \
|
| 738 |
--mlp_hidden_dim 100 \
|
| 739 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 740 |
--threshold 0.995 \
|
| 741 |
--transthreshold 0.995 \
|
| 742 |
$FP16_FLAG
|
|
@@ -794,6 +842,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 794 |
--data_replay_freq -1 \
|
| 795 |
--mlp_hidden_dim 100 \
|
| 796 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 797 |
--threshold 0.995 \
|
| 798 |
--transthreshold 0.995 \
|
| 799 |
$FP16_FLAG
|
|
@@ -851,6 +903,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 851 |
--data_replay_freq -1 \
|
| 852 |
--mlp_hidden_dim 100 \
|
| 853 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 854 |
--threshold 0.995 \
|
| 855 |
--transthreshold 0.995 \
|
| 856 |
$FP16_FLAG
|
|
@@ -908,6 +964,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 908 |
--data_replay_freq -1 \
|
| 909 |
--mlp_hidden_dim 100 \
|
| 910 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 911 |
--threshold 0.995 \
|
| 912 |
--transthreshold 0.995 \
|
| 913 |
$FP16_FLAG
|
|
|
|
| 110 |
--data_replay_freq -1 \
|
| 111 |
--mlp_hidden_dim 100 \
|
| 112 |
--model_name specroute \
|
| 113 |
+
--cpi_gamma 0.5 \
|
| 114 |
+
--oap_eta 0.5 \
|
| 115 |
+
--oap_beta_min 0.3 \
|
| 116 |
+
--oap_warmup 3 \
|
| 117 |
--threshold 0.995 \
|
| 118 |
--transthreshold 0.995 \
|
| 119 |
$FP16_FLAG
|
|
|
|
| 171 |
--data_replay_freq -1 \
|
| 172 |
--mlp_hidden_dim 100 \
|
| 173 |
--model_name specroute \
|
| 174 |
+
--cpi_gamma 0.5 \
|
| 175 |
+
--oap_eta 0.5 \
|
| 176 |
+
--oap_beta_min 0.3 \
|
| 177 |
+
--oap_warmup 3 \
|
| 178 |
--threshold 0.995 \
|
| 179 |
--transthreshold 0.995 \
|
| 180 |
$FP16_FLAG
|
|
|
|
| 232 |
--data_replay_freq -1 \
|
| 233 |
--mlp_hidden_dim 100 \
|
| 234 |
--model_name specroute \
|
| 235 |
+
--cpi_gamma 0.5 \
|
| 236 |
+
--oap_eta 0.5 \
|
| 237 |
+
--oap_beta_min 0.3 \
|
| 238 |
+
--oap_warmup 3 \
|
| 239 |
--threshold 0.995 \
|
| 240 |
--transthreshold 0.995 \
|
| 241 |
$FP16_FLAG
|
|
|
|
| 293 |
--data_replay_freq -1 \
|
| 294 |
--mlp_hidden_dim 100 \
|
| 295 |
--model_name specroute \
|
| 296 |
+
--cpi_gamma 0.5 \
|
| 297 |
+
--oap_eta 0.5 \
|
| 298 |
+
--oap_beta_min 0.3 \
|
| 299 |
+
--oap_warmup 3 \
|
| 300 |
--threshold 0.995 \
|
| 301 |
--transthreshold 0.995 \
|
| 302 |
$FP16_FLAG
|
|
|
|
| 354 |
--data_replay_freq -1 \
|
| 355 |
--mlp_hidden_dim 100 \
|
| 356 |
--model_name specroute \
|
| 357 |
+
--cpi_gamma 0.5 \
|
| 358 |
+
--oap_eta 0.5 \
|
| 359 |
+
--oap_beta_min 0.3 \
|
| 360 |
+
--oap_warmup 3 \
|
| 361 |
--threshold 0.995 \
|
| 362 |
--transthreshold 0.995 \
|
| 363 |
$FP16_FLAG
|
|
|
|
| 415 |
--data_replay_freq -1 \
|
| 416 |
--mlp_hidden_dim 100 \
|
| 417 |
--model_name specroute \
|
| 418 |
+
--cpi_gamma 0.5 \
|
| 419 |
+
--oap_eta 0.5 \
|
| 420 |
+
--oap_beta_min 0.3 \
|
| 421 |
+
--oap_warmup 3 \
|
| 422 |
--threshold 0.995 \
|
| 423 |
--transthreshold 0.995 \
|
| 424 |
$FP16_FLAG
|
|
|
|
| 476 |
--data_replay_freq -1 \
|
| 477 |
--mlp_hidden_dim 100 \
|
| 478 |
--model_name specroute \
|
| 479 |
+
--cpi_gamma 0.5 \
|
| 480 |
+
--oap_eta 0.5 \
|
| 481 |
+
--oap_beta_min 0.3 \
|
| 482 |
+
--oap_warmup 3 \
|
| 483 |
--threshold 0.995 \
|
| 484 |
--transthreshold 0.995 \
|
| 485 |
$FP16_FLAG
|
|
|
|
| 537 |
--data_replay_freq -1 \
|
| 538 |
--mlp_hidden_dim 100 \
|
| 539 |
--model_name specroute \
|
| 540 |
+
--cpi_gamma 0.5 \
|
| 541 |
+
--oap_eta 0.5 \
|
| 542 |
+
--oap_beta_min 0.3 \
|
| 543 |
+
--oap_warmup 3 \
|
| 544 |
--threshold 0.995 \
|
| 545 |
--transthreshold 0.995 \
|
| 546 |
$FP16_FLAG
|
|
|
|
| 598 |
--data_replay_freq -1 \
|
| 599 |
--mlp_hidden_dim 100 \
|
| 600 |
--model_name specroute \
|
| 601 |
+
--cpi_gamma 0.5 \
|
| 602 |
+
--oap_eta 0.5 \
|
| 603 |
+
--oap_beta_min 0.3 \
|
| 604 |
+
--oap_warmup 3 \
|
| 605 |
--threshold 0.995 \
|
| 606 |
--transthreshold 0.995 \
|
| 607 |
$FP16_FLAG
|
|
|
|
| 659 |
--data_replay_freq -1 \
|
| 660 |
--mlp_hidden_dim 100 \
|
| 661 |
--model_name specroute \
|
| 662 |
+
--cpi_gamma 0.5 \
|
| 663 |
+
--oap_eta 0.5 \
|
| 664 |
+
--oap_beta_min 0.3 \
|
| 665 |
+
--oap_warmup 3 \
|
| 666 |
--threshold 0.995 \
|
| 667 |
--transthreshold 0.995 \
|
| 668 |
$FP16_FLAG
|
|
|
|
| 720 |
--data_replay_freq -1 \
|
| 721 |
--mlp_hidden_dim 100 \
|
| 722 |
--model_name specroute \
|
| 723 |
+
--cpi_gamma 0.5 \
|
| 724 |
+
--oap_eta 0.5 \
|
| 725 |
+
--oap_beta_min 0.3 \
|
| 726 |
+
--oap_warmup 3 \
|
| 727 |
--threshold 0.995 \
|
| 728 |
--transthreshold 0.995 \
|
| 729 |
$FP16_FLAG
|
|
|
|
| 781 |
--data_replay_freq -1 \
|
| 782 |
--mlp_hidden_dim 100 \
|
| 783 |
--model_name specroute \
|
| 784 |
+
--cpi_gamma 0.5 \
|
| 785 |
+
--oap_eta 0.5 \
|
| 786 |
+
--oap_beta_min 0.3 \
|
| 787 |
+
--oap_warmup 3 \
|
| 788 |
--threshold 0.995 \
|
| 789 |
--transthreshold 0.995 \
|
| 790 |
$FP16_FLAG
|
|
|
|
| 842 |
--data_replay_freq -1 \
|
| 843 |
--mlp_hidden_dim 100 \
|
| 844 |
--model_name specroute \
|
| 845 |
+
--cpi_gamma 0.5 \
|
| 846 |
+
--oap_eta 0.5 \
|
| 847 |
+
--oap_beta_min 0.3 \
|
| 848 |
+
--oap_warmup 3 \
|
| 849 |
--threshold 0.995 \
|
| 850 |
--transthreshold 0.995 \
|
| 851 |
$FP16_FLAG
|
|
|
|
| 903 |
--data_replay_freq -1 \
|
| 904 |
--mlp_hidden_dim 100 \
|
| 905 |
--model_name specroute \
|
| 906 |
+
--cpi_gamma 0.5 \
|
| 907 |
+
--oap_eta 0.5 \
|
| 908 |
+
--oap_beta_min 0.3 \
|
| 909 |
+
--oap_warmup 3 \
|
| 910 |
--threshold 0.995 \
|
| 911 |
--transthreshold 0.995 \
|
| 912 |
$FP16_FLAG
|
|
|
|
| 964 |
--data_replay_freq -1 \
|
| 965 |
--mlp_hidden_dim 100 \
|
| 966 |
--model_name specroute \
|
| 967 |
+
--cpi_gamma 0.5 \
|
| 968 |
+
--oap_eta 0.5 \
|
| 969 |
+
--oap_beta_min 0.3 \
|
| 970 |
+
--oap_warmup 3 \
|
| 971 |
--threshold 0.995 \
|
| 972 |
--transthreshold 0.995 \
|
| 973 |
$FP16_FLAG
|
improve_gainlora/gen_script_superni_order1_llama_specroute.sh
CHANGED
|
@@ -74,6 +74,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 74 |
--data_replay_freq -1 \
|
| 75 |
--chunk 4 \
|
| 76 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
--threshold 0.995
|
| 78 |
|
| 79 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/1-task1572_samsum_summary/checkpoint*
|
|
@@ -124,6 +128,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 124 |
--data_replay_freq -1 \
|
| 125 |
--chunk 4 \
|
| 126 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
--threshold 0.995
|
| 128 |
|
| 129 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/2-task363_sst2_polarity_classification/checkpoint*
|
|
@@ -174,6 +182,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 174 |
--data_replay_freq -1 \
|
| 175 |
--chunk 4 \
|
| 176 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
--threshold 0.995
|
| 178 |
|
| 179 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/3-task1290_xsum_summarization/checkpoint*
|
|
@@ -224,6 +236,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 224 |
--data_replay_freq -1 \
|
| 225 |
--chunk 4 \
|
| 226 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
--threshold 0.995
|
| 228 |
|
| 229 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/4-task181_outcome_extraction/checkpoint*
|
|
@@ -274,6 +290,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 274 |
--data_replay_freq -1 \
|
| 275 |
--chunk 4 \
|
| 276 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
--threshold 0.995
|
| 278 |
|
| 279 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/5-task002_quoref_answer_generation/checkpoint*
|
|
@@ -324,6 +344,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 324 |
--data_replay_freq -1 \
|
| 325 |
--chunk 4 \
|
| 326 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
--threshold 0.995
|
| 328 |
|
| 329 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/6-task1510_evalution_relation_extraction/checkpoint*
|
|
@@ -374,6 +398,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 374 |
--data_replay_freq -1 \
|
| 375 |
--chunk 4 \
|
| 376 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
--threshold 0.995
|
| 378 |
|
| 379 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/7-task639_multi_woz_user_utterance_generation/checkpoint*
|
|
@@ -424,6 +452,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 424 |
--data_replay_freq -1 \
|
| 425 |
--chunk 4 \
|
| 426 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
--threshold 0.995
|
| 428 |
|
| 429 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/8-task1729_personachat_generate_next/checkpoint*
|
|
@@ -474,6 +506,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 474 |
--data_replay_freq -1 \
|
| 475 |
--chunk 4 \
|
| 476 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 477 |
--threshold 0.995
|
| 478 |
|
| 479 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/9-task073_commonsenseqa_answer_generation/checkpoint*
|
|
@@ -524,6 +560,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 524 |
--data_replay_freq -1 \
|
| 525 |
--chunk 4 \
|
| 526 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 527 |
--threshold 0.995
|
| 528 |
|
| 529 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/10-task1590_diplomacy_text_generation/checkpoint*
|
|
@@ -574,6 +614,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 574 |
--data_replay_freq -1 \
|
| 575 |
--chunk 4 \
|
| 576 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 577 |
--threshold 0.995
|
| 578 |
|
| 579 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/11-task748_glucose_reverse_cause_event_detection/checkpoint*
|
|
@@ -624,6 +668,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 624 |
--data_replay_freq -1 \
|
| 625 |
--chunk 4 \
|
| 626 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 627 |
--threshold 0.995
|
| 628 |
|
| 629 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/12-task511_reddit_tifu_long_text_summarization/checkpoint*
|
|
@@ -674,6 +722,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 674 |
--data_replay_freq -1 \
|
| 675 |
--chunk 4 \
|
| 676 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 677 |
--threshold 0.995
|
| 678 |
|
| 679 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/13-task591_sciq_answer_generation/checkpoint*
|
|
@@ -724,6 +776,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 724 |
--data_replay_freq -1 \
|
| 725 |
--chunk 4 \
|
| 726 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 727 |
--threshold 0.995
|
| 728 |
|
| 729 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/14-task1687_sentiment140_classification/checkpoint*
|
|
@@ -774,6 +830,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 774 |
--data_replay_freq -1 \
|
| 775 |
--chunk 4 \
|
| 776 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 777 |
--threshold 0.995
|
| 778 |
|
| 779 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/15-task875_emotion_classification/checkpoint*
|
|
|
|
| 74 |
--data_replay_freq -1 \
|
| 75 |
--chunk 4 \
|
| 76 |
--model_name specroute \
|
| 77 |
+
--cpi_gamma 0.5 \
|
| 78 |
+
--oap_eta 0.5 \
|
| 79 |
+
--oap_beta_min 0.3 \
|
| 80 |
+
--oap_warmup 3 \
|
| 81 |
--threshold 0.995
|
| 82 |
|
| 83 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/1-task1572_samsum_summary/checkpoint*
|
|
|
|
| 128 |
--data_replay_freq -1 \
|
| 129 |
--chunk 4 \
|
| 130 |
--model_name specroute \
|
| 131 |
+
--cpi_gamma 0.5 \
|
| 132 |
+
--oap_eta 0.5 \
|
| 133 |
+
--oap_beta_min 0.3 \
|
| 134 |
+
--oap_warmup 3 \
|
| 135 |
--threshold 0.995
|
| 136 |
|
| 137 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/2-task363_sst2_polarity_classification/checkpoint*
|
|
|
|
| 182 |
--data_replay_freq -1 \
|
| 183 |
--chunk 4 \
|
| 184 |
--model_name specroute \
|
| 185 |
+
--cpi_gamma 0.5 \
|
| 186 |
+
--oap_eta 0.5 \
|
| 187 |
+
--oap_beta_min 0.3 \
|
| 188 |
+
--oap_warmup 3 \
|
| 189 |
--threshold 0.995
|
| 190 |
|
| 191 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/3-task1290_xsum_summarization/checkpoint*
|
|
|
|
| 236 |
--data_replay_freq -1 \
|
| 237 |
--chunk 4 \
|
| 238 |
--model_name specroute \
|
| 239 |
+
--cpi_gamma 0.5 \
|
| 240 |
+
--oap_eta 0.5 \
|
| 241 |
+
--oap_beta_min 0.3 \
|
| 242 |
+
--oap_warmup 3 \
|
| 243 |
--threshold 0.995
|
| 244 |
|
| 245 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/4-task181_outcome_extraction/checkpoint*
|
|
|
|
| 290 |
--data_replay_freq -1 \
|
| 291 |
--chunk 4 \
|
| 292 |
--model_name specroute \
|
| 293 |
+
--cpi_gamma 0.5 \
|
| 294 |
+
--oap_eta 0.5 \
|
| 295 |
+
--oap_beta_min 0.3 \
|
| 296 |
+
--oap_warmup 3 \
|
| 297 |
--threshold 0.995
|
| 298 |
|
| 299 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/5-task002_quoref_answer_generation/checkpoint*
|
|
|
|
| 344 |
--data_replay_freq -1 \
|
| 345 |
--chunk 4 \
|
| 346 |
--model_name specroute \
|
| 347 |
+
--cpi_gamma 0.5 \
|
| 348 |
+
--oap_eta 0.5 \
|
| 349 |
+
--oap_beta_min 0.3 \
|
| 350 |
+
--oap_warmup 3 \
|
| 351 |
--threshold 0.995
|
| 352 |
|
| 353 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/6-task1510_evalution_relation_extraction/checkpoint*
|
|
|
|
| 398 |
--data_replay_freq -1 \
|
| 399 |
--chunk 4 \
|
| 400 |
--model_name specroute \
|
| 401 |
+
--cpi_gamma 0.5 \
|
| 402 |
+
--oap_eta 0.5 \
|
| 403 |
+
--oap_beta_min 0.3 \
|
| 404 |
+
--oap_warmup 3 \
|
| 405 |
--threshold 0.995
|
| 406 |
|
| 407 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/7-task639_multi_woz_user_utterance_generation/checkpoint*
|
|
|
|
| 452 |
--data_replay_freq -1 \
|
| 453 |
--chunk 4 \
|
| 454 |
--model_name specroute \
|
| 455 |
+
--cpi_gamma 0.5 \
|
| 456 |
+
--oap_eta 0.5 \
|
| 457 |
+
--oap_beta_min 0.3 \
|
| 458 |
+
--oap_warmup 3 \
|
| 459 |
--threshold 0.995
|
| 460 |
|
| 461 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/8-task1729_personachat_generate_next/checkpoint*
|
|
|
|
| 506 |
--data_replay_freq -1 \
|
| 507 |
--chunk 4 \
|
| 508 |
--model_name specroute \
|
| 509 |
+
--cpi_gamma 0.5 \
|
| 510 |
+
--oap_eta 0.5 \
|
| 511 |
+
--oap_beta_min 0.3 \
|
| 512 |
+
--oap_warmup 3 \
|
| 513 |
--threshold 0.995
|
| 514 |
|
| 515 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/9-task073_commonsenseqa_answer_generation/checkpoint*
|
|
|
|
| 560 |
--data_replay_freq -1 \
|
| 561 |
--chunk 4 \
|
| 562 |
--model_name specroute \
|
| 563 |
+
--cpi_gamma 0.5 \
|
| 564 |
+
--oap_eta 0.5 \
|
| 565 |
+
--oap_beta_min 0.3 \
|
| 566 |
+
--oap_warmup 3 \
|
| 567 |
--threshold 0.995
|
| 568 |
|
| 569 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/10-task1590_diplomacy_text_generation/checkpoint*
|
|
|
|
| 614 |
--data_replay_freq -1 \
|
| 615 |
--chunk 4 \
|
| 616 |
--model_name specroute \
|
| 617 |
+
--cpi_gamma 0.5 \
|
| 618 |
+
--oap_eta 0.5 \
|
| 619 |
+
--oap_beta_min 0.3 \
|
| 620 |
+
--oap_warmup 3 \
|
| 621 |
--threshold 0.995
|
| 622 |
|
| 623 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/11-task748_glucose_reverse_cause_event_detection/checkpoint*
|
|
|
|
| 668 |
--data_replay_freq -1 \
|
| 669 |
--chunk 4 \
|
| 670 |
--model_name specroute \
|
| 671 |
+
--cpi_gamma 0.5 \
|
| 672 |
+
--oap_eta 0.5 \
|
| 673 |
+
--oap_beta_min 0.3 \
|
| 674 |
+
--oap_warmup 3 \
|
| 675 |
--threshold 0.995
|
| 676 |
|
| 677 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/12-task511_reddit_tifu_long_text_summarization/checkpoint*
|
|
|
|
| 722 |
--data_replay_freq -1 \
|
| 723 |
--chunk 4 \
|
| 724 |
--model_name specroute \
|
| 725 |
+
--cpi_gamma 0.5 \
|
| 726 |
+
--oap_eta 0.5 \
|
| 727 |
+
--oap_beta_min 0.3 \
|
| 728 |
+
--oap_warmup 3 \
|
| 729 |
--threshold 0.995
|
| 730 |
|
| 731 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/13-task591_sciq_answer_generation/checkpoint*
|
|
|
|
| 776 |
--data_replay_freq -1 \
|
| 777 |
--chunk 4 \
|
| 778 |
--model_name specroute \
|
| 779 |
+
--cpi_gamma 0.5 \
|
| 780 |
+
--oap_eta 0.5 \
|
| 781 |
+
--oap_beta_min 0.3 \
|
| 782 |
+
--oap_warmup 3 \
|
| 783 |
--threshold 0.995
|
| 784 |
|
| 785 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/14-task1687_sentiment140_classification/checkpoint*
|
|
|
|
| 830 |
--data_replay_freq -1 \
|
| 831 |
--chunk 4 \
|
| 832 |
--model_name specroute \
|
| 833 |
+
--cpi_gamma 0.5 \
|
| 834 |
+
--oap_eta 0.5 \
|
| 835 |
+
--oap_beta_min 0.3 \
|
| 836 |
+
--oap_warmup 3 \
|
| 837 |
--threshold 0.995
|
| 838 |
|
| 839 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/15-task875_emotion_classification/checkpoint*
|
improve_gainlora/gen_script_superni_order1_llama_specroute_p100.sh
CHANGED
|
@@ -51,6 +51,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 51 |
--data_replay_freq -1 \
|
| 52 |
--chunk 4 \
|
| 53 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
--threshold 0.995
|
| 55 |
|
| 56 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/1-task1572_samsum_summary/checkpoint*
|
|
@@ -101,6 +105,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 101 |
--data_replay_freq -1 \
|
| 102 |
--chunk 4 \
|
| 103 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
--threshold 0.995
|
| 105 |
|
| 106 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/2-task363_sst2_polarity_classification/checkpoint*
|
|
@@ -151,6 +159,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 151 |
--data_replay_freq -1 \
|
| 152 |
--chunk 4 \
|
| 153 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
--threshold 0.995
|
| 155 |
|
| 156 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/3-task1290_xsum_summarization/checkpoint*
|
|
@@ -201,6 +213,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 201 |
--data_replay_freq -1 \
|
| 202 |
--chunk 4 \
|
| 203 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
--threshold 0.995
|
| 205 |
|
| 206 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/4-task181_outcome_extraction/checkpoint*
|
|
@@ -251,6 +267,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 251 |
--data_replay_freq -1 \
|
| 252 |
--chunk 4 \
|
| 253 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
--threshold 0.995
|
| 255 |
|
| 256 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/5-task002_quoref_answer_generation/checkpoint*
|
|
@@ -301,6 +321,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 301 |
--data_replay_freq -1 \
|
| 302 |
--chunk 4 \
|
| 303 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
--threshold 0.995
|
| 305 |
|
| 306 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/6-task1510_evalution_relation_extraction/checkpoint*
|
|
@@ -351,6 +375,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 351 |
--data_replay_freq -1 \
|
| 352 |
--chunk 4 \
|
| 353 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
--threshold 0.995
|
| 355 |
|
| 356 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/7-task639_multi_woz_user_utterance_generation/checkpoint*
|
|
@@ -401,6 +429,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 401 |
--data_replay_freq -1 \
|
| 402 |
--chunk 4 \
|
| 403 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
--threshold 0.995
|
| 405 |
|
| 406 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/8-task1729_personachat_generate_next/checkpoint*
|
|
@@ -451,6 +483,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 451 |
--data_replay_freq -1 \
|
| 452 |
--chunk 4 \
|
| 453 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 454 |
--threshold 0.995
|
| 455 |
|
| 456 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/9-task073_commonsenseqa_answer_generation/checkpoint*
|
|
@@ -501,6 +537,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 501 |
--data_replay_freq -1 \
|
| 502 |
--chunk 4 \
|
| 503 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 504 |
--threshold 0.995
|
| 505 |
|
| 506 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/10-task1590_diplomacy_text_generation/checkpoint*
|
|
@@ -551,6 +591,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 551 |
--data_replay_freq -1 \
|
| 552 |
--chunk 4 \
|
| 553 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 554 |
--threshold 0.995
|
| 555 |
|
| 556 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/11-task748_glucose_reverse_cause_event_detection/checkpoint*
|
|
@@ -601,6 +645,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 601 |
--data_replay_freq -1 \
|
| 602 |
--chunk 4 \
|
| 603 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 604 |
--threshold 0.995
|
| 605 |
|
| 606 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/12-task511_reddit_tifu_long_text_summarization/checkpoint*
|
|
@@ -651,6 +699,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 651 |
--data_replay_freq -1 \
|
| 652 |
--chunk 4 \
|
| 653 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 654 |
--threshold 0.995
|
| 655 |
|
| 656 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/13-task591_sciq_answer_generation/checkpoint*
|
|
@@ -701,6 +753,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 701 |
--data_replay_freq -1 \
|
| 702 |
--chunk 4 \
|
| 703 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 704 |
--threshold 0.995
|
| 705 |
|
| 706 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/14-task1687_sentiment140_classification/checkpoint*
|
|
@@ -751,6 +807,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 751 |
--data_replay_freq -1 \
|
| 752 |
--chunk 4 \
|
| 753 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 754 |
--threshold 0.995
|
| 755 |
|
| 756 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/15-task875_emotion_classification/checkpoint*
|
|
|
|
| 51 |
--data_replay_freq -1 \
|
| 52 |
--chunk 4 \
|
| 53 |
--model_name specroute \
|
| 54 |
+
--cpi_gamma 0.5 \
|
| 55 |
+
--oap_eta 0.5 \
|
| 56 |
+
--oap_beta_min 0.3 \
|
| 57 |
+
--oap_warmup 3 \
|
| 58 |
--threshold 0.995
|
| 59 |
|
| 60 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/1-task1572_samsum_summary/checkpoint*
|
|
|
|
| 105 |
--data_replay_freq -1 \
|
| 106 |
--chunk 4 \
|
| 107 |
--model_name specroute \
|
| 108 |
+
--cpi_gamma 0.5 \
|
| 109 |
+
--oap_eta 0.5 \
|
| 110 |
+
--oap_beta_min 0.3 \
|
| 111 |
+
--oap_warmup 3 \
|
| 112 |
--threshold 0.995
|
| 113 |
|
| 114 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/2-task363_sst2_polarity_classification/checkpoint*
|
|
|
|
| 159 |
--data_replay_freq -1 \
|
| 160 |
--chunk 4 \
|
| 161 |
--model_name specroute \
|
| 162 |
+
--cpi_gamma 0.5 \
|
| 163 |
+
--oap_eta 0.5 \
|
| 164 |
+
--oap_beta_min 0.3 \
|
| 165 |
+
--oap_warmup 3 \
|
| 166 |
--threshold 0.995
|
| 167 |
|
| 168 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/3-task1290_xsum_summarization/checkpoint*
|
|
|
|
| 213 |
--data_replay_freq -1 \
|
| 214 |
--chunk 4 \
|
| 215 |
--model_name specroute \
|
| 216 |
+
--cpi_gamma 0.5 \
|
| 217 |
+
--oap_eta 0.5 \
|
| 218 |
+
--oap_beta_min 0.3 \
|
| 219 |
+
--oap_warmup 3 \
|
| 220 |
--threshold 0.995
|
| 221 |
|
| 222 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/4-task181_outcome_extraction/checkpoint*
|
|
|
|
| 267 |
--data_replay_freq -1 \
|
| 268 |
--chunk 4 \
|
| 269 |
--model_name specroute \
|
| 270 |
+
--cpi_gamma 0.5 \
|
| 271 |
+
--oap_eta 0.5 \
|
| 272 |
+
--oap_beta_min 0.3 \
|
| 273 |
+
--oap_warmup 3 \
|
| 274 |
--threshold 0.995
|
| 275 |
|
| 276 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/5-task002_quoref_answer_generation/checkpoint*
|
|
|
|
| 321 |
--data_replay_freq -1 \
|
| 322 |
--chunk 4 \
|
| 323 |
--model_name specroute \
|
| 324 |
+
--cpi_gamma 0.5 \
|
| 325 |
+
--oap_eta 0.5 \
|
| 326 |
+
--oap_beta_min 0.3 \
|
| 327 |
+
--oap_warmup 3 \
|
| 328 |
--threshold 0.995
|
| 329 |
|
| 330 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/6-task1510_evalution_relation_extraction/checkpoint*
|
|
|
|
| 375 |
--data_replay_freq -1 \
|
| 376 |
--chunk 4 \
|
| 377 |
--model_name specroute \
|
| 378 |
+
--cpi_gamma 0.5 \
|
| 379 |
+
--oap_eta 0.5 \
|
| 380 |
+
--oap_beta_min 0.3 \
|
| 381 |
+
--oap_warmup 3 \
|
| 382 |
--threshold 0.995
|
| 383 |
|
| 384 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/7-task639_multi_woz_user_utterance_generation/checkpoint*
|
|
|
|
| 429 |
--data_replay_freq -1 \
|
| 430 |
--chunk 4 \
|
| 431 |
--model_name specroute \
|
| 432 |
+
--cpi_gamma 0.5 \
|
| 433 |
+
--oap_eta 0.5 \
|
| 434 |
+
--oap_beta_min 0.3 \
|
| 435 |
+
--oap_warmup 3 \
|
| 436 |
--threshold 0.995
|
| 437 |
|
| 438 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/8-task1729_personachat_generate_next/checkpoint*
|
|
|
|
| 483 |
--data_replay_freq -1 \
|
| 484 |
--chunk 4 \
|
| 485 |
--model_name specroute \
|
| 486 |
+
--cpi_gamma 0.5 \
|
| 487 |
+
--oap_eta 0.5 \
|
| 488 |
+
--oap_beta_min 0.3 \
|
| 489 |
+
--oap_warmup 3 \
|
| 490 |
--threshold 0.995
|
| 491 |
|
| 492 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/9-task073_commonsenseqa_answer_generation/checkpoint*
|
|
|
|
| 537 |
--data_replay_freq -1 \
|
| 538 |
--chunk 4 \
|
| 539 |
--model_name specroute \
|
| 540 |
+
--cpi_gamma 0.5 \
|
| 541 |
+
--oap_eta 0.5 \
|
| 542 |
+
--oap_beta_min 0.3 \
|
| 543 |
+
--oap_warmup 3 \
|
| 544 |
--threshold 0.995
|
| 545 |
|
| 546 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/10-task1590_diplomacy_text_generation/checkpoint*
|
|
|
|
| 591 |
--data_replay_freq -1 \
|
| 592 |
--chunk 4 \
|
| 593 |
--model_name specroute \
|
| 594 |
+
--cpi_gamma 0.5 \
|
| 595 |
+
--oap_eta 0.5 \
|
| 596 |
+
--oap_beta_min 0.3 \
|
| 597 |
+
--oap_warmup 3 \
|
| 598 |
--threshold 0.995
|
| 599 |
|
| 600 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/11-task748_glucose_reverse_cause_event_detection/checkpoint*
|
|
|
|
| 645 |
--data_replay_freq -1 \
|
| 646 |
--chunk 4 \
|
| 647 |
--model_name specroute \
|
| 648 |
+
--cpi_gamma 0.5 \
|
| 649 |
+
--oap_eta 0.5 \
|
| 650 |
+
--oap_beta_min 0.3 \
|
| 651 |
+
--oap_warmup 3 \
|
| 652 |
--threshold 0.995
|
| 653 |
|
| 654 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/12-task511_reddit_tifu_long_text_summarization/checkpoint*
|
|
|
|
| 699 |
--data_replay_freq -1 \
|
| 700 |
--chunk 4 \
|
| 701 |
--model_name specroute \
|
| 702 |
+
--cpi_gamma 0.5 \
|
| 703 |
+
--oap_eta 0.5 \
|
| 704 |
+
--oap_beta_min 0.3 \
|
| 705 |
+
--oap_warmup 3 \
|
| 706 |
--threshold 0.995
|
| 707 |
|
| 708 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/13-task591_sciq_answer_generation/checkpoint*
|
|
|
|
| 753 |
--data_replay_freq -1 \
|
| 754 |
--chunk 4 \
|
| 755 |
--model_name specroute \
|
| 756 |
+
--cpi_gamma 0.5 \
|
| 757 |
+
--oap_eta 0.5 \
|
| 758 |
+
--oap_beta_min 0.3 \
|
| 759 |
+
--oap_warmup 3 \
|
| 760 |
--threshold 0.995
|
| 761 |
|
| 762 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/14-task1687_sentiment140_classification/checkpoint*
|
|
|
|
| 807 |
--data_replay_freq -1 \
|
| 808 |
--chunk 4 \
|
| 809 |
--model_name specroute \
|
| 810 |
+
--cpi_gamma 0.5 \
|
| 811 |
+
--oap_eta 0.5 \
|
| 812 |
+
--oap_beta_min 0.3 \
|
| 813 |
+
--oap_warmup 3 \
|
| 814 |
--threshold 0.995
|
| 815 |
|
| 816 |
rm -rf logs_and_outputs/gen_script_superni_order1_llama_specroute/outputs/15-task875_emotion_classification/checkpoint*
|
improve_gainlora/gen_script_superni_order1_t5_specroute.sh
CHANGED
|
@@ -114,6 +114,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
--threshold 0.995 \
|
| 118 |
--transthreshold 0.995 \
|
| 119 |
$FP16_FLAG
|
|
@@ -169,6 +173,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 169 |
--data_replay_freq -1 \
|
| 170 |
--mlp_hidden_dim 100 \
|
| 171 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
--threshold 0.995 \
|
| 173 |
--transthreshold 0.995 \
|
| 174 |
$FP16_FLAG
|
|
@@ -224,6 +232,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 224 |
--data_replay_freq -1 \
|
| 225 |
--mlp_hidden_dim 100 \
|
| 226 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
--threshold 0.995 \
|
| 228 |
--transthreshold 0.995 \
|
| 229 |
$FP16_FLAG
|
|
@@ -279,6 +291,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 279 |
--data_replay_freq -1 \
|
| 280 |
--mlp_hidden_dim 100 \
|
| 281 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 282 |
--threshold 0.995 \
|
| 283 |
--transthreshold 0.995 \
|
| 284 |
$FP16_FLAG
|
|
@@ -334,6 +350,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 334 |
--data_replay_freq -1 \
|
| 335 |
--mlp_hidden_dim 100 \
|
| 336 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
--threshold 0.995 \
|
| 338 |
--transthreshold 0.995 \
|
| 339 |
$FP16_FLAG
|
|
@@ -389,6 +409,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 389 |
--data_replay_freq -1 \
|
| 390 |
--mlp_hidden_dim 100 \
|
| 391 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
--threshold 0.995 \
|
| 393 |
--transthreshold 0.995 \
|
| 394 |
$FP16_FLAG
|
|
@@ -444,6 +468,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 444 |
--data_replay_freq -1 \
|
| 445 |
--mlp_hidden_dim 100 \
|
| 446 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
--threshold 0.995 \
|
| 448 |
--transthreshold 0.995 \
|
| 449 |
$FP16_FLAG
|
|
@@ -499,6 +527,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 499 |
--data_replay_freq -1 \
|
| 500 |
--mlp_hidden_dim 100 \
|
| 501 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 502 |
--threshold 0.995 \
|
| 503 |
--transthreshold 0.995 \
|
| 504 |
$FP16_FLAG
|
|
@@ -554,6 +586,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 554 |
--data_replay_freq -1 \
|
| 555 |
--mlp_hidden_dim 100 \
|
| 556 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 557 |
--threshold 0.995 \
|
| 558 |
--transthreshold 0.995 \
|
| 559 |
$FP16_FLAG
|
|
@@ -609,6 +645,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 609 |
--data_replay_freq -1 \
|
| 610 |
--mlp_hidden_dim 100 \
|
| 611 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
--threshold 0.995 \
|
| 613 |
--transthreshold 0.995 \
|
| 614 |
$FP16_FLAG
|
|
@@ -664,6 +704,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 664 |
--data_replay_freq -1 \
|
| 665 |
--mlp_hidden_dim 100 \
|
| 666 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 667 |
--threshold 0.995 \
|
| 668 |
--transthreshold 0.995 \
|
| 669 |
$FP16_FLAG
|
|
@@ -719,6 +763,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 719 |
--data_replay_freq -1 \
|
| 720 |
--mlp_hidden_dim 100 \
|
| 721 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 722 |
--threshold 0.995 \
|
| 723 |
--transthreshold 0.995 \
|
| 724 |
$FP16_FLAG
|
|
@@ -774,6 +822,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 774 |
--data_replay_freq -1 \
|
| 775 |
--mlp_hidden_dim 100 \
|
| 776 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 777 |
--threshold 0.995 \
|
| 778 |
--transthreshold 0.995 \
|
| 779 |
$FP16_FLAG
|
|
@@ -829,6 +881,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 829 |
--data_replay_freq -1 \
|
| 830 |
--mlp_hidden_dim 100 \
|
| 831 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 832 |
--threshold 0.995 \
|
| 833 |
--transthreshold 0.995 \
|
| 834 |
$FP16_FLAG
|
|
@@ -884,6 +940,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 884 |
--data_replay_freq -1 \
|
| 885 |
--mlp_hidden_dim 100 \
|
| 886 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 887 |
--threshold 0.995 \
|
| 888 |
--transthreshold 0.995 \
|
| 889 |
$FP16_FLAG
|
|
|
|
| 114 |
--data_replay_freq -1 \
|
| 115 |
--mlp_hidden_dim 100 \
|
| 116 |
--model_name specroute \
|
| 117 |
+
--cpi_gamma 0.5 \
|
| 118 |
+
--oap_eta 0.5 \
|
| 119 |
+
--oap_beta_min 0.3 \
|
| 120 |
+
--oap_warmup 3 \
|
| 121 |
--threshold 0.995 \
|
| 122 |
--transthreshold 0.995 \
|
| 123 |
$FP16_FLAG
|
|
|
|
| 173 |
--data_replay_freq -1 \
|
| 174 |
--mlp_hidden_dim 100 \
|
| 175 |
--model_name specroute \
|
| 176 |
+
--cpi_gamma 0.5 \
|
| 177 |
+
--oap_eta 0.5 \
|
| 178 |
+
--oap_beta_min 0.3 \
|
| 179 |
+
--oap_warmup 3 \
|
| 180 |
--threshold 0.995 \
|
| 181 |
--transthreshold 0.995 \
|
| 182 |
$FP16_FLAG
|
|
|
|
| 232 |
--data_replay_freq -1 \
|
| 233 |
--mlp_hidden_dim 100 \
|
| 234 |
--model_name specroute \
|
| 235 |
+
--cpi_gamma 0.5 \
|
| 236 |
+
--oap_eta 0.5 \
|
| 237 |
+
--oap_beta_min 0.3 \
|
| 238 |
+
--oap_warmup 3 \
|
| 239 |
--threshold 0.995 \
|
| 240 |
--transthreshold 0.995 \
|
| 241 |
$FP16_FLAG
|
|
|
|
| 291 |
--data_replay_freq -1 \
|
| 292 |
--mlp_hidden_dim 100 \
|
| 293 |
--model_name specroute \
|
| 294 |
+
--cpi_gamma 0.5 \
|
| 295 |
+
--oap_eta 0.5 \
|
| 296 |
+
--oap_beta_min 0.3 \
|
| 297 |
+
--oap_warmup 3 \
|
| 298 |
--threshold 0.995 \
|
| 299 |
--transthreshold 0.995 \
|
| 300 |
$FP16_FLAG
|
|
|
|
| 350 |
--data_replay_freq -1 \
|
| 351 |
--mlp_hidden_dim 100 \
|
| 352 |
--model_name specroute \
|
| 353 |
+
--cpi_gamma 0.5 \
|
| 354 |
+
--oap_eta 0.5 \
|
| 355 |
+
--oap_beta_min 0.3 \
|
| 356 |
+
--oap_warmup 3 \
|
| 357 |
--threshold 0.995 \
|
| 358 |
--transthreshold 0.995 \
|
| 359 |
$FP16_FLAG
|
|
|
|
| 409 |
--data_replay_freq -1 \
|
| 410 |
--mlp_hidden_dim 100 \
|
| 411 |
--model_name specroute \
|
| 412 |
+
--cpi_gamma 0.5 \
|
| 413 |
+
--oap_eta 0.5 \
|
| 414 |
+
--oap_beta_min 0.3 \
|
| 415 |
+
--oap_warmup 3 \
|
| 416 |
--threshold 0.995 \
|
| 417 |
--transthreshold 0.995 \
|
| 418 |
$FP16_FLAG
|
|
|
|
| 468 |
--data_replay_freq -1 \
|
| 469 |
--mlp_hidden_dim 100 \
|
| 470 |
--model_name specroute \
|
| 471 |
+
--cpi_gamma 0.5 \
|
| 472 |
+
--oap_eta 0.5 \
|
| 473 |
+
--oap_beta_min 0.3 \
|
| 474 |
+
--oap_warmup 3 \
|
| 475 |
--threshold 0.995 \
|
| 476 |
--transthreshold 0.995 \
|
| 477 |
$FP16_FLAG
|
|
|
|
| 527 |
--data_replay_freq -1 \
|
| 528 |
--mlp_hidden_dim 100 \
|
| 529 |
--model_name specroute \
|
| 530 |
+
--cpi_gamma 0.5 \
|
| 531 |
+
--oap_eta 0.5 \
|
| 532 |
+
--oap_beta_min 0.3 \
|
| 533 |
+
--oap_warmup 3 \
|
| 534 |
--threshold 0.995 \
|
| 535 |
--transthreshold 0.995 \
|
| 536 |
$FP16_FLAG
|
|
|
|
| 586 |
--data_replay_freq -1 \
|
| 587 |
--mlp_hidden_dim 100 \
|
| 588 |
--model_name specroute \
|
| 589 |
+
--cpi_gamma 0.5 \
|
| 590 |
+
--oap_eta 0.5 \
|
| 591 |
+
--oap_beta_min 0.3 \
|
| 592 |
+
--oap_warmup 3 \
|
| 593 |
--threshold 0.995 \
|
| 594 |
--transthreshold 0.995 \
|
| 595 |
$FP16_FLAG
|
|
|
|
| 645 |
--data_replay_freq -1 \
|
| 646 |
--mlp_hidden_dim 100 \
|
| 647 |
--model_name specroute \
|
| 648 |
+
--cpi_gamma 0.5 \
|
| 649 |
+
--oap_eta 0.5 \
|
| 650 |
+
--oap_beta_min 0.3 \
|
| 651 |
+
--oap_warmup 3 \
|
| 652 |
--threshold 0.995 \
|
| 653 |
--transthreshold 0.995 \
|
| 654 |
$FP16_FLAG
|
|
|
|
| 704 |
--data_replay_freq -1 \
|
| 705 |
--mlp_hidden_dim 100 \
|
| 706 |
--model_name specroute \
|
| 707 |
+
--cpi_gamma 0.5 \
|
| 708 |
+
--oap_eta 0.5 \
|
| 709 |
+
--oap_beta_min 0.3 \
|
| 710 |
+
--oap_warmup 3 \
|
| 711 |
--threshold 0.995 \
|
| 712 |
--transthreshold 0.995 \
|
| 713 |
$FP16_FLAG
|
|
|
|
| 763 |
--data_replay_freq -1 \
|
| 764 |
--mlp_hidden_dim 100 \
|
| 765 |
--model_name specroute \
|
| 766 |
+
--cpi_gamma 0.5 \
|
| 767 |
+
--oap_eta 0.5 \
|
| 768 |
+
--oap_beta_min 0.3 \
|
| 769 |
+
--oap_warmup 3 \
|
| 770 |
--threshold 0.995 \
|
| 771 |
--transthreshold 0.995 \
|
| 772 |
$FP16_FLAG
|
|
|
|
| 822 |
--data_replay_freq -1 \
|
| 823 |
--mlp_hidden_dim 100 \
|
| 824 |
--model_name specroute \
|
| 825 |
+
--cpi_gamma 0.5 \
|
| 826 |
+
--oap_eta 0.5 \
|
| 827 |
+
--oap_beta_min 0.3 \
|
| 828 |
+
--oap_warmup 3 \
|
| 829 |
--threshold 0.995 \
|
| 830 |
--transthreshold 0.995 \
|
| 831 |
$FP16_FLAG
|
|
|
|
| 881 |
--data_replay_freq -1 \
|
| 882 |
--mlp_hidden_dim 100 \
|
| 883 |
--model_name specroute \
|
| 884 |
+
--cpi_gamma 0.5 \
|
| 885 |
+
--oap_eta 0.5 \
|
| 886 |
+
--oap_beta_min 0.3 \
|
| 887 |
+
--oap_warmup 3 \
|
| 888 |
--threshold 0.995 \
|
| 889 |
--transthreshold 0.995 \
|
| 890 |
$FP16_FLAG
|
|
|
|
| 940 |
--data_replay_freq -1 \
|
| 941 |
--mlp_hidden_dim 100 \
|
| 942 |
--model_name specroute \
|
| 943 |
+
--cpi_gamma 0.5 \
|
| 944 |
+
--oap_eta 0.5 \
|
| 945 |
+
--oap_beta_min 0.3 \
|
| 946 |
+
--oap_warmup 3 \
|
| 947 |
--threshold 0.995 \
|
| 948 |
--transthreshold 0.995 \
|
| 949 |
$FP16_FLAG
|
improve_gainlora/gen_script_superni_order2_llama_specroute.sh
CHANGED
|
@@ -74,6 +74,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 74 |
--data_replay_freq -1 \
|
| 75 |
--chunk 4 \
|
| 76 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
--threshold 0.995
|
| 78 |
|
| 79 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/1-task748_glucose_reverse_cause_event_detection/checkpoint*
|
|
@@ -124,6 +128,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 124 |
--data_replay_freq -1 \
|
| 125 |
--chunk 4 \
|
| 126 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
--threshold 0.995
|
| 128 |
|
| 129 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/2-task073_commonsenseqa_answer_generation/checkpoint*
|
|
@@ -174,6 +182,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 174 |
--data_replay_freq -1 \
|
| 175 |
--chunk 4 \
|
| 176 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
--threshold 0.995
|
| 178 |
|
| 179 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/3-task1590_diplomacy_text_generation/checkpoint*
|
|
@@ -224,6 +236,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 224 |
--data_replay_freq -1 \
|
| 225 |
--chunk 4 \
|
| 226 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
--threshold 0.995
|
| 228 |
|
| 229 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/4-task639_multi_woz_user_utterance_generation/checkpoint*
|
|
@@ -274,6 +290,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 274 |
--data_replay_freq -1 \
|
| 275 |
--chunk 4 \
|
| 276 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
--threshold 0.995
|
| 278 |
|
| 279 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/5-task1572_samsum_summary/checkpoint*
|
|
@@ -324,6 +344,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 324 |
--data_replay_freq -1 \
|
| 325 |
--chunk 4 \
|
| 326 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
--threshold 0.995
|
| 328 |
|
| 329 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/6-task1687_sentiment140_classification/checkpoint*
|
|
@@ -374,6 +398,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 374 |
--data_replay_freq -1 \
|
| 375 |
--chunk 4 \
|
| 376 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
--threshold 0.995
|
| 378 |
|
| 379 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/7-task591_sciq_answer_generation/checkpoint*
|
|
@@ -424,6 +452,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 424 |
--data_replay_freq -1 \
|
| 425 |
--chunk 4 \
|
| 426 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
--threshold 0.995
|
| 428 |
|
| 429 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/8-task363_sst2_polarity_classification/checkpoint*
|
|
@@ -474,6 +506,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 474 |
--data_replay_freq -1 \
|
| 475 |
--chunk 4 \
|
| 476 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 477 |
--threshold 0.995
|
| 478 |
|
| 479 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/9-task1510_evalution_relation_extraction/checkpoint*
|
|
@@ -524,6 +560,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 524 |
--data_replay_freq -1 \
|
| 525 |
--chunk 4 \
|
| 526 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 527 |
--threshold 0.995
|
| 528 |
|
| 529 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/10-task1729_personachat_generate_next/checkpoint*
|
|
@@ -574,6 +614,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 574 |
--data_replay_freq -1 \
|
| 575 |
--chunk 4 \
|
| 576 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 577 |
--threshold 0.995
|
| 578 |
|
| 579 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/11-task181_outcome_extraction/checkpoint*
|
|
@@ -624,6 +668,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 624 |
--data_replay_freq -1 \
|
| 625 |
--chunk 4 \
|
| 626 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 627 |
--threshold 0.995
|
| 628 |
|
| 629 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/12-task511_reddit_tifu_long_text_summarization/checkpoint*
|
|
@@ -674,6 +722,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 674 |
--data_replay_freq -1 \
|
| 675 |
--chunk 4 \
|
| 676 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 677 |
--threshold 0.995
|
| 678 |
|
| 679 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/13-task002_quoref_answer_generation/checkpoint*
|
|
@@ -724,6 +776,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 724 |
--data_replay_freq -1 \
|
| 725 |
--chunk 4 \
|
| 726 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 727 |
--threshold 0.995
|
| 728 |
|
| 729 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/14-task1290_xsum_summarization/checkpoint*
|
|
@@ -774,6 +830,10 @@ deepspeed --include $DS_INCLUDE --master_port 49500 src/run_llama.py \
|
|
| 774 |
--data_replay_freq -1 \
|
| 775 |
--chunk 4 \
|
| 776 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 777 |
--threshold 0.995
|
| 778 |
|
| 779 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/15-task875_emotion_classification/checkpoint*
|
|
|
|
| 74 |
--data_replay_freq -1 \
|
| 75 |
--chunk 4 \
|
| 76 |
--model_name specroute \
|
| 77 |
+
--cpi_gamma 0.5 \
|
| 78 |
+
--oap_eta 0.5 \
|
| 79 |
+
--oap_beta_min 0.3 \
|
| 80 |
+
--oap_warmup 3 \
|
| 81 |
--threshold 0.995
|
| 82 |
|
| 83 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/1-task748_glucose_reverse_cause_event_detection/checkpoint*
|
|
|
|
| 128 |
--data_replay_freq -1 \
|
| 129 |
--chunk 4 \
|
| 130 |
--model_name specroute \
|
| 131 |
+
--cpi_gamma 0.5 \
|
| 132 |
+
--oap_eta 0.5 \
|
| 133 |
+
--oap_beta_min 0.3 \
|
| 134 |
+
--oap_warmup 3 \
|
| 135 |
--threshold 0.995
|
| 136 |
|
| 137 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/2-task073_commonsenseqa_answer_generation/checkpoint*
|
|
|
|
| 182 |
--data_replay_freq -1 \
|
| 183 |
--chunk 4 \
|
| 184 |
--model_name specroute \
|
| 185 |
+
--cpi_gamma 0.5 \
|
| 186 |
+
--oap_eta 0.5 \
|
| 187 |
+
--oap_beta_min 0.3 \
|
| 188 |
+
--oap_warmup 3 \
|
| 189 |
--threshold 0.995
|
| 190 |
|
| 191 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/3-task1590_diplomacy_text_generation/checkpoint*
|
|
|
|
| 236 |
--data_replay_freq -1 \
|
| 237 |
--chunk 4 \
|
| 238 |
--model_name specroute \
|
| 239 |
+
--cpi_gamma 0.5 \
|
| 240 |
+
--oap_eta 0.5 \
|
| 241 |
+
--oap_beta_min 0.3 \
|
| 242 |
+
--oap_warmup 3 \
|
| 243 |
--threshold 0.995
|
| 244 |
|
| 245 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/4-task639_multi_woz_user_utterance_generation/checkpoint*
|
|
|
|
| 290 |
--data_replay_freq -1 \
|
| 291 |
--chunk 4 \
|
| 292 |
--model_name specroute \
|
| 293 |
+
--cpi_gamma 0.5 \
|
| 294 |
+
--oap_eta 0.5 \
|
| 295 |
+
--oap_beta_min 0.3 \
|
| 296 |
+
--oap_warmup 3 \
|
| 297 |
--threshold 0.995
|
| 298 |
|
| 299 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/5-task1572_samsum_summary/checkpoint*
|
|
|
|
| 344 |
--data_replay_freq -1 \
|
| 345 |
--chunk 4 \
|
| 346 |
--model_name specroute \
|
| 347 |
+
--cpi_gamma 0.5 \
|
| 348 |
+
--oap_eta 0.5 \
|
| 349 |
+
--oap_beta_min 0.3 \
|
| 350 |
+
--oap_warmup 3 \
|
| 351 |
--threshold 0.995
|
| 352 |
|
| 353 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/6-task1687_sentiment140_classification/checkpoint*
|
|
|
|
| 398 |
--data_replay_freq -1 \
|
| 399 |
--chunk 4 \
|
| 400 |
--model_name specroute \
|
| 401 |
+
--cpi_gamma 0.5 \
|
| 402 |
+
--oap_eta 0.5 \
|
| 403 |
+
--oap_beta_min 0.3 \
|
| 404 |
+
--oap_warmup 3 \
|
| 405 |
--threshold 0.995
|
| 406 |
|
| 407 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/7-task591_sciq_answer_generation/checkpoint*
|
|
|
|
| 452 |
--data_replay_freq -1 \
|
| 453 |
--chunk 4 \
|
| 454 |
--model_name specroute \
|
| 455 |
+
--cpi_gamma 0.5 \
|
| 456 |
+
--oap_eta 0.5 \
|
| 457 |
+
--oap_beta_min 0.3 \
|
| 458 |
+
--oap_warmup 3 \
|
| 459 |
--threshold 0.995
|
| 460 |
|
| 461 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/8-task363_sst2_polarity_classification/checkpoint*
|
|
|
|
| 506 |
--data_replay_freq -1 \
|
| 507 |
--chunk 4 \
|
| 508 |
--model_name specroute \
|
| 509 |
+
--cpi_gamma 0.5 \
|
| 510 |
+
--oap_eta 0.5 \
|
| 511 |
+
--oap_beta_min 0.3 \
|
| 512 |
+
--oap_warmup 3 \
|
| 513 |
--threshold 0.995
|
| 514 |
|
| 515 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/9-task1510_evalution_relation_extraction/checkpoint*
|
|
|
|
| 560 |
--data_replay_freq -1 \
|
| 561 |
--chunk 4 \
|
| 562 |
--model_name specroute \
|
| 563 |
+
--cpi_gamma 0.5 \
|
| 564 |
+
--oap_eta 0.5 \
|
| 565 |
+
--oap_beta_min 0.3 \
|
| 566 |
+
--oap_warmup 3 \
|
| 567 |
--threshold 0.995
|
| 568 |
|
| 569 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/10-task1729_personachat_generate_next/checkpoint*
|
|
|
|
| 614 |
--data_replay_freq -1 \
|
| 615 |
--chunk 4 \
|
| 616 |
--model_name specroute \
|
| 617 |
+
--cpi_gamma 0.5 \
|
| 618 |
+
--oap_eta 0.5 \
|
| 619 |
+
--oap_beta_min 0.3 \
|
| 620 |
+
--oap_warmup 3 \
|
| 621 |
--threshold 0.995
|
| 622 |
|
| 623 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/11-task181_outcome_extraction/checkpoint*
|
|
|
|
| 668 |
--data_replay_freq -1 \
|
| 669 |
--chunk 4 \
|
| 670 |
--model_name specroute \
|
| 671 |
+
--cpi_gamma 0.5 \
|
| 672 |
+
--oap_eta 0.5 \
|
| 673 |
+
--oap_beta_min 0.3 \
|
| 674 |
+
--oap_warmup 3 \
|
| 675 |
--threshold 0.995
|
| 676 |
|
| 677 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/12-task511_reddit_tifu_long_text_summarization/checkpoint*
|
|
|
|
| 722 |
--data_replay_freq -1 \
|
| 723 |
--chunk 4 \
|
| 724 |
--model_name specroute \
|
| 725 |
+
--cpi_gamma 0.5 \
|
| 726 |
+
--oap_eta 0.5 \
|
| 727 |
+
--oap_beta_min 0.3 \
|
| 728 |
+
--oap_warmup 3 \
|
| 729 |
--threshold 0.995
|
| 730 |
|
| 731 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/13-task002_quoref_answer_generation/checkpoint*
|
|
|
|
| 776 |
--data_replay_freq -1 \
|
| 777 |
--chunk 4 \
|
| 778 |
--model_name specroute \
|
| 779 |
+
--cpi_gamma 0.5 \
|
| 780 |
+
--oap_eta 0.5 \
|
| 781 |
+
--oap_beta_min 0.3 \
|
| 782 |
+
--oap_warmup 3 \
|
| 783 |
--threshold 0.995
|
| 784 |
|
| 785 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/14-task1290_xsum_summarization/checkpoint*
|
|
|
|
| 830 |
--data_replay_freq -1 \
|
| 831 |
--chunk 4 \
|
| 832 |
--model_name specroute \
|
| 833 |
+
--cpi_gamma 0.5 \
|
| 834 |
+
--oap_eta 0.5 \
|
| 835 |
+
--oap_beta_min 0.3 \
|
| 836 |
+
--oap_warmup 3 \
|
| 837 |
--threshold 0.995
|
| 838 |
|
| 839 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/15-task875_emotion_classification/checkpoint*
|
improve_gainlora/gen_script_superni_order2_llama_specroute_p100.sh
CHANGED
|
@@ -51,6 +51,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 51 |
--data_replay_freq -1 \
|
| 52 |
--chunk 4 \
|
| 53 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
--threshold 0.995
|
| 55 |
|
| 56 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/1-task748_glucose_reverse_cause_event_detection/checkpoint*
|
|
@@ -101,6 +105,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 101 |
--data_replay_freq -1 \
|
| 102 |
--chunk 4 \
|
| 103 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
--threshold 0.995
|
| 105 |
|
| 106 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/2-task073_commonsenseqa_answer_generation/checkpoint*
|
|
@@ -151,6 +159,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 151 |
--data_replay_freq -1 \
|
| 152 |
--chunk 4 \
|
| 153 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
--threshold 0.995
|
| 155 |
|
| 156 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/3-task1590_diplomacy_text_generation/checkpoint*
|
|
@@ -201,6 +213,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 201 |
--data_replay_freq -1 \
|
| 202 |
--chunk 4 \
|
| 203 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
--threshold 0.995
|
| 205 |
|
| 206 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/4-task639_multi_woz_user_utterance_generation/checkpoint*
|
|
@@ -251,6 +267,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 251 |
--data_replay_freq -1 \
|
| 252 |
--chunk 4 \
|
| 253 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
--threshold 0.995
|
| 255 |
|
| 256 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/5-task1572_samsum_summary/checkpoint*
|
|
@@ -301,6 +321,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 301 |
--data_replay_freq -1 \
|
| 302 |
--chunk 4 \
|
| 303 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
--threshold 0.995
|
| 305 |
|
| 306 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/6-task1687_sentiment140_classification/checkpoint*
|
|
@@ -351,6 +375,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 351 |
--data_replay_freq -1 \
|
| 352 |
--chunk 4 \
|
| 353 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
--threshold 0.995
|
| 355 |
|
| 356 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/7-task591_sciq_answer_generation/checkpoint*
|
|
@@ -401,6 +429,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 401 |
--data_replay_freq -1 \
|
| 402 |
--chunk 4 \
|
| 403 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
--threshold 0.995
|
| 405 |
|
| 406 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/8-task363_sst2_polarity_classification/checkpoint*
|
|
@@ -451,6 +483,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 451 |
--data_replay_freq -1 \
|
| 452 |
--chunk 4 \
|
| 453 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 454 |
--threshold 0.995
|
| 455 |
|
| 456 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/9-task1510_evalution_relation_extraction/checkpoint*
|
|
@@ -501,6 +537,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 501 |
--data_replay_freq -1 \
|
| 502 |
--chunk 4 \
|
| 503 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 504 |
--threshold 0.995
|
| 505 |
|
| 506 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/10-task1729_personachat_generate_next/checkpoint*
|
|
@@ -551,6 +591,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 551 |
--data_replay_freq -1 \
|
| 552 |
--chunk 4 \
|
| 553 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 554 |
--threshold 0.995
|
| 555 |
|
| 556 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/11-task181_outcome_extraction/checkpoint*
|
|
@@ -601,6 +645,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 601 |
--data_replay_freq -1 \
|
| 602 |
--chunk 4 \
|
| 603 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 604 |
--threshold 0.995
|
| 605 |
|
| 606 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/12-task511_reddit_tifu_long_text_summarization/checkpoint*
|
|
@@ -651,6 +699,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 651 |
--data_replay_freq -1 \
|
| 652 |
--chunk 4 \
|
| 653 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 654 |
--threshold 0.995
|
| 655 |
|
| 656 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/13-task002_quoref_answer_generation/checkpoint*
|
|
@@ -701,6 +753,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 701 |
--data_replay_freq -1 \
|
| 702 |
--chunk 4 \
|
| 703 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 704 |
--threshold 0.995
|
| 705 |
|
| 706 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/14-task1290_xsum_summarization/checkpoint*
|
|
@@ -751,6 +807,10 @@ deepspeed --num_gpus 1 --master_port 49500 src/run_llama.py \
|
|
| 751 |
--data_replay_freq -1 \
|
| 752 |
--chunk 4 \
|
| 753 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 754 |
--threshold 0.995
|
| 755 |
|
| 756 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/15-task875_emotion_classification/checkpoint*
|
|
|
|
| 51 |
--data_replay_freq -1 \
|
| 52 |
--chunk 4 \
|
| 53 |
--model_name specroute \
|
| 54 |
+
--cpi_gamma 0.5 \
|
| 55 |
+
--oap_eta 0.5 \
|
| 56 |
+
--oap_beta_min 0.3 \
|
| 57 |
+
--oap_warmup 3 \
|
| 58 |
--threshold 0.995
|
| 59 |
|
| 60 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/1-task748_glucose_reverse_cause_event_detection/checkpoint*
|
|
|
|
| 105 |
--data_replay_freq -1 \
|
| 106 |
--chunk 4 \
|
| 107 |
--model_name specroute \
|
| 108 |
+
--cpi_gamma 0.5 \
|
| 109 |
+
--oap_eta 0.5 \
|
| 110 |
+
--oap_beta_min 0.3 \
|
| 111 |
+
--oap_warmup 3 \
|
| 112 |
--threshold 0.995
|
| 113 |
|
| 114 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/2-task073_commonsenseqa_answer_generation/checkpoint*
|
|
|
|
| 159 |
--data_replay_freq -1 \
|
| 160 |
--chunk 4 \
|
| 161 |
--model_name specroute \
|
| 162 |
+
--cpi_gamma 0.5 \
|
| 163 |
+
--oap_eta 0.5 \
|
| 164 |
+
--oap_beta_min 0.3 \
|
| 165 |
+
--oap_warmup 3 \
|
| 166 |
--threshold 0.995
|
| 167 |
|
| 168 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/3-task1590_diplomacy_text_generation/checkpoint*
|
|
|
|
| 213 |
--data_replay_freq -1 \
|
| 214 |
--chunk 4 \
|
| 215 |
--model_name specroute \
|
| 216 |
+
--cpi_gamma 0.5 \
|
| 217 |
+
--oap_eta 0.5 \
|
| 218 |
+
--oap_beta_min 0.3 \
|
| 219 |
+
--oap_warmup 3 \
|
| 220 |
--threshold 0.995
|
| 221 |
|
| 222 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/4-task639_multi_woz_user_utterance_generation/checkpoint*
|
|
|
|
| 267 |
--data_replay_freq -1 \
|
| 268 |
--chunk 4 \
|
| 269 |
--model_name specroute \
|
| 270 |
+
--cpi_gamma 0.5 \
|
| 271 |
+
--oap_eta 0.5 \
|
| 272 |
+
--oap_beta_min 0.3 \
|
| 273 |
+
--oap_warmup 3 \
|
| 274 |
--threshold 0.995
|
| 275 |
|
| 276 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/5-task1572_samsum_summary/checkpoint*
|
|
|
|
| 321 |
--data_replay_freq -1 \
|
| 322 |
--chunk 4 \
|
| 323 |
--model_name specroute \
|
| 324 |
+
--cpi_gamma 0.5 \
|
| 325 |
+
--oap_eta 0.5 \
|
| 326 |
+
--oap_beta_min 0.3 \
|
| 327 |
+
--oap_warmup 3 \
|
| 328 |
--threshold 0.995
|
| 329 |
|
| 330 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/6-task1687_sentiment140_classification/checkpoint*
|
|
|
|
| 375 |
--data_replay_freq -1 \
|
| 376 |
--chunk 4 \
|
| 377 |
--model_name specroute \
|
| 378 |
+
--cpi_gamma 0.5 \
|
| 379 |
+
--oap_eta 0.5 \
|
| 380 |
+
--oap_beta_min 0.3 \
|
| 381 |
+
--oap_warmup 3 \
|
| 382 |
--threshold 0.995
|
| 383 |
|
| 384 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/7-task591_sciq_answer_generation/checkpoint*
|
|
|
|
| 429 |
--data_replay_freq -1 \
|
| 430 |
--chunk 4 \
|
| 431 |
--model_name specroute \
|
| 432 |
+
--cpi_gamma 0.5 \
|
| 433 |
+
--oap_eta 0.5 \
|
| 434 |
+
--oap_beta_min 0.3 \
|
| 435 |
+
--oap_warmup 3 \
|
| 436 |
--threshold 0.995
|
| 437 |
|
| 438 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/8-task363_sst2_polarity_classification/checkpoint*
|
|
|
|
| 483 |
--data_replay_freq -1 \
|
| 484 |
--chunk 4 \
|
| 485 |
--model_name specroute \
|
| 486 |
+
--cpi_gamma 0.5 \
|
| 487 |
+
--oap_eta 0.5 \
|
| 488 |
+
--oap_beta_min 0.3 \
|
| 489 |
+
--oap_warmup 3 \
|
| 490 |
--threshold 0.995
|
| 491 |
|
| 492 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/9-task1510_evalution_relation_extraction/checkpoint*
|
|
|
|
| 537 |
--data_replay_freq -1 \
|
| 538 |
--chunk 4 \
|
| 539 |
--model_name specroute \
|
| 540 |
+
--cpi_gamma 0.5 \
|
| 541 |
+
--oap_eta 0.5 \
|
| 542 |
+
--oap_beta_min 0.3 \
|
| 543 |
+
--oap_warmup 3 \
|
| 544 |
--threshold 0.995
|
| 545 |
|
| 546 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/10-task1729_personachat_generate_next/checkpoint*
|
|
|
|
| 591 |
--data_replay_freq -1 \
|
| 592 |
--chunk 4 \
|
| 593 |
--model_name specroute \
|
| 594 |
+
--cpi_gamma 0.5 \
|
| 595 |
+
--oap_eta 0.5 \
|
| 596 |
+
--oap_beta_min 0.3 \
|
| 597 |
+
--oap_warmup 3 \
|
| 598 |
--threshold 0.995
|
| 599 |
|
| 600 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/11-task181_outcome_extraction/checkpoint*
|
|
|
|
| 645 |
--data_replay_freq -1 \
|
| 646 |
--chunk 4 \
|
| 647 |
--model_name specroute \
|
| 648 |
+
--cpi_gamma 0.5 \
|
| 649 |
+
--oap_eta 0.5 \
|
| 650 |
+
--oap_beta_min 0.3 \
|
| 651 |
+
--oap_warmup 3 \
|
| 652 |
--threshold 0.995
|
| 653 |
|
| 654 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/12-task511_reddit_tifu_long_text_summarization/checkpoint*
|
|
|
|
| 699 |
--data_replay_freq -1 \
|
| 700 |
--chunk 4 \
|
| 701 |
--model_name specroute \
|
| 702 |
+
--cpi_gamma 0.5 \
|
| 703 |
+
--oap_eta 0.5 \
|
| 704 |
+
--oap_beta_min 0.3 \
|
| 705 |
+
--oap_warmup 3 \
|
| 706 |
--threshold 0.995
|
| 707 |
|
| 708 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/13-task002_quoref_answer_generation/checkpoint*
|
|
|
|
| 753 |
--data_replay_freq -1 \
|
| 754 |
--chunk 4 \
|
| 755 |
--model_name specroute \
|
| 756 |
+
--cpi_gamma 0.5 \
|
| 757 |
+
--oap_eta 0.5 \
|
| 758 |
+
--oap_beta_min 0.3 \
|
| 759 |
+
--oap_warmup 3 \
|
| 760 |
--threshold 0.995
|
| 761 |
|
| 762 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/14-task1290_xsum_summarization/checkpoint*
|
|
|
|
| 807 |
--data_replay_freq -1 \
|
| 808 |
--chunk 4 \
|
| 809 |
--model_name specroute \
|
| 810 |
+
--cpi_gamma 0.5 \
|
| 811 |
+
--oap_eta 0.5 \
|
| 812 |
+
--oap_beta_min 0.3 \
|
| 813 |
+
--oap_warmup 3 \
|
| 814 |
--threshold 0.995
|
| 815 |
|
| 816 |
rm -rf logs_and_outputs/gen_script_superni_order2_llama_specroute/outputs/15-task875_emotion_classification/checkpoint*
|
improve_gainlora/gen_script_superni_order2_t5_specroute.sh
CHANGED
|
@@ -111,6 +111,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 111 |
--data_replay_freq -1 \
|
| 112 |
--mlp_hidden_dim 100 \
|
| 113 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
--threshold 0.995 \
|
| 115 |
--transthreshold 0.995 \
|
| 116 |
$FP16_FLAG
|
|
@@ -165,6 +169,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 165 |
--data_replay_freq -1 \
|
| 166 |
--mlp_hidden_dim 100 \
|
| 167 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
--threshold 0.995 \
|
| 169 |
--transthreshold 0.995 \
|
| 170 |
$FP16_FLAG
|
|
@@ -219,6 +227,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 219 |
--data_replay_freq -1 \
|
| 220 |
--mlp_hidden_dim 100 \
|
| 221 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
--threshold 0.995 \
|
| 223 |
--transthreshold 0.995 \
|
| 224 |
$FP16_FLAG
|
|
@@ -273,6 +285,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 273 |
--data_replay_freq -1 \
|
| 274 |
--mlp_hidden_dim 100 \
|
| 275 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
--threshold 0.995 \
|
| 277 |
--transthreshold 0.995 \
|
| 278 |
$FP16_FLAG
|
|
@@ -327,6 +343,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 327 |
--data_replay_freq -1 \
|
| 328 |
--mlp_hidden_dim 100 \
|
| 329 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
--threshold 0.995 \
|
| 331 |
--transthreshold 0.995 \
|
| 332 |
$FP16_FLAG
|
|
@@ -381,6 +401,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 381 |
--data_replay_freq -1 \
|
| 382 |
--mlp_hidden_dim 100 \
|
| 383 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
--threshold 0.995 \
|
| 385 |
--transthreshold 0.995 \
|
| 386 |
$FP16_FLAG
|
|
@@ -435,6 +459,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 435 |
--data_replay_freq -1 \
|
| 436 |
--mlp_hidden_dim 100 \
|
| 437 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
--threshold 0.995 \
|
| 439 |
--transthreshold 0.995 \
|
| 440 |
$FP16_FLAG
|
|
@@ -489,6 +517,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 489 |
--data_replay_freq -1 \
|
| 490 |
--mlp_hidden_dim 100 \
|
| 491 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 492 |
--threshold 0.995 \
|
| 493 |
--transthreshold 0.995 \
|
| 494 |
$FP16_FLAG
|
|
@@ -543,6 +575,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 543 |
--data_replay_freq -1 \
|
| 544 |
--mlp_hidden_dim 100 \
|
| 545 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 546 |
--threshold 0.995 \
|
| 547 |
--transthreshold 0.995 \
|
| 548 |
$FP16_FLAG
|
|
@@ -597,6 +633,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 597 |
--data_replay_freq -1 \
|
| 598 |
--mlp_hidden_dim 100 \
|
| 599 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 600 |
--threshold 0.995 \
|
| 601 |
--transthreshold 0.995 \
|
| 602 |
$FP16_FLAG
|
|
@@ -651,6 +691,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 651 |
--data_replay_freq -1 \
|
| 652 |
--mlp_hidden_dim 100 \
|
| 653 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 654 |
--threshold 0.995 \
|
| 655 |
--transthreshold 0.995 \
|
| 656 |
$FP16_FLAG
|
|
@@ -705,6 +749,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 705 |
--data_replay_freq -1 \
|
| 706 |
--mlp_hidden_dim 100 \
|
| 707 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 708 |
--threshold 0.995 \
|
| 709 |
--transthreshold 0.995 \
|
| 710 |
$FP16_FLAG
|
|
@@ -759,6 +807,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 759 |
--data_replay_freq -1 \
|
| 760 |
--mlp_hidden_dim 100 \
|
| 761 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 762 |
--threshold 0.995 \
|
| 763 |
--transthreshold 0.995 \
|
| 764 |
$FP16_FLAG
|
|
@@ -813,6 +865,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 813 |
--data_replay_freq -1 \
|
| 814 |
--mlp_hidden_dim 100 \
|
| 815 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 816 |
--threshold 0.995 \
|
| 817 |
--transthreshold 0.995 \
|
| 818 |
$FP16_FLAG
|
|
@@ -867,6 +923,10 @@ CUDA_VISIBLE_DEVICES=$GPU_IDS python src/run_t5.py \
|
|
| 867 |
--data_replay_freq -1 \
|
| 868 |
--mlp_hidden_dim 100 \
|
| 869 |
--model_name specroute \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 870 |
--threshold 0.995 \
|
| 871 |
--transthreshold 0.995 \
|
| 872 |
$FP16_FLAG
|
|
|
|
| 111 |
--data_replay_freq -1 \
|
| 112 |
--mlp_hidden_dim 100 \
|
| 113 |
--model_name specroute \
|
| 114 |
+
--cpi_gamma 0.5 \
|
| 115 |
+
--oap_eta 0.5 \
|
| 116 |
+
--oap_beta_min 0.3 \
|
| 117 |
+
--oap_warmup 3 \
|
| 118 |
--threshold 0.995 \
|
| 119 |
--transthreshold 0.995 \
|
| 120 |
$FP16_FLAG
|
|
|
|
| 169 |
--data_replay_freq -1 \
|
| 170 |
--mlp_hidden_dim 100 \
|
| 171 |
--model_name specroute \
|
| 172 |
+
--cpi_gamma 0.5 \
|
| 173 |
+
--oap_eta 0.5 \
|
| 174 |
+
--oap_beta_min 0.3 \
|
| 175 |
+
--oap_warmup 3 \
|
| 176 |
--threshold 0.995 \
|
| 177 |
--transthreshold 0.995 \
|
| 178 |
$FP16_FLAG
|
|
|
|
| 227 |
--data_replay_freq -1 \
|
| 228 |
--mlp_hidden_dim 100 \
|
| 229 |
--model_name specroute \
|
| 230 |
+
--cpi_gamma 0.5 \
|
| 231 |
+
--oap_eta 0.5 \
|
| 232 |
+
--oap_beta_min 0.3 \
|
| 233 |
+
--oap_warmup 3 \
|
| 234 |
--threshold 0.995 \
|
| 235 |
--transthreshold 0.995 \
|
| 236 |
$FP16_FLAG
|
|
|
|
| 285 |
--data_replay_freq -1 \
|
| 286 |
--mlp_hidden_dim 100 \
|
| 287 |
--model_name specroute \
|
| 288 |
+
--cpi_gamma 0.5 \
|
| 289 |
+
--oap_eta 0.5 \
|
| 290 |
+
--oap_beta_min 0.3 \
|
| 291 |
+
--oap_warmup 3 \
|
| 292 |
--threshold 0.995 \
|
| 293 |
--transthreshold 0.995 \
|
| 294 |
$FP16_FLAG
|
|
|
|
| 343 |
--data_replay_freq -1 \
|
| 344 |
--mlp_hidden_dim 100 \
|
| 345 |
--model_name specroute \
|
| 346 |
+
--cpi_gamma 0.5 \
|
| 347 |
+
--oap_eta 0.5 \
|
| 348 |
+
--oap_beta_min 0.3 \
|
| 349 |
+
--oap_warmup 3 \
|
| 350 |
--threshold 0.995 \
|
| 351 |
--transthreshold 0.995 \
|
| 352 |
$FP16_FLAG
|
|
|
|
| 401 |
--data_replay_freq -1 \
|
| 402 |
--mlp_hidden_dim 100 \
|
| 403 |
--model_name specroute \
|
| 404 |
+
--cpi_gamma 0.5 \
|
| 405 |
+
--oap_eta 0.5 \
|
| 406 |
+
--oap_beta_min 0.3 \
|
| 407 |
+
--oap_warmup 3 \
|
| 408 |
--threshold 0.995 \
|
| 409 |
--transthreshold 0.995 \
|
| 410 |
$FP16_FLAG
|
|
|
|
| 459 |
--data_replay_freq -1 \
|
| 460 |
--mlp_hidden_dim 100 \
|
| 461 |
--model_name specroute \
|
| 462 |
+
--cpi_gamma 0.5 \
|
| 463 |
+
--oap_eta 0.5 \
|
| 464 |
+
--oap_beta_min 0.3 \
|
| 465 |
+
--oap_warmup 3 \
|
| 466 |
--threshold 0.995 \
|
| 467 |
--transthreshold 0.995 \
|
| 468 |
$FP16_FLAG
|
|
|
|
| 517 |
--data_replay_freq -1 \
|
| 518 |
--mlp_hidden_dim 100 \
|
| 519 |
--model_name specroute \
|
| 520 |
+
--cpi_gamma 0.5 \
|
| 521 |
+
--oap_eta 0.5 \
|
| 522 |
+
--oap_beta_min 0.3 \
|
| 523 |
+
--oap_warmup 3 \
|
| 524 |
--threshold 0.995 \
|
| 525 |
--transthreshold 0.995 \
|
| 526 |
$FP16_FLAG
|
|
|
|
| 575 |
--data_replay_freq -1 \
|
| 576 |
--mlp_hidden_dim 100 \
|
| 577 |
--model_name specroute \
|
| 578 |
+
--cpi_gamma 0.5 \
|
| 579 |
+
--oap_eta 0.5 \
|
| 580 |
+
--oap_beta_min 0.3 \
|
| 581 |
+
--oap_warmup 3 \
|
| 582 |
--threshold 0.995 \
|
| 583 |
--transthreshold 0.995 \
|
| 584 |
$FP16_FLAG
|
|
|
|
| 633 |
--data_replay_freq -1 \
|
| 634 |
--mlp_hidden_dim 100 \
|
| 635 |
--model_name specroute \
|
| 636 |
+
--cpi_gamma 0.5 \
|
| 637 |
+
--oap_eta 0.5 \
|
| 638 |
+
--oap_beta_min 0.3 \
|
| 639 |
+
--oap_warmup 3 \
|
| 640 |
--threshold 0.995 \
|
| 641 |
--transthreshold 0.995 \
|
| 642 |
$FP16_FLAG
|
|
|
|
| 691 |
--data_replay_freq -1 \
|
| 692 |
--mlp_hidden_dim 100 \
|
| 693 |
--model_name specroute \
|
| 694 |
+
--cpi_gamma 0.5 \
|
| 695 |
+
--oap_eta 0.5 \
|
| 696 |
+
--oap_beta_min 0.3 \
|
| 697 |
+
--oap_warmup 3 \
|
| 698 |
--threshold 0.995 \
|
| 699 |
--transthreshold 0.995 \
|
| 700 |
$FP16_FLAG
|
|
|
|
| 749 |
--data_replay_freq -1 \
|
| 750 |
--mlp_hidden_dim 100 \
|
| 751 |
--model_name specroute \
|
| 752 |
+
--cpi_gamma 0.5 \
|
| 753 |
+
--oap_eta 0.5 \
|
| 754 |
+
--oap_beta_min 0.3 \
|
| 755 |
+
--oap_warmup 3 \
|
| 756 |
--threshold 0.995 \
|
| 757 |
--transthreshold 0.995 \
|
| 758 |
$FP16_FLAG
|
|
|
|
| 807 |
--data_replay_freq -1 \
|
| 808 |
--mlp_hidden_dim 100 \
|
| 809 |
--model_name specroute \
|
| 810 |
+
--cpi_gamma 0.5 \
|
| 811 |
+
--oap_eta 0.5 \
|
| 812 |
+
--oap_beta_min 0.3 \
|
| 813 |
+
--oap_warmup 3 \
|
| 814 |
--threshold 0.995 \
|
| 815 |
--transthreshold 0.995 \
|
| 816 |
$FP16_FLAG
|
|
|
|
| 865 |
--data_replay_freq -1 \
|
| 866 |
--mlp_hidden_dim 100 \
|
| 867 |
--model_name specroute \
|
| 868 |
+
--cpi_gamma 0.5 \
|
| 869 |
+
--oap_eta 0.5 \
|
| 870 |
+
--oap_beta_min 0.3 \
|
| 871 |
+
--oap_warmup 3 \
|
| 872 |
--threshold 0.995 \
|
| 873 |
--transthreshold 0.995 \
|
| 874 |
$FP16_FLAG
|
|
|
|
| 923 |
--data_replay_freq -1 \
|
| 924 |
--mlp_hidden_dim 100 \
|
| 925 |
--model_name specroute \
|
| 926 |
+
--cpi_gamma 0.5 \
|
| 927 |
+
--oap_eta 0.5 \
|
| 928 |
+
--oap_beta_min 0.3 \
|
| 929 |
+
--oap_warmup 3 \
|
| 930 |
--threshold 0.995 \
|
| 931 |
--transthreshold 0.995 \
|
| 932 |
$FP16_FLAG
|
improve_gainlora/improve_gainlora.tex
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
\documentclass[border=10pt]{standalone}
|
| 2 |
+
\usepackage{tikz}
|
| 3 |
+
\usetikzlibrary{shapes.geometric, arrows.meta, calc}
|
| 4 |
+
\usepackage{pifont}
|
| 5 |
+
\usepackage{amsmath}
|
| 6 |
+
\usepackage{fontawesome5}
|
| 7 |
+
|
| 8 |
+
\begin{document}
|
| 9 |
+
\begin{tikzpicture}[
|
| 10 |
+
>=stealth,
|
| 11 |
+
font=\sffamily\footnotesize,
|
| 12 |
+
% === REUSED STYLES FROM GAINLORA ===
|
| 13 |
+
lm_outer/.style={rectangle, draw=blue!60!black, fill=blue!15, thick, rounded corners=4mm, minimum width=4cm, minimum height=5.5cm, align=center},
|
| 14 |
+
lm_inner/.style={rectangle, fill=cyan!5, rounded corners=2mm, minimum width=3.4cm, minimum height=4cm},
|
| 15 |
+
input_box/.style={rectangle, draw=orange!50, fill=orange!20, rounded corners=1mm, text width=5cm, inner sep=4pt, align=left},
|
| 16 |
+
ans_box/.style={rectangle, draw=orange!50, fill=orange!20, font=\bfseries, inner sep=4pt},
|
| 17 |
+
q_h_box/.style={rectangle, draw=yellow!80!orange, fill=yellow!30, rounded corners=1.5mm, minimum width=3cm, minimum height=4mm},
|
| 18 |
+
trap_A_old/.style={trapezium, draw=teal!80!black, fill=green!10, trapezium angle=65, thick, minimum width=1.5cm, minimum height=0.7cm, align=center, shape border rotate=180},
|
| 19 |
+
trap_B_old/.style={trapezium, draw=teal!80!black, fill=green!10, trapezium angle=65, thick, minimum width=1.5cm, minimum height=0.7cm, align=center},
|
| 20 |
+
trap_A_new/.style={trapezium, draw=blue!80!black, fill=blue!10, trapezium angle=65, thick, minimum width=1.5cm, minimum height=0.7cm, align=center, shape border rotate=180},
|
| 21 |
+
trap_B_new/.style={trapezium, draw=blue!80!black, fill=blue!10, trapezium angle=65, thick, minimum width=1.5cm, minimum height=0.7cm, align=center},
|
| 22 |
+
var_w/.style={rectangle, draw=blue!80!black, fill=cyan!10, minimum size=6mm, inner sep=2pt, align=center},
|
| 23 |
+
var_a_old/.style={rectangle, draw=teal!80!black, fill=green!15, minimum size=5mm, inner sep=2pt},
|
| 24 |
+
var_a_new/.style={rectangle, draw=blue!80!black, fill=blue!15, minimum size=5mm, inner sep=2pt},
|
| 25 |
+
step_box/.style={rectangle, draw=blue!40, fill=blue!10, text width=2.8cm, align=left, inner sep=3pt},
|
| 26 |
+
plus_op/.style={circle, draw=black, thick, fill=white, inner sep=0pt, minimum size=4.5mm},
|
| 27 |
+
times_op/.style={circle, draw=black, thick, fill=white, inner sep=0pt, minimum size=4.5mm},
|
| 28 |
+
% === NEW STYLES FOR SPECROUTE ===
|
| 29 |
+
spectral_old/.style={rectangle, draw=violet!80!black, thick, fill=violet!8, rounded corners=2mm, minimum width=2cm, minimum height=1.4cm, align=center},
|
| 30 |
+
spectral_new/.style={rectangle, draw=red!70!black, thick, fill=violet!8, rounded corners=2mm, minimum width=2cm, minimum height=1.4cm, align=center},
|
| 31 |
+
c5_badge/.style={rectangle, draw=orange!80!black, thick, fill=yellow!40, rounded corners=1.5mm, inner sep=2pt, font=\scriptsize\bfseries},
|
| 32 |
+
prop_box/.style={rectangle, draw=violet!70!black, fill=violet!8, text width=1.8cm, align=center, minimum height=0.9cm},
|
| 33 |
+
calib_label/.style={font=\scriptsize, text=orange!70!black, align=center},
|
| 34 |
+
argmax_badge/.style={rectangle, draw=red!70!black, thick, fill=red!8, rounded corners=2mm, inner sep=4pt, align=center}
|
| 35 |
+
]
|
| 36 |
+
|
| 37 |
+
% =======================================================
|
| 38 |
+
% PART (a) - SPECROUTE EXPANDABLE LORA ARCHITECTURE
|
| 39 |
+
% =======================================================
|
| 40 |
+
|
| 41 |
+
% 1. LM Box & Inputs (same structure as GainLoRA)
|
| 42 |
+
\node[input_box] (input_a) at (0, 0) {Someone who had a very bad flight might be given a trip in this to make up for it?\\ \textbf{Option:} (A)first class (B)propitious (C)reputable (D)one (E)sufficient};
|
| 43 |
+
\node[font=\large] at (-3, 0) {$\boldsymbol{x}$};
|
| 44 |
+
|
| 45 |
+
\node[lm_outer] (lm) at (0, 4.5) {};
|
| 46 |
+
\node[font=\bfseries] at (0, 6.8) {Language Models};
|
| 47 |
+
\node[lm_inner] (lm_in) at (0, 4.2) {};
|
| 48 |
+
|
| 49 |
+
\node[ans_box] (ans) at (0, 8.2) {Answer: A};
|
| 50 |
+
\draw[->, thick, line width=1.2pt] (0, 7.25) -- (ans.south);
|
| 51 |
+
|
| 52 |
+
\node[q_h_box] (h) at (0, 2.7) {};
|
| 53 |
+
\node at (-1.8, 2.7) {$\boldsymbol{h}$};
|
| 54 |
+
\node[q_h_box] (q) at (0, 5.7) {};
|
| 55 |
+
\node at (-1.8, 5.7) {$\boldsymbol{q}$};
|
| 56 |
+
|
| 57 |
+
\node[plus_op] (lm_plus) at (0, 4.2) {$\boldsymbol{+}$};
|
| 58 |
+
\node[rectangle, draw=black, fill=white, align=center, font=\scriptsize, minimum width=1.3cm] (W) at (-1.1, 4.2) {Pre-trained\\Weights\\$\boldsymbol{W}$\\\textcolor{cyan}{\ding{101}}};
|
| 59 |
+
\node[var_w] (wt_small) at (1.2, 4.2) {$w_t$};
|
| 60 |
+
|
| 61 |
+
\draw[->, thick, line width=1.2pt] (input_a.north) -- (h.south);
|
| 62 |
+
\draw[->, thick, line width=1.2pt] (h.north) -- (lm_plus.south);
|
| 63 |
+
\draw[->, thick, line width=1.2pt] (lm_plus.north) -- (q.south);
|
| 64 |
+
|
| 65 |
+
% 2. Big Expandable Box
|
| 66 |
+
\draw[black, thick, rounded corners=4mm] (3.5, -0.5) rectangle (16.5, 9);
|
| 67 |
+
|
| 68 |
+
\draw[dashed, thick] (1.5, 4.5) -- (3.5, 9);
|
| 69 |
+
\draw[dashed, thick] (1.5, 3.9) -- (3.5, -0.5);
|
| 70 |
+
|
| 71 |
+
% Legend
|
| 72 |
+
\node[plus_op, minimum size=4mm] at (5.5, 8.5) {$\boldsymbol{+}$};
|
| 73 |
+
\node at (6.5, 8.5) {Addition};
|
| 74 |
+
\node[times_op, minimum size=4mm] at (8, 8.5) {$\boldsymbol{\times}$};
|
| 75 |
+
\node at (9.2, 8.5) {Multiplication};
|
| 76 |
+
\node[text=cyan, font=\large] at (10.8, 8.5) {\ding{101}};
|
| 77 |
+
\node at (11.6, 8.5) {: Frozen};
|
| 78 |
+
\node[c5_badge] at (13, 8.5) {C5};
|
| 79 |
+
\node[font=\footnotesize] at (14.5, 8.5) {: Data-Informed};
|
| 80 |
+
|
| 81 |
+
% Output
|
| 82 |
+
\node[var_w, minimum size=7mm] (wt_big) at (9.5, 7.5) {$w_t$};
|
| 83 |
+
\node[plus_op] (big_plus) at (9.5, 6) {$\boldsymbol{+}$};
|
| 84 |
+
\draw[->, thick, line width=1.5pt] (big_plus.north) -- (wt_big.south);
|
| 85 |
+
|
| 86 |
+
% Bus line
|
| 87 |
+
\draw[thick, line width=1.5pt] (5.5, 4.8) -- (13.5, 4.8);
|
| 88 |
+
\draw[thick, line width=1.5pt] (9.5, 4.8) -- (big_plus.south);
|
| 89 |
+
|
| 90 |
+
% Background Old/New
|
| 91 |
+
\fill[green!15, rounded corners=2mm] (4, 0) rectangle (9.2, 4.5);
|
| 92 |
+
\node[font=\bfseries] at (6.6, -0.2) {Old Branches};
|
| 93 |
+
|
| 94 |
+
\fill[blue!15, rounded corners=2mm] (10.5, 0) rectangle (13.5, 4.5);
|
| 95 |
+
\node[font=\bfseries] at (12, -0.2) {New Branch};
|
| 96 |
+
|
| 97 |
+
% Branch 1 (X = 5.5) -- CHANGED: alpha_1 instead of a_1
|
| 98 |
+
\node[var_a_old] (a1) at (4.5, 4) {$\alpha_1$};
|
| 99 |
+
\node[times_op] (t1_top) at (5.5, 4) {$\boldsymbol{\times}$};
|
| 100 |
+
\node[trap_A_old] (A1) at (5.5, 2.7) {$\boldsymbol{A_1}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 101 |
+
\node[times_op] (t1_bot) at (5.5, 1.5) {$\boldsymbol{\times}$};
|
| 102 |
+
\node[trap_B_old] (B1) at (5.5, 0.5) {$\boldsymbol{B_1}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 103 |
+
|
| 104 |
+
\draw[->, thick, line width=1.5pt] (B1.north) -- (t1_bot.south);
|
| 105 |
+
\draw[->, thick, line width=1.5pt] (t1_bot.north) -- (A1.south);
|
| 106 |
+
\draw[->, thick, line width=1.5pt] (A1.north) -- (t1_top.south);
|
| 107 |
+
\draw[->, thick, line width=1.5pt] (t1_top.north) -- (5.5, 4.8);
|
| 108 |
+
\draw[->, thick, line width=1.2pt] (a1.east) -- (t1_top.west);
|
| 109 |
+
|
| 110 |
+
% Dots
|
| 111 |
+
\node[font=\large] at (7.2, 2.7) {$\boldsymbol{\dots}$};
|
| 112 |
+
\node[font=\large] at (7.2, 0.5) {$\boldsymbol{\dots}$};
|
| 113 |
+
|
| 114 |
+
% Branch t-1 (X = 8.4) -- CHANGED: alpha_{t-1}
|
| 115 |
+
\node[var_a_old] (atm1) at (7.4, 4) {$\alpha_{t\text{-}1}$};
|
| 116 |
+
\node[times_op] (ttm1_top) at (8.4, 4) {$\boldsymbol{\times}$};
|
| 117 |
+
\node[trap_A_old] (Atm1) at (8.4, 2.7) {$\boldsymbol{A_{t-1}}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 118 |
+
\node[times_op] (ttm1_bot) at (8.4, 1.5) {$\boldsymbol{\times}$};
|
| 119 |
+
\node[trap_B_old] (Btm1) at (8.4, 0.5) {$\boldsymbol{B_{t-1}}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 120 |
+
|
| 121 |
+
\draw[->, thick, line width=1.5pt] (Btm1.north) -- (ttm1_bot.south);
|
| 122 |
+
\draw[->, thick, line width=1.5pt] (ttm1_bot.north) -- (Atm1.south);
|
| 123 |
+
\draw[->, thick, line width=1.5pt] (Atm1.north) -- (ttm1_top.south);
|
| 124 |
+
\draw[->, thick, line width=1.5pt] (ttm1_top.north) -- (8.4, 4.8);
|
| 125 |
+
\draw[->, thick, line width=1.2pt] (atm1.east) -- (ttm1_top.west);
|
| 126 |
+
|
| 127 |
+
% Branch t (X = 12.5) -- CHANGED: alpha_t, C5 badge on A_t, A_t now frozen
|
| 128 |
+
\node[var_a_new] (at) at (11.5, 4) {$\alpha_t$};
|
| 129 |
+
\node[times_op] (tt_top) at (12.5, 4) {$\boldsymbol{\times}$};
|
| 130 |
+
\node[trap_A_new] (At) at (12.5, 2.7) {$\boldsymbol{A_t}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 131 |
+
\node[c5_badge] at (13.8, 2.7) {C5};
|
| 132 |
+
\node[times_op] (tt_bot) at (12.5, 1.5) {$\boldsymbol{\times}$};
|
| 133 |
+
\node[trap_B_new] (Bt) at (12.5, 0.5) {$\boldsymbol{B_t}$\\ \tiny\textcolor{red}{\faFire}};
|
| 134 |
+
|
| 135 |
+
\draw[->, thick, line width=1.5pt] (Bt.north) -- (tt_bot.south);
|
| 136 |
+
\draw[->, thick, line width=1.5pt] (tt_bot.north) -- (At.south);
|
| 137 |
+
\draw[->, thick, line width=1.5pt] (At.north) -- (tt_top.south);
|
| 138 |
+
\draw[->, thick, line width=1.5pt] (tt_top.north) -- (12.5, 4.8);
|
| 139 |
+
\draw[->, thick, line width=1.2pt] (at.east) -- (tt_top.west);
|
| 140 |
+
|
| 141 |
+
% Step annotations -- CHANGED for SpecRoute
|
| 142 |
+
\node[step_box] (step1) at (15, 7.2) {\textbf{1.} C5 Data-Informed\\Init for $A_t$};
|
| 143 |
+
\draw[->, thick] (step1.west) -- (wt_big.east);
|
| 144 |
+
|
| 145 |
+
\node[step_box] (step2) at (15, 4.6) {\textbf{2.} Hard Top-1\\Spectral Routing};
|
| 146 |
+
|
| 147 |
+
\node[step_box] (step3) at (15, 2) {\textbf{3.} Training $B_t$\\for new task};
|
| 148 |
+
|
| 149 |
+
\node[font=\large\bfseries] at (8, -1.5) {(a) Expandable LoRA Architecture in SpecRoute};
|
| 150 |
+
|
| 151 |
+
% =======================================================
|
| 152 |
+
% PART (b) - SPECTRAL ROUTING (replaces Gating Modules)
|
| 153 |
+
% =======================================================
|
| 154 |
+
|
| 155 |
+
\begin{scope}[shift={(21.5, 0)}]
|
| 156 |
+
|
| 157 |
+
% Input
|
| 158 |
+
\node[input_box] (input_b) at (4.5, 0) {Someone who had a very bad flight might be given a trip in this to make up for it?\\ \textbf{Option:} (A)first class (B)propitious (C)reputable (D)one (E)sufficient};
|
| 159 |
+
\node[font=\large] at (1.5, 0) {$\boldsymbol{x}$};
|
| 160 |
+
|
| 161 |
+
% Frozen embedding label
|
| 162 |
+
\node[font=\scriptsize, text=blue!70!black] at (4.5, 1.3) {$h = \text{embed}(x)$ \textcolor{cyan}{\ding{101}}};
|
| 163 |
+
|
| 164 |
+
% Backgrounds for old/new spectral blocks
|
| 165 |
+
\fill[violet!8, rounded corners=2mm] (0.2, 1.6) rectangle (6, 4.2);
|
| 166 |
+
\fill[blue!8, rounded corners=2mm] (7.3, 1.6) rectangle (10.7, 4.2);
|
| 167 |
+
|
| 168 |
+
% Spectral Affinity Blocks (replacing gating modules g_i)
|
| 169 |
+
% OLD expert 1 -- ALL FROZEN, no fire icon
|
| 170 |
+
\node[spectral_old] (s1) at (1.5, 2.8) {$\boldsymbol{A_1}$\;\textcolor{cyan}{\ding{101}}\\[4pt] \scriptsize $\alpha_1(h)\!=\!\frac{\|A_1 h\|^2}{r\|h\|^2}$};
|
| 171 |
+
|
| 172 |
+
% Dots
|
| 173 |
+
\node[font=\large] at (3.2, 2.8) {$\boldsymbol{\dots}$};
|
| 174 |
+
|
| 175 |
+
% OLD expert t-1
|
| 176 |
+
\node[spectral_old] (stm1) at (4.8, 2.8) {$\boldsymbol{A_{t\text{-}1}}$\;\textcolor{cyan}{\ding{101}}\\[4pt] \scriptsize $\alpha_{t\text{-}1}(h)$};
|
| 177 |
+
|
| 178 |
+
% NEW expert t -- frozen + C5, NO fire icon (parameter-free routing)
|
| 179 |
+
\node[spectral_new] (st) at (9, 2.8) {$\boldsymbol{A_t}$\;\textcolor{cyan}{\ding{101}}\\[4pt] \scriptsize $\alpha_t(h)$};
|
| 180 |
+
% C5 badge on new expert
|
| 181 |
+
\node[c5_badge] at (10.4, 3.3) {C5};
|
| 182 |
+
|
| 183 |
+
% Arrows from input to spectral blocks
|
| 184 |
+
\draw[->, thick, line width=1.2pt] (4.5, 1) -- (4.5, 1.5) -- (4.8, 1.5) -- (4.8, 2.1);
|
| 185 |
+
\draw[->, thick, line width=1.2pt] (2.5, 1) -- (2.5, 1.5) -- (1.5, 1.5) -- (1.5, 2.1);
|
| 186 |
+
\draw[->, thick, line width=1.2pt] (6.5, 1) -- (6.5, 1.5) -- (9, 1.5) -- (9, 2.1);
|
| 187 |
+
|
| 188 |
+
% Calibration Normalization layer
|
| 189 |
+
\node[rectangle, draw=orange!60!black, fill=orange!10, rounded corners=1.5mm,
|
| 190 |
+
minimum width=9.5cm, minimum height=0.6cm, align=center] (calib_bar) at (5, 4.7) {
|
| 191 |
+
\footnotesize Calibration: $\alpha_t^{\text{cal}}(h) = \alpha_t(h)\,/\,\hat{\mu}_t$ \quad\textcolor{gray}{(EMA normalization)}
|
| 192 |
+
};
|
| 193 |
+
|
| 194 |
+
% Arrows from spectral blocks to calibration
|
| 195 |
+
\draw[->, thick, line width=1.2pt] (1.5, 3.5) -- (1.5, 4.4);
|
| 196 |
+
\draw[->, thick, line width=1.2pt] (4.8, 3.5) -- (4.8, 4.4);
|
| 197 |
+
\draw[->, thick, line width=1.2pt] (9, 3.5) -- (9, 4.4);
|
| 198 |
+
|
| 199 |
+
% argmax routing box
|
| 200 |
+
\node[argmax_badge] (argmax) at (5, 5.7) {
|
| 201 |
+
\footnotesize Hard Top-1: $\;t^* = \arg\max_t\;\alpha_t^{\text{cal}}(h)$
|
| 202 |
+
};
|
| 203 |
+
\draw[->, thick, line width=1.2pt] (calib_bar.north) -- (argmax.south);
|
| 204 |
+
|
| 205 |
+
% Output routing weights
|
| 206 |
+
\node[var_a_old] (a1_b) at (1.5, 6.8) {$\alpha_1^{\text{cal}}$};
|
| 207 |
+
\node[var_a_old] (atm1_b) at (4.8, 6.8) {$\alpha_{t\text{-}1}^{\text{cal}}$};
|
| 208 |
+
\node[var_a_new] (at_b) at (9, 6.8) {$\alpha_t^{\text{cal}}$};
|
| 209 |
+
|
| 210 |
+
\draw[->, thick, line width=1.2pt] (argmax.north) -- ++(0, 0.3) -| (a1_b.south);
|
| 211 |
+
\draw[->, thick, line width=1.2pt] (argmax.north) -- ++(0, 0.3) -| (atm1_b.south);
|
| 212 |
+
\draw[->, thick, line width=1.2pt] (argmax.north) -- ++(0, 0.3) -| (at_b.south);
|
| 213 |
+
|
| 214 |
+
% Properties boxes (replacing Initialization/Updating/Imposing constraints)
|
| 215 |
+
\node[prop_box] (p1) at (1.5, 8) {No learnable\\parameters};
|
| 216 |
+
\node[prop_box] (p2) at (4.8, 8) {Drift-free\\routing};
|
| 217 |
+
\node[prop_box] (p3) at (9, 8) {C5 Data-\\Informed Init};
|
| 218 |
+
|
| 219 |
+
% Dashed box around first two properties (like original constraints box)
|
| 220 |
+
\draw[dashed, violet!80!black, thick, rounded corners=2mm]
|
| 221 |
+
(0, 7.3) -- (6.2, 7.3) -- (6.2, 7.8) -- (7, 8) -- (6.2, 8.2) -- (6.2, 8.8) -- (0, 8.8) -- cycle;
|
| 222 |
+
|
| 223 |
+
% Arrow from C5 property to spectral block (like imposing constraints feedback)
|
| 224 |
+
\draw[->, thick, line width=1.2pt] (p3.east) -- ++(1,0) |- (st.east);
|
| 225 |
+
|
| 226 |
+
\node[font=\large\bfseries] at (5, -1.5) {(b) Spectral Routing in SpecRoute};
|
| 227 |
+
|
| 228 |
+
\end{scope}
|
| 229 |
+
|
| 230 |
+
\end{tikzpicture}
|
| 231 |
+
\end{document}
|
improve_gainlora/src/cl_trainer_specroute.py
CHANGED
|
@@ -146,7 +146,9 @@ class SpecRoute_Trainer(Seq2SeqTrainer):
|
|
| 146 |
compute_metrics=None, callbacks=None,
|
| 147 |
lambda_entropy=0.0, use_preconditioning=False,
|
| 148 |
precond_eps=1e-6, entropy_warmup_ratio=0.1,
|
| 149 |
-
n_batches_c5=100, previous_lora_path=None
|
|
|
|
|
|
|
| 150 |
self.previous_lora_path = previous_lora_path
|
| 151 |
if callbacks is None:
|
| 152 |
callbacks = []
|
|
@@ -169,6 +171,13 @@ class SpecRoute_Trainer(Seq2SeqTrainer):
|
|
| 169 |
# C5: Data-Informed Subspace Initialization
|
| 170 |
self.n_batches_c5 = n_batches_c5
|
| 171 |
self._task_covariance = [] # list of {chunk_index: cov_tensor} per layer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
def _save(self, output_dir=None, state_dict=None):
|
| 174 |
# T5 shared embeddings are incompatible with safetensors; force pytorch format
|
|
@@ -497,12 +506,70 @@ class SpecRoute_Trainer(Seq2SeqTrainer):
|
|
| 497 |
break
|
| 498 |
return reg_matrix, reg_trans_matrix, eval(local_dir.split('-')[0]) - 1
|
| 499 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 500 |
def get_reg_matrix(self):
|
| 501 |
"""
|
| 502 |
V11: Project current LoRA A into null-space of old tasks' GPM bases.
|
|
|
|
| 503 |
Also re-initialize prompt_key for learned routing (ROOT-style SVD).
|
| 504 |
"""
|
| 505 |
self.feature_list, self.feature_trans_list, self._cur_task = self.load_previous_reg_matrix()
|
|
|
|
| 506 |
|
| 507 |
# ================================================================
|
| 508 |
# V11: Prompt-key re-initialization (ROOT-style)
|
|
@@ -546,61 +613,186 @@ class SpecRoute_Trainer(Seq2SeqTrainer):
|
|
| 546 |
).to("cuda:0")
|
| 547 |
self.feature_mat.append(feature_mat)
|
| 548 |
|
| 549 |
-
#
|
| 550 |
-
#
|
| 551 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 552 |
if self._task_covariance and i < len(self._task_covariance):
|
| 553 |
r = module.lora_q.lora_A.data.shape[0] # LoRA rank
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 554 |
for index in self.feature_list[i].keys():
|
| 555 |
C_t = self._task_covariance[i][index] # [step, step]
|
| 556 |
P_old = feature_mat[index] # [step, step]
|
| 557 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
C_tilde = Q @ C_t.to(P_old.device) @ Q
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 559 |
# Enforce symmetry and add tiny jitter for numerical stability
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
C_tilde = torch.nan_to_num(C_tilde, nan=0.0, posinf=0.0, neginf=0.0)
|
| 565 |
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
jitter_scale = 1e-10 * (C_tilde.abs().mean() + 1e-12)
|
| 569 |
-
C_tilde += jitter_scale * torch.eye(C_tilde.shape[0], device=C_tilde.device)
|
| 570 |
|
| 571 |
try:
|
| 572 |
-
|
| 573 |
-
eigvals, eigvecs = torch.linalg.eigh(C_tilde.float())
|
| 574 |
except torch._C._LinAlgError as e:
|
| 575 |
-
print(f'[
|
| 576 |
continue
|
| 577 |
|
| 578 |
-
#
|
| 579 |
-
|
| 580 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 581 |
continue
|
| 582 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 583 |
A_init = top_eigvecs.T # [r, step]
|
| 584 |
dtype = module.lora_q.lora_A.data.dtype
|
| 585 |
sl = slice(index * module.step, (index + 1) * module.step)
|
| 586 |
module.lora_q.lora_A.data[:, sl].copy_(A_init.to(dtype))
|
| 587 |
module.lora_v.lora_A.data[:, sl].copy_(A_init.to(dtype))
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 592 |
for index in self.feature_list[i].keys():
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
|
|
|
|
|
|
|
| 597 |
feature_mat[index]
|
| 598 |
)
|
| 599 |
)
|
| 600 |
-
module.lora_v.lora_A.data[:,
|
| 601 |
-
module.lora_v.lora_A.data[:,
|
| 602 |
-
- torch.mm(
|
| 603 |
-
module.lora_v.lora_A.data[:,
|
| 604 |
feature_mat[index]
|
| 605 |
)
|
| 606 |
)
|
|
@@ -775,6 +967,20 @@ class SpecRoute_Trainer(Seq2SeqTrainer):
|
|
| 775 |
for i in range(len(self.feature_list)):
|
| 776 |
torch.save(self.feature_list[i], os.path.join(self.args.output_dir, 'reg_{}.pt'.format(i)))
|
| 777 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 778 |
# Save trans_input GPM bases
|
| 779 |
if getattr(self.model.encoder, "routing_mode", "") == "learned" and hasattr(self, "feature_trans_list"):
|
| 780 |
os.makedirs(os.path.join(self.args.output_dir, 'trans_input'), exist_ok=True)
|
|
|
|
| 146 |
compute_metrics=None, callbacks=None,
|
| 147 |
lambda_entropy=0.0, use_preconditioning=False,
|
| 148 |
precond_eps=1e-6, entropy_warmup_ratio=0.1,
|
| 149 |
+
n_batches_c5=100, previous_lora_path=None,
|
| 150 |
+
cpi_gamma=0.0,
|
| 151 |
+
oap_eta=0.0, oap_beta_min=0.3, oap_warmup=3):
|
| 152 |
self.previous_lora_path = previous_lora_path
|
| 153 |
if callbacks is None:
|
| 154 |
callbacks = []
|
|
|
|
| 171 |
# C5: Data-Informed Subspace Initialization
|
| 172 |
self.n_batches_c5 = n_batches_c5
|
| 173 |
self._task_covariance = [] # list of {chunk_index: cov_tensor} per layer
|
| 174 |
+
# CPI: Contrastive Projected Initialization
|
| 175 |
+
self.cpi_gamma = cpi_gamma
|
| 176 |
+
self._old_covariances = [] # list of per-task covariance lists loaded from disk
|
| 177 |
+
# OAP: Overlap-Aware Projection
|
| 178 |
+
self.oap_eta = oap_eta
|
| 179 |
+
self.oap_beta_min = oap_beta_min
|
| 180 |
+
self.oap_warmup = oap_warmup # T_warmup: tasks before full OAP kicks in
|
| 181 |
|
| 182 |
def _save(self, output_dir=None, state_dict=None):
|
| 183 |
# T5 shared embeddings are incompatible with safetensors; force pytorch format
|
|
|
|
| 506 |
break
|
| 507 |
return reg_matrix, reg_trans_matrix, eval(local_dir.split('-')[0]) - 1
|
| 508 |
|
| 509 |
+
def _load_old_covariances(self):
|
| 510 |
+
"""CPI: Load projected covariance cov_{i}.pt from ALL previous tasks.
|
| 511 |
+
Returns list of per-task covariance dicts [{chunk_idx: tensor}, ...] per layer.
|
| 512 |
+
Outer list: per task, inner list: per layer."""
|
| 513 |
+
if self.cpi_gamma <= 0 or self.cur_task_id == 0:
|
| 514 |
+
self._old_covariances = []
|
| 515 |
+
return
|
| 516 |
+
|
| 517 |
+
log_path = os.path.dirname(self.args.output_dir)
|
| 518 |
+
local_dir = os.path.basename(self.args.output_dir)
|
| 519 |
+
self._old_covariances = []
|
| 520 |
+
|
| 521 |
+
if hasattr(self, "previous_lora_path") and self.previous_lora_path:
|
| 522 |
+
previous_lora_list = self.previous_lora_path.split(',')
|
| 523 |
+
for task_path in previous_lora_list:
|
| 524 |
+
task_covs = []
|
| 525 |
+
i = 0
|
| 526 |
+
for module in self.model.modules():
|
| 527 |
+
if hasattr(module, 'get_feature'):
|
| 528 |
+
path = os.path.join(task_path, "cov_{}.pt".format(i))
|
| 529 |
+
if os.path.exists(path):
|
| 530 |
+
cov = torch.load(path, map_location='cpu')
|
| 531 |
+
task_covs.append(cov)
|
| 532 |
+
else:
|
| 533 |
+
task_covs.append(None)
|
| 534 |
+
i += 1
|
| 535 |
+
self._old_covariances.append(task_covs)
|
| 536 |
+
print(f"[CPI] Loaded covariances from {len(self._old_covariances)} previous tasks (explicit paths)")
|
| 537 |
+
return
|
| 538 |
+
|
| 539 |
+
# Discover previous task dirs by index
|
| 540 |
+
cur_idx = int(local_dir.split('-')[0])
|
| 541 |
+
all_dirs = sorted(os.listdir(log_path))
|
| 542 |
+
for all_dir in all_dirs:
|
| 543 |
+
dir_path = os.path.join(log_path, all_dir)
|
| 544 |
+
if not os.path.isdir(dir_path):
|
| 545 |
+
continue
|
| 546 |
+
try:
|
| 547 |
+
dir_idx = int(all_dir.split('-')[0])
|
| 548 |
+
except (ValueError, IndexError):
|
| 549 |
+
continue
|
| 550 |
+
if dir_idx < cur_idx:
|
| 551 |
+
task_covs = []
|
| 552 |
+
i = 0
|
| 553 |
+
for module in self.model.modules():
|
| 554 |
+
if hasattr(module, 'get_feature'):
|
| 555 |
+
path = os.path.join(dir_path, "cov_{}.pt".format(i))
|
| 556 |
+
if os.path.exists(path):
|
| 557 |
+
cov = torch.load(path, map_location='cpu')
|
| 558 |
+
task_covs.append(cov)
|
| 559 |
+
else:
|
| 560 |
+
task_covs.append(None)
|
| 561 |
+
i += 1
|
| 562 |
+
self._old_covariances.append(task_covs)
|
| 563 |
+
print(f"[CPI] Loaded covariances from {len(self._old_covariances)} previous tasks (auto-discovered)")
|
| 564 |
+
|
| 565 |
def get_reg_matrix(self):
|
| 566 |
"""
|
| 567 |
V11: Project current LoRA A into null-space of old tasks' GPM bases.
|
| 568 |
+
CPI: Use discriminant matrix D_t = C_tilde - gamma * C_bar_old for init.
|
| 569 |
Also re-initialize prompt_key for learned routing (ROOT-style SVD).
|
| 570 |
"""
|
| 571 |
self.feature_list, self.feature_trans_list, self._cur_task = self.load_previous_reg_matrix()
|
| 572 |
+
self._load_old_covariances()
|
| 573 |
|
| 574 |
# ================================================================
|
| 575 |
# V11: Prompt-key re-initialization (ROOT-style)
|
|
|
|
| 613 |
).to("cuda:0")
|
| 614 |
self.feature_mat.append(feature_mat)
|
| 615 |
|
| 616 |
+
# CPI+OAP: Contrastive Projected Initialization + Overlap-Aware Projection
|
| 617 |
+
# D_t = C_tilde - gamma * C_bar_old; A_t = top-r eigvecs of D_t
|
| 618 |
+
# OAP: Q = I - beta_l * P_old (adaptive relaxation per-layer per-chunk)
|
| 619 |
+
# gamma=0 → original C5; gamma>0 → contrastive discriminative init
|
| 620 |
+
# eta=0 → strict InfLoRA; eta>0 → OAP relaxation
|
| 621 |
+
_oap_betas = {} # index -> beta_l, used by InfLoRA projection below
|
| 622 |
+
_diag_layer = {} # diagnostic data per chunk
|
| 623 |
if self._task_covariance and i < len(self._task_covariance):
|
| 624 |
r = module.lora_q.lora_A.data.shape[0] # LoRA rank
|
| 625 |
+
projected_cov_layer = {} # store C_tilde per chunk for saving
|
| 626 |
+
|
| 627 |
+
# Compute weighted C_bar_old for this layer (Weighted CPI)
|
| 628 |
+
# rho_{s,t} = tr(C̃_s · C_t) / (tr(C̃_s) * tr(C_t)) — domain proximity weight
|
| 629 |
+
C_bar_old_layer = {}
|
| 630 |
+
C_bar_weights = {} # idx -> accumulated weight sum
|
| 631 |
+
if self.cpi_gamma > 0 and self._old_covariances:
|
| 632 |
+
for task_covs in self._old_covariances:
|
| 633 |
+
if i < len(task_covs) and task_covs[i] is not None:
|
| 634 |
+
for idx, cov_tensor in task_covs[i].items():
|
| 635 |
+
C_s = cov_tensor.float().cuda()
|
| 636 |
+
# Compute domain-proximity weight rho_{s,t}
|
| 637 |
+
if idx in self._task_covariance[i]:
|
| 638 |
+
C_t_for_w = self._task_covariance[i][idx].to(C_s.device).float()
|
| 639 |
+
tr_s = torch.trace(C_s) + 1e-12
|
| 640 |
+
tr_t = torch.trace(C_t_for_w) + 1e-12
|
| 641 |
+
tr_cross = torch.trace(C_s @ C_t_for_w)
|
| 642 |
+
rho_st = max(0.0, (tr_cross / (tr_s * tr_t)).item())
|
| 643 |
+
else:
|
| 644 |
+
rho_st = 1.0 # fallback: equal weight
|
| 645 |
+
if idx not in C_bar_old_layer:
|
| 646 |
+
C_bar_old_layer[idx] = rho_st * C_s
|
| 647 |
+
C_bar_weights[idx] = rho_st
|
| 648 |
+
else:
|
| 649 |
+
C_bar_old_layer[idx] = C_bar_old_layer[idx] + rho_st * C_s
|
| 650 |
+
C_bar_weights[idx] += rho_st
|
| 651 |
+
for idx in C_bar_old_layer:
|
| 652 |
+
w = C_bar_weights[idx]
|
| 653 |
+
if w > 1e-12:
|
| 654 |
+
C_bar_old_layer[idx] /= w
|
| 655 |
+
|
| 656 |
for index in self.feature_list[i].keys():
|
| 657 |
C_t = self._task_covariance[i][index] # [step, step]
|
| 658 |
P_old = feature_mat[index] # [step, step]
|
| 659 |
+
|
| 660 |
+
# OAP: compute overlap ratio rho_l and adaptive beta_l
|
| 661 |
+
if self.oap_eta > 0:
|
| 662 |
+
# Warmup: eta_eff = eta * min(1, (t-1)/T_warmup)
|
| 663 |
+
t_idx = self.cur_task_id # 0-indexed
|
| 664 |
+
if self.oap_warmup > 0 and t_idx > 0:
|
| 665 |
+
warmup_factor = min(1.0, t_idx / self.oap_warmup)
|
| 666 |
+
else:
|
| 667 |
+
warmup_factor = 1.0
|
| 668 |
+
eta_eff = self.oap_eta * warmup_factor
|
| 669 |
+
# beta_min higher for early tasks (conservative)
|
| 670 |
+
beta_min_eff = self.oap_beta_min if warmup_factor >= 1.0 else max(self.oap_beta_min, 0.7)
|
| 671 |
+
|
| 672 |
+
C_t_f = C_t.to(P_old.device).float()
|
| 673 |
+
P_old_f = P_old.float()
|
| 674 |
+
tr_overlap = torch.trace(P_old_f @ C_t_f)
|
| 675 |
+
tr_total = torch.trace(C_t_f) + 1e-12
|
| 676 |
+
rho_l = (tr_overlap / tr_total).item()
|
| 677 |
+
beta_l = max(beta_min_eff, 1.0 - eta_eff * rho_l)
|
| 678 |
+
_oap_betas[index] = beta_l
|
| 679 |
+
else:
|
| 680 |
+
beta_l = 1.0
|
| 681 |
+
rho_l = 0.0
|
| 682 |
+
_oap_betas[index] = 1.0
|
| 683 |
+
|
| 684 |
+
# Diagnostic: SSE before OAP
|
| 685 |
+
_ct_on_device = C_t.to(P_old.device).float()
|
| 686 |
+
_sse_before = (torch.trace(P_old.float() @ _ct_on_device) / (torch.trace(_ct_on_device) + 1e-12)).item()
|
| 687 |
+
|
| 688 |
+
Q = torch.eye(module.step, device=P_old.device) - beta_l * P_old
|
| 689 |
C_tilde = Q @ C_t.to(P_old.device) @ Q
|
| 690 |
+
|
| 691 |
+
# Diagnostic: SSE after OAP = (1-beta_l)^2 * SSE_before (theoretical)
|
| 692 |
+
_sse_after = (1 - beta_l)**2 * _sse_before
|
| 693 |
+
|
| 694 |
+
# Save projected covariance for future CPI
|
| 695 |
+
projected_cov_layer[index] = C_tilde.detach().cpu()
|
| 696 |
+
|
| 697 |
+
# CPI: subtract old mean covariance
|
| 698 |
+
if self.cpi_gamma > 0 and index in C_bar_old_layer:
|
| 699 |
+
D_t = C_tilde - self.cpi_gamma * C_bar_old_layer[index].to(C_tilde.device)
|
| 700 |
+
else:
|
| 701 |
+
D_t = C_tilde
|
| 702 |
+
|
| 703 |
# Enforce symmetry and add tiny jitter for numerical stability
|
| 704 |
+
D_t = (D_t + D_t.T) * 0.5
|
| 705 |
+
if torch.isnan(D_t).any() or torch.isinf(D_t).any():
|
| 706 |
+
print(f'[CPI] WARNING: Layer {i+1} index {index} contains NaN/Inf in D_t. Cleaning.')
|
| 707 |
+
D_t = torch.nan_to_num(D_t, nan=0.0, posinf=0.0, neginf=0.0)
|
|
|
|
| 708 |
|
| 709 |
+
jitter_scale = 1e-10 * (D_t.abs().mean() + 1e-12)
|
| 710 |
+
D_t += jitter_scale * torch.eye(D_t.shape[0], device=D_t.device)
|
|
|
|
|
|
|
| 711 |
|
| 712 |
try:
|
| 713 |
+
eigvals, eigvecs = torch.linalg.eigh(D_t.float())
|
|
|
|
| 714 |
except torch._C._LinAlgError as e:
|
| 715 |
+
print(f'[CPI] WARNING: Layer {i+1} index {index} - linalg.eigh failed: {e}. Falling back.')
|
| 716 |
continue
|
| 717 |
|
| 718 |
+
# CPI: only use eigenvectors with POSITIVE eigenvalues
|
| 719 |
+
# (negative eigenvalues = directions where old tasks dominate)
|
| 720 |
+
pos_mask = eigvals > 1e-6
|
| 721 |
+
n_pos = int(pos_mask.sum().item())
|
| 722 |
+
n_total = eigvals.shape[0]
|
| 723 |
+
lambda_min_pos = eigvals[pos_mask].min().item() if n_pos > 0 else 0.0
|
| 724 |
+
lambda_max_pos = eigvals[pos_mask].max().item() if n_pos > 0 else 0.0
|
| 725 |
+
|
| 726 |
+
# Store per-chunk diagnostic
|
| 727 |
+
_diag_layer[index] = {
|
| 728 |
+
'rho_l': rho_l, 'beta_l': beta_l,
|
| 729 |
+
'sse_before': _sse_before, 'sse_after': _sse_after,
|
| 730 |
+
'n_pos_eigvals': n_pos, 'n_total_eigvals': n_total,
|
| 731 |
+
'lambda_min_pos': lambda_min_pos, 'lambda_max_pos': lambda_max_pos,
|
| 732 |
+
'lambda_min_pos_over_r': lambda_min_pos / r, # Theorem 3 margin
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
if pos_mask.sum() == 0:
|
| 736 |
+
print(f'[CPI] Layer {i+1} index {index}: no positive eigenvalues, fallback to Kaiming+InfLoRA')
|
| 737 |
continue
|
| 738 |
+
pos_eigvals = eigvals[pos_mask]
|
| 739 |
+
pos_eigvecs = eigvecs[:, pos_mask]
|
| 740 |
+
# Take top-r from positive eigenvalues (sorted ascending by eigh)
|
| 741 |
+
n_take = min(r, pos_eigvals.shape[0])
|
| 742 |
+
top_eigvecs = pos_eigvecs[:, -n_take:].flip(dims=[1]) # [step, n_take]
|
| 743 |
+
if n_take < r:
|
| 744 |
+
# Pad with Kaiming random vectors in null-space
|
| 745 |
+
pad = torch.randn(top_eigvecs.shape[0], r - n_take, device=top_eigvecs.device)
|
| 746 |
+
top_eigvecs = torch.cat([top_eigvecs, pad], dim=1)
|
| 747 |
A_init = top_eigvecs.T # [r, step]
|
| 748 |
dtype = module.lora_q.lora_A.data.dtype
|
| 749 |
sl = slice(index * module.step, (index + 1) * module.step)
|
| 750 |
module.lora_q.lora_A.data[:, sl].copy_(A_init.to(dtype))
|
| 751 |
module.lora_v.lora_A.data[:, sl].copy_(A_init.to(dtype))
|
| 752 |
+
cpi_label = "CPI" if self.cpi_gamma > 0 else "C5"
|
| 753 |
+
oap_info = ""
|
| 754 |
+
if self.oap_eta > 0 and _oap_betas:
|
| 755 |
+
avg_beta = sum(_oap_betas.values()) / len(_oap_betas)
|
| 756 |
+
oap_info = f", OAP avg_beta={avg_beta:.3f}"
|
| 757 |
+
# Diagnostic summary for this layer
|
| 758 |
+
if _diag_layer:
|
| 759 |
+
avg_rho = sum(d['rho_l'] for d in _diag_layer.values()) / len(_diag_layer)
|
| 760 |
+
avg_sse_b = sum(d['sse_before'] for d in _diag_layer.values()) / len(_diag_layer)
|
| 761 |
+
avg_sse_a = sum(d['sse_after'] for d in _diag_layer.values()) / len(_diag_layer)
|
| 762 |
+
avg_lmin = sum(d['lambda_min_pos_over_r'] for d in _diag_layer.values()) / len(_diag_layer)
|
| 763 |
+
avg_npos = sum(d['n_pos_eigvals'] for d in _diag_layer.values()) / len(_diag_layer)
|
| 764 |
+
print(f'[{cpi_label}] Layer {i+1}: A_t init (gamma={self.cpi_gamma}{oap_info}) '
|
| 765 |
+
f'| rho_l={avg_rho:.3f} SSE={avg_sse_b:.3f}->{avg_sse_a:.3f} '
|
| 766 |
+
f'lambda_min+/r={avg_lmin:.4f} n_pos={avg_npos:.1f}/{_diag_layer[list(_diag_layer.keys())[0]]["n_total_eigvals"]}')
|
| 767 |
+
else:
|
| 768 |
+
print(f'[{cpi_label}] Layer {i+1}: A_t initialized (gamma={self.cpi_gamma}{oap_info}).')
|
| 769 |
+
# Store projected covariance for saving later
|
| 770 |
+
if not hasattr(self, '_projected_covariances'):
|
| 771 |
+
self._projected_covariances = []
|
| 772 |
+
self._projected_covariances.append(projected_cov_layer)
|
| 773 |
+
# Store diagnostics for saving
|
| 774 |
+
if not hasattr(self, '_init_diagnostics'):
|
| 775 |
+
self._init_diagnostics = []
|
| 776 |
+
self._init_diagnostics.append(_diag_layer)
|
| 777 |
+
|
| 778 |
+
# InfLoRA / OAP projection
|
| 779 |
+
# OAP: A_t <- A_t(I - beta_l * P_old) instead of A_t <- A_t(I - P_old)
|
| 780 |
+
# beta_l < 1 allows shared directions to remain (Theorem 4: forgetting
|
| 781 |
+
# bounded by p_e * (1-beta_l) * M, gated by routing accuracy)
|
| 782 |
for index in self.feature_list[i].keys():
|
| 783 |
+
beta_l = _oap_betas.get(index, 1.0)
|
| 784 |
+
sl = slice(index * module.step, (index + 1) * module.step)
|
| 785 |
+
module.lora_q.lora_A.data[:, sl].copy_(
|
| 786 |
+
module.lora_q.lora_A.data[:, sl]
|
| 787 |
+
- beta_l * torch.mm(
|
| 788 |
+
module.lora_q.lora_A.data[:, sl],
|
| 789 |
feature_mat[index]
|
| 790 |
)
|
| 791 |
)
|
| 792 |
+
module.lora_v.lora_A.data[:, sl].copy_(
|
| 793 |
+
module.lora_v.lora_A.data[:, sl]
|
| 794 |
+
- beta_l * torch.mm(
|
| 795 |
+
module.lora_v.lora_A.data[:, sl],
|
| 796 |
feature_mat[index]
|
| 797 |
)
|
| 798 |
)
|
|
|
|
| 967 |
for i in range(len(self.feature_list)):
|
| 968 |
torch.save(self.feature_list[i], os.path.join(self.args.output_dir, 'reg_{}.pt'.format(i)))
|
| 969 |
|
| 970 |
+
# CPI: Save projected covariance for future tasks' contrastive init
|
| 971 |
+
_proj_covs = getattr(self, '_projected_covariances', self._task_covariance)
|
| 972 |
+
if _proj_covs:
|
| 973 |
+
for i in range(len(_proj_covs)):
|
| 974 |
+
torch.save(_proj_covs[i], os.path.join(self.args.output_dir, 'cov_{}.pt'.format(i)))
|
| 975 |
+
print(f'[CPI] Saved {len(_proj_covs)} projected covariance matrices.')
|
| 976 |
+
|
| 977 |
+
# Save CPI/OAP diagnostics for post-hoc analysis
|
| 978 |
+
_diag = getattr(self, '_init_diagnostics', None)
|
| 979 |
+
if _diag:
|
| 980 |
+
diag_path = os.path.join(self.args.output_dir, 'init_diagnostics.pt')
|
| 981 |
+
torch.save(_diag, diag_path)
|
| 982 |
+
print(f'[DIAG] Saved init diagnostics to {diag_path}')
|
| 983 |
+
|
| 984 |
# Save trans_input GPM bases
|
| 985 |
if getattr(self.model.encoder, "routing_mode", "") == "learned" and hasattr(self, "feature_trans_list"):
|
| 986 |
os.makedirs(os.path.join(self.args.output_dir, 'trans_input'), exist_ok=True)
|
improve_gainlora/src/run_t5.py
CHANGED
|
@@ -198,6 +198,22 @@ class ModelArguments:
|
|
| 198 |
default=100,
|
| 199 |
metadata={"help": "Number of training batches for C5 activation covariance collection."},
|
| 200 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
run_single: bool = field(
|
| 203 |
default=False,
|
|
@@ -961,7 +977,11 @@ def main():
|
|
| 961 |
precond_eps=model_args.precond_eps,
|
| 962 |
entropy_warmup_ratio=model_args.entropy_warmup_ratio,
|
| 963 |
n_batches_c5=model_args.n_batches_c5,
|
| 964 |
-
previous_lora_path=model_args.previous_lora_path
|
|
|
|
|
|
|
|
|
|
|
|
|
| 965 |
)
|
| 966 |
if training_args.do_train:
|
| 967 |
if not model_args.run_single: # C5 is only useful for tasks t>=2
|
|
@@ -1133,6 +1153,32 @@ def main():
|
|
| 1133 |
with open(os.path.join("logs_and_outputs", training_args.run_name, "outputs", "task_order.txt"), 'w') as f:
|
| 1134 |
f.write(data_args.task_order)
|
| 1135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1136 |
return results
|
| 1137 |
|
| 1138 |
|
|
|
|
| 198 |
default=100,
|
| 199 |
metadata={"help": "Number of training batches for C5 activation covariance collection."},
|
| 200 |
)
|
| 201 |
+
cpi_gamma: Optional[float] = field(
|
| 202 |
+
default=0.0,
|
| 203 |
+
metadata={"help": "CPI contrastive strength. 0=C5 (no contrastive), >0=CPI. Recommended: 0.5."},
|
| 204 |
+
)
|
| 205 |
+
oap_eta: Optional[float] = field(
|
| 206 |
+
default=0.0,
|
| 207 |
+
metadata={"help": "OAP relaxation strength. 0=strict InfLoRA, >0=adaptive relaxation. Recommended: 0.5."},
|
| 208 |
+
)
|
| 209 |
+
oap_beta_min: Optional[float] = field(
|
| 210 |
+
default=0.3,
|
| 211 |
+
metadata={"help": "OAP minimum protection. Lower=more sharing, higher=safer. Range (0,1]."},
|
| 212 |
+
)
|
| 213 |
+
oap_warmup: Optional[int] = field(
|
| 214 |
+
default=3,
|
| 215 |
+
metadata={"help": "OAP warmup: number of tasks before full OAP. Early tasks use conservative beta_min."},
|
| 216 |
+
)
|
| 217 |
|
| 218 |
run_single: bool = field(
|
| 219 |
default=False,
|
|
|
|
| 977 |
precond_eps=model_args.precond_eps,
|
| 978 |
entropy_warmup_ratio=model_args.entropy_warmup_ratio,
|
| 979 |
n_batches_c5=model_args.n_batches_c5,
|
| 980 |
+
previous_lora_path=model_args.previous_lora_path,
|
| 981 |
+
cpi_gamma=model_args.cpi_gamma,
|
| 982 |
+
oap_eta=model_args.oap_eta,
|
| 983 |
+
oap_beta_min=model_args.oap_beta_min,
|
| 984 |
+
oap_warmup=model_args.oap_warmup
|
| 985 |
)
|
| 986 |
if training_args.do_train:
|
| 987 |
if not model_args.run_single: # C5 is only useful for tasks t>=2
|
|
|
|
| 1153 |
with open(os.path.join("logs_and_outputs", training_args.run_name, "outputs", "task_order.txt"), 'w') as f:
|
| 1154 |
f.write(data_args.task_order)
|
| 1155 |
|
| 1156 |
+
# [DIAG] Save routing decision stats for p_e analysis
|
| 1157 |
+
if training_args.model_name == 'specroute' and hasattr(trainer.model.encoder, '_routing_decisions'):
|
| 1158 |
+
routing_decisions = trainer.model.encoder._routing_decisions
|
| 1159 |
+
if routing_decisions:
|
| 1160 |
+
all_decisions = torch.cat(routing_decisions, dim=0) # (N,)
|
| 1161 |
+
n_tasks = len(trainer.model.encoder.spectral_signatures) + 1
|
| 1162 |
+
# Current task is always index 0 in spectral routing
|
| 1163 |
+
# (signatures are ordered: [current, old_1, old_2, ...])
|
| 1164 |
+
routed_to_current = (all_decisions == 0).float().mean().item()
|
| 1165 |
+
diag_msg = (f'[DIAG-ROUTING] Task {cur_task} (id={cur_task_id}): '
|
| 1166 |
+
f'routed_to_current={routed_to_current:.3f} '
|
| 1167 |
+
f'({int((all_decisions == 0).sum())}/{len(all_decisions)}) '
|
| 1168 |
+
f'n_tasks={n_tasks}')
|
| 1169 |
+
print(diag_msg)
|
| 1170 |
+
# Distribution across all tasks
|
| 1171 |
+
for t in range(n_tasks):
|
| 1172 |
+
frac = (all_decisions == t).float().mean().item()
|
| 1173 |
+
print(f' task_idx={t}: {frac:.3f}')
|
| 1174 |
+
# Save routing decisions tensor
|
| 1175 |
+
save_path_diag = training_args.output_dir
|
| 1176 |
+
if not prompt_config["run_single"]:
|
| 1177 |
+
save_path_diag = training_args.output_dir + "/saved_weights"
|
| 1178 |
+
torch.save(all_decisions, os.path.join(save_path_diag, 'routing_decisions.pt'))
|
| 1179 |
+
# Reset for next eval round
|
| 1180 |
+
trainer.model.encoder._routing_decisions = []
|
| 1181 |
+
|
| 1182 |
return results
|
| 1183 |
|
| 1184 |
|
improve_gainlora/src/t5_specroute.py
CHANGED
|
@@ -586,6 +586,13 @@ class T5Stack(T5PreTrainedModel):
|
|
| 586 |
else:
|
| 587 |
self.all_attn_weights.append(key_attention_weights.squeeze(2).mean(dim=0, keepdim=True).detach().to(torch.float).cpu().numpy())
|
| 588 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
self.key_attention_weights = key_attention_weights
|
| 590 |
else:
|
| 591 |
# Decoder or run_single: use whatever was passed (from encoder)
|
|
|
|
| 586 |
else:
|
| 587 |
self.all_attn_weights.append(key_attention_weights.squeeze(2).mean(dim=0, keepdim=True).detach().to(torch.float).cpu().numpy())
|
| 588 |
|
| 589 |
+
# [DIAG] Log routing decisions for p_e measurement
|
| 590 |
+
# For hard Top-1, record which task index was selected per sample
|
| 591 |
+
if not hasattr(self, '_routing_decisions'):
|
| 592 |
+
self._routing_decisions = []
|
| 593 |
+
routed_task_idx = key_attention_weights.squeeze(2).argmax(dim=1) # (B,)
|
| 594 |
+
self._routing_decisions.append(routed_task_idx.detach().cpu())
|
| 595 |
+
|
| 596 |
self.key_attention_weights = key_attention_weights
|
| 597 |
else:
|
| 598 |
# Decoder or run_single: use whatever was passed (from encoder)
|
root_gainlora/root_gainlora.tex
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
\documentclass[border=10pt]{standalone}
|
| 2 |
+
\usepackage{tikz}
|
| 3 |
+
\usetikzlibrary{shapes.geometric, arrows.meta, calc}
|
| 4 |
+
\usepackage{pifont}
|
| 5 |
+
\usepackage{amsmath}
|
| 6 |
+
\usepackage{fontawesome5}
|
| 7 |
+
|
| 8 |
+
\begin{document}
|
| 9 |
+
\begin{tikzpicture}[
|
| 10 |
+
>=stealth,
|
| 11 |
+
font=\sffamily\footnotesize,
|
| 12 |
+
lm_outer/.style={rectangle, draw=blue!60!black, fill=blue!15, thick, rounded corners=4mm, minimum width=4cm, minimum height=5.5cm, align=center},
|
| 13 |
+
lm_inner/.style={rectangle, fill=cyan!5, rounded corners=2mm, minimum width=3.4cm, minimum height=4cm},
|
| 14 |
+
input_box/.style={rectangle, draw=orange!50, fill=orange!20, rounded corners=1mm, text width=5cm, inner sep=4pt, align=left},
|
| 15 |
+
ans_box/.style={rectangle, draw=orange!50, fill=orange!20, font=\bfseries, inner sep=4pt},
|
| 16 |
+
q_h_box/.style={rectangle, draw=yellow!80!orange, fill=yellow!30, rounded corners=1.5mm, minimum width=3cm, minimum height=4mm},
|
| 17 |
+
trap_A_old/.style={trapezium, draw=teal!80!black, fill=green!10, trapezium angle=65, thick, minimum width=1.5cm, minimum height=0.7cm, align=center, shape border rotate=180},
|
| 18 |
+
trap_B_old/.style={trapezium, draw=teal!80!black, fill=green!10, trapezium angle=65, thick, minimum width=1.5cm, minimum height=0.7cm, align=center},
|
| 19 |
+
trap_A_new/.style={trapezium, draw=blue!80!black, fill=blue!10, trapezium angle=65, thick, minimum width=1.5cm, minimum height=0.7cm, align=center, shape border rotate=180},
|
| 20 |
+
trap_B_new/.style={trapezium, draw=blue!80!black, fill=blue!10, trapezium angle=65, thick, minimum width=1.5cm, minimum height=0.7cm, align=center},
|
| 21 |
+
var_w/.style={rectangle, draw=blue!80!black, fill=cyan!10, minimum size=6mm, inner sep=2pt, align=center},
|
| 22 |
+
var_a_old/.style={rectangle, draw=teal!80!black, fill=green!15, minimum size=5mm, inner sep=2pt},
|
| 23 |
+
var_a_new/.style={rectangle, draw=blue!80!black, fill=blue!15, minimum size=5mm, inner sep=2pt},
|
| 24 |
+
gate_old/.style={rectangle, draw=black, thick, fill=gray!20, rounded corners=2mm, minimum width=1.8cm, minimum height=1.2cm, align=center},
|
| 25 |
+
gate_new/.style={rectangle, draw=red!80!black, thick, fill=gray!20, rounded corners=2mm, minimum width=1.8cm, minimum height=1.2cm, align=center},
|
| 26 |
+
const_box/.style={rectangle, draw=blue!80!black, fill=blue!10, text width=1.8cm, align=center, minimum height=0.9cm},
|
| 27 |
+
step_box/.style={rectangle, draw=blue!40, fill=blue!10, text width=2.8cm, align=left, inner sep=3pt},
|
| 28 |
+
plus_op/.style={circle, draw=black, thick, fill=white, inner sep=0pt, minimum size=4.5mm},
|
| 29 |
+
times_op/.style={circle, draw=black, thick, fill=white, inner sep=0pt, minimum size=4.5mm}
|
| 30 |
+
]
|
| 31 |
+
|
| 32 |
+
% =======================================================
|
| 33 |
+
% PHẦN (a) - EXPANDABLE LORA ARCHITECTURE
|
| 34 |
+
% =======================================================
|
| 35 |
+
|
| 36 |
+
% 1. LM Box & Inputs
|
| 37 |
+
\node[input_box] (input_a) at (0, 0) {Someone who had a very bad flight might be given a trip in this to make up for it?\\ \textbf{Option:} (A)first class (B)propitious (C)reputable (D)one (E)sufficient};
|
| 38 |
+
\node[font=\large] at (-3, 0) {$\boldsymbol{x}$};
|
| 39 |
+
|
| 40 |
+
\node[lm_outer] (lm) at (0, 4.5) {};
|
| 41 |
+
\node[font=\bfseries] at (0, 6.8) {Language Models};
|
| 42 |
+
\node[lm_inner] (lm_in) at (0, 4.2) {};
|
| 43 |
+
|
| 44 |
+
\node[ans_box] (ans) at (0, 8.2) {Answer: A};
|
| 45 |
+
\draw[->, thick, line width=1.2pt] (0, 7.25) -- (ans.south);
|
| 46 |
+
|
| 47 |
+
\node[q_h_box] (h) at (0, 2.7) {};
|
| 48 |
+
\node at (-1.8, 2.7) {$\boldsymbol{h}$};
|
| 49 |
+
\node[q_h_box] (q) at (0, 5.7) {};
|
| 50 |
+
\node at (-1.8, 5.7) {$\boldsymbol{q}$};
|
| 51 |
+
|
| 52 |
+
\node[plus_op] (lm_plus) at (0, 4.2) {$\boldsymbol{+}$};
|
| 53 |
+
\node[rectangle, draw=black, fill=white, align=center, font=\scriptsize, minimum width=1.3cm] (W) at (-1.1, 4.2) {Pre-trained\\Weights\\$\boldsymbol{W}$\\\textcolor{cyan}{\ding{101}}};
|
| 54 |
+
\node[var_w] (wt_small) at (1.2, 4.2) {$w_t$};
|
| 55 |
+
|
| 56 |
+
\draw[->, thick, line width=1.2pt] (input_a.north) -- (h.south);
|
| 57 |
+
\draw[->, thick, line width=1.2pt] (h.north) -- (lm_plus.south);
|
| 58 |
+
\draw[->, thick, line width=1.2pt] (lm_plus.north) -- (q.south);
|
| 59 |
+
|
| 60 |
+
% 2. Big Expandable Box
|
| 61 |
+
\draw[black, thick, rounded corners=4mm] (3.5, -0.5) rectangle (16.5, 9);
|
| 62 |
+
|
| 63 |
+
\draw[dashed, thick] (1.5, 4.5) -- (3.5, 9);
|
| 64 |
+
\draw[dashed, thick] (1.5, 3.9) -- (3.5, -0.5);
|
| 65 |
+
|
| 66 |
+
% Legend
|
| 67 |
+
\node[plus_op, minimum size=4mm] at (6.5, 8.5) {$\boldsymbol{+}$};
|
| 68 |
+
\node at (7.5, 8.5) {Addition};
|
| 69 |
+
\node[times_op, minimum size=4mm] at (9.2, 8.5) {$\boldsymbol{\times}$};
|
| 70 |
+
\node at (10.4, 8.5) {Multiplication};
|
| 71 |
+
\node[text=cyan, font=\large] at (12, 8.5) {\ding{101}};
|
| 72 |
+
\node at (12.8, 8.5) {: Frozen};
|
| 73 |
+
|
| 74 |
+
% Đầu ra của Expandable Box
|
| 75 |
+
\node[var_w, minimum size=7mm] (wt_big) at (9.5, 7.5) {$w_t$};
|
| 76 |
+
\node[plus_op] (big_plus) at (9.5, 6) {$\boldsymbol{+}$};
|
| 77 |
+
\draw[->, thick, line width=1.5pt] (big_plus.north) -- (wt_big.south);
|
| 78 |
+
|
| 79 |
+
% Trục Bus ngang
|
| 80 |
+
\draw[thick, line width=1.5pt] (5.5, 4.8) -- (13.5, 4.8);
|
| 81 |
+
\draw[thick, line width=1.5pt] (9.5, 4.8) -- (big_plus.south);
|
| 82 |
+
|
| 83 |
+
% Background Old/New
|
| 84 |
+
\fill[green!15, rounded corners=2mm] (4, 0) rectangle (9.2, 4.5);
|
| 85 |
+
\node[font=\bfseries] at (6.6, -0.2) {Old Branches};
|
| 86 |
+
|
| 87 |
+
\fill[blue!15, rounded corners=2mm] (10.5, 0) rectangle (13.5, 4.5);
|
| 88 |
+
\node[font=\bfseries] at (12, -0.2) {New Branch};
|
| 89 |
+
|
| 90 |
+
% Nhánh 1 (X = 5.5)
|
| 91 |
+
\node[var_a_old] (a1) at (4.5, 4) {$a_1$};
|
| 92 |
+
\node[times_op] (t1_top) at (5.5, 4) {$\boldsymbol{\times}$};
|
| 93 |
+
\node[trap_A_old] (A1) at (5.5, 2.7) {$\boldsymbol{A_1}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 94 |
+
\node[times_op] (t1_bot) at (5.5, 1.5) {$\boldsymbol{\times}$};
|
| 95 |
+
\node[trap_B_old] (B1) at (5.5, 0.5) {$\boldsymbol{B_1}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 96 |
+
|
| 97 |
+
\draw[->, thick, line width=1.5pt] (B1.north) -- (t1_bot.south);
|
| 98 |
+
\draw[->, thick, line width=1.5pt] (t1_bot.north) -- (A1.south);
|
| 99 |
+
\draw[->, thick, line width=1.5pt] (A1.north) -- (t1_top.south);
|
| 100 |
+
\draw[->, thick, line width=1.5pt] (t1_top.north) -- (5.5, 4.8);
|
| 101 |
+
\draw[->, thick, line width=1.2pt] (a1.east) -- (t1_top.west);
|
| 102 |
+
|
| 103 |
+
% Dấu chấm lửng
|
| 104 |
+
\node[font=\large] at (7.2, 2.7) {$\boldsymbol{\dots}$};
|
| 105 |
+
\node[font=\large] at (7.2, 0.5) {$\boldsymbol{\dots}$};
|
| 106 |
+
|
| 107 |
+
% Nhánh t-1 (X = 8.4)
|
| 108 |
+
\node[var_a_old] (atm1) at (7.4, 4) {$a_{t-1}$};
|
| 109 |
+
\node[times_op] (ttm1_top) at (8.4, 4) {$\boldsymbol{\times}$};
|
| 110 |
+
\node[trap_A_old] (Atm1) at (8.4, 2.7) {$\boldsymbol{A_{t-1}}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 111 |
+
\node[times_op] (ttm1_bot) at (8.4, 1.5) {$\boldsymbol{\times}$};
|
| 112 |
+
\node[trap_B_old] (Btm1) at (8.4, 0.5) {$\boldsymbol{B_{t-1}}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 113 |
+
|
| 114 |
+
\draw[->, thick, line width=1.5pt] (Btm1.north) -- (ttm1_bot.south);
|
| 115 |
+
\draw[->, thick, line width=1.5pt] (ttm1_bot.north) -- (Atm1.south);
|
| 116 |
+
\draw[->, thick, line width=1.5pt] (Atm1.north) -- (ttm1_top.south);
|
| 117 |
+
\draw[->, thick, line width=1.5pt] (ttm1_top.north) -- (8.4, 4.8);
|
| 118 |
+
\draw[->, thick, line width=1.2pt] (atm1.east) -- (ttm1_top.west);
|
| 119 |
+
|
| 120 |
+
% Nhánh t (X = 12.5)
|
| 121 |
+
\node[var_a_new] (at) at (11.5, 4) {$a_t$};
|
| 122 |
+
\node[times_op] (tt_top) at (12.5, 4) {$\boldsymbol{\times}$};
|
| 123 |
+
\node[trap_A_new] (At) at (12.5, 2.7) {$\boldsymbol{A_t}$};
|
| 124 |
+
\node[times_op] (tt_bot) at (12.5, 1.5) {$\boldsymbol{\times}$};
|
| 125 |
+
\node[trap_B_new] (Bt) at (12.5, 0.5) {$\boldsymbol{B_t}$\\ \tiny\textcolor{red}{\faFire}};
|
| 126 |
+
|
| 127 |
+
\draw[->, thick, line width=1.5pt] (Bt.north) -- (tt_bot.south);
|
| 128 |
+
\draw[->, thick, line width=1.5pt] (tt_bot.north) -- (At.south);
|
| 129 |
+
\draw[->, thick, line width=1.5pt] (At.north) -- (tt_top.south);
|
| 130 |
+
\draw[->, thick, line width=1.5pt] (tt_top.north) -- (12.5, 4.8);
|
| 131 |
+
\draw[->, thick, line width=1.2pt] (at.east) -- (tt_top.west);
|
| 132 |
+
|
| 133 |
+
% Hộp chú thích Step
|
| 134 |
+
\node[step_box] (step2) at (15, 7.2) {\textbf{2.} Integrating new and\\old LoRA branches};
|
| 135 |
+
\draw[->, thick] (step2.west) -- (wt_big.east);
|
| 136 |
+
|
| 137 |
+
\node[step_box] (step1) at (15, 4.6) {\textbf{1.} Expanding a new\\LoRA branch};
|
| 138 |
+
% \draw[->, thick] (step1.west) -- (tt_top.east);
|
| 139 |
+
|
| 140 |
+
\node[step_box] (step3) at (15, 2) {\textbf{3.} Updating new\\branch to learn new\\task};
|
| 141 |
+
% \draw[->, thick] (step3.west) -- (tt_bot.east);
|
| 142 |
+
|
| 143 |
+
\node[font=\large\bfseries] at (8, -1.5) {(a) Expandable LoRA Architecture in GainLoRA};
|
| 144 |
+
|
| 145 |
+
% =======================================================
|
| 146 |
+
% PHẦN (b) - GATING MODULES
|
| 147 |
+
% =======================================================
|
| 148 |
+
|
| 149 |
+
\begin{scope}[shift={(21.5, 0)}]
|
| 150 |
+
|
| 151 |
+
% Input
|
| 152 |
+
\node[input_box] (input_b) at (4.5, 0) {Someone who had a very bad flight might be given a trip in this to make up for it?\\ \textbf{Option:} (A)first class (B)propitious (C)reputable (D)one (E)sufficient};
|
| 153 |
+
\node[font=\large] at (1.5, 0) {$\boldsymbol{x}$};
|
| 154 |
+
|
| 155 |
+
% Nền Gating
|
| 156 |
+
\fill[green!15, rounded corners=2mm] (0.2, 1.8) rectangle (5.8, 3.5);
|
| 157 |
+
\fill[blue!15, rounded corners=2mm] (7.5, 1.8) rectangle (10.5, 3.5);
|
| 158 |
+
|
| 159 |
+
% Khối Gating
|
| 160 |
+
\node[gate_old] (g1) at (1.5, 2.6) {$\boldsymbol{g_1(\cdot)}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 161 |
+
\node[gate_old] (gtm1) at (4.5, 2.6) {$\boldsymbol{g_{t-1}(\cdot)}$\\ \tiny\textcolor{cyan}{\ding{101}}};
|
| 162 |
+
\node[gate_new] (gt) at (9, 2.6) {$\boldsymbol{g_t(\cdot)}$\\ \tiny\textcolor{cyan}{\ding{101}}\quad\textcolor{red}{\faFire}};
|
| 163 |
+
|
| 164 |
+
\node[font=\large] at (3, 2.6) {$\boldsymbol{\dots}$};
|
| 165 |
+
|
| 166 |
+
% Mũi tên từ x phân bổ lên gating
|
| 167 |
+
\draw[->, thick, line width=1.2pt] (4.5, 1) -- (4.5, 2);
|
| 168 |
+
\draw[->, thick, line width=1.2pt] (2.5, 1) -- (2.5, 1.5) -- (1.5, 1.5) -- (1.5, 2);
|
| 169 |
+
\draw[->, thick, line width=1.2pt] (6.5, 1) -- (6.5, 1.5) -- (9, 1.5) -- (9, 2);
|
| 170 |
+
|
| 171 |
+
% Outputs a_i
|
| 172 |
+
\node[var_a_old] (a1_b) at (1.5, 4.5) {$a_1$};
|
| 173 |
+
\node[var_a_old] (atm1_b) at (4.5, 4.5) {$a_{t-1}$};
|
| 174 |
+
\node[var_a_new] (at_b) at (9, 4.5) {$a_t$};
|
| 175 |
+
|
| 176 |
+
\draw[->, thick, line width=1.2pt] (1.5, 3.2) -- (a1_b.south);
|
| 177 |
+
\draw[->, thick, line width=1.2pt] (4.5, 3.2) -- (atm1_b.south);
|
| 178 |
+
\draw[->, thick, line width=1.2pt] (9, 3.2) -- (at_b.south);
|
| 179 |
+
|
| 180 |
+
% Hộp Constraints
|
| 181 |
+
\node[const_box] (c_init) at (1.5, 6.5) {Initialization\\constraints};
|
| 182 |
+
\node[const_box] (c_update) at (4.5, 6.5) {Updating\\constraints};
|
| 183 |
+
\node[const_box] (c_impose) at (9, 6.5) {Imposing\\constraints};
|
| 184 |
+
|
| 185 |
+
% Khung nét đứt Constraints có mũi nhọn
|
| 186 |
+
\draw[dashed, blue!80!black, thick, rounded corners=2mm]
|
| 187 |
+
(0, 5.5) -- (6, 5.5) -- (6, 6.3) -- (6.8, 6.5) -- (6, 6.7) -- (6, 7.5) -- (0, 7.5) -- cycle;
|
| 188 |
+
|
| 189 |
+
% \draw[->, thick, line width=1.2pt] (4.5, 6.05) -- (atm1_b.north);
|
| 190 |
+
|
| 191 |
+
% Vòng lặp phản hồi
|
| 192 |
+
\draw[->, thick, line width=1.2pt] (c_impose.east) -- ++(1,0) |- (gt.east);
|
| 193 |
+
|
| 194 |
+
\node[font=\large\bfseries] at (5, -1.5) {(b) Gating Modules in GainLoRA};
|
| 195 |
+
|
| 196 |
+
\end{scope}
|
| 197 |
+
|
| 198 |
+
\end{tikzpicture}
|
| 199 |
+
\end{document}
|