12 Optimizers for Training Neural Networks, clearly explained!
AI coding agents 通常不會跨 session 保留知識,因而重複過去的錯誤,且無法在不同工具之間轉移 context。由 Asymptote Labs 開發的 Beacon 是一個開源 memory layer,旨在擷取超過 20 種 agent harness 的 execution traces,將過去的問題解決過程轉化為可重用的 skills。它可在本機端運作或透過 Beacon Cloud 運行,後者提供每小時分析,針對 security risks、reusable skills 和 behavioral inefficiencies 產出 findings。此外,像 beacon handoff 等功能讓工程師能夠在不同的 coding agents 與團隊之間無縫轉移 session context。選擇 optimizer 需要在 training steps 的數量與每一步(per-step)的 memory 和 compute overheads 之間取得平衡。常見的 optimization techniques 因其 gradient history、state memory 需求以及 coordinate transformation 方法而有所不同。雖然 AdamW 仍然是 transformers 等模型的強大標準 baseline,但 Adafactor 和 Lion 等替代方案可降低 memory footprints,而像 Shampoo、SOAP 和 Muon 這類基於矩陣(matrix-based)的方法則會改變 parameter geometry。評估 optimizer 需要在標準化的訓練約束條件下,追蹤 wall-clock time、memory consumption 以及 learning-rate sensitivity。建置並將 machine learning 模型部署到 production 包含六個完整的步驟,其中模型訓練與演算法選擇僅佔工作量的一小部分。整個流程始於 problem formulation 與 KPI 定義,接著是大量的 data preparation、演算法與 framework 選擇、迭代式的 model training,以及包含 bias testing 在內的嚴謹 evaluation。最後階段則需要 containerization、cloud deployment,以及持續性的 monitoring 來防範 data drift。整體 pipeline 高度依賴 engineering、infrastructure 和 MLOps 實踐,而非單純的演算法設計。
閱讀原文 ↗你的 AI coding agents 應該要在每次使用時變得更聰明
AI coding agents 通常不會跨 session 保留知識,因而重複過去的錯誤,且無法在不同工具之間轉移 context。由 Asymptote Labs 開發的 Beacon 是一個開源 memory layer,旨在擷取超過 20 種 agent harness 的 execution traces,將過去的問題解決過程轉化為可重用的 skills。它可在本機端運作或透過 Beacon Cloud 運行,後者提供每小時分析,針對 security risks、reusable skills 和 behavioral inefficiencies 產出 findings。此外,像 beacon handoff 等功能讓工程師能夠在不同的 coding agents 與團隊之間無縫轉移 session context。
- AI coding agents 通常會遺失 session context,在後續的 session 以及不同工具間重複犯下相同的錯誤。
- Beacon 是由 Asymptote Labs 開發的開源 memory layer,可記錄 execution traces,讓知識能夠跨 agent harnesses 重複使用。
- 該工具支援跨 agent 相容性,涵蓋超過 20 種 harnesses,包含 Claude Code、Cursor、Codex、OpenCode 和 Cline。
- Beacon Cloud 提供 agent 活動的每小時審查,將 findings 分類為 security risks、reusable skills 和 behavioral patterns。
- beacon handoff 功能讓使用者無需重新解釋 codebase 或重複經歷失敗的步驟,即可切換 agents 或在團隊成員之間交接工作。
用於訓練神經網路的 12 種 optimizers
選擇 optimizer 需要在 training steps 的數量與每一步(per-step)的 memory 和 compute overheads 之間取得平衡。常見的 optimization techniques 因其 gradient history、state memory 需求以及 coordinate transformation 方法而有所不同。雖然 AdamW 仍然是 transformers 等模型的強大標準 baseline,但 Adafactor 和 Lion 等替代方案可降低 memory footprints,而像 Shampoo、SOAP 和 Muon 這類基於矩陣(matrix-based)的方法則會改變 parameter geometry。評估 optimizer 需要在標準化的訓練約束條件下,追蹤 wall-clock time、memory consumption 以及 learning-rate sensitivity。
- 若 optimizer 的 per-step compute overhead 明顯較高,即使所需的 step 數較少,整體的總訓練時間仍可能更長。
- 標準的 Adam 會維護兩個 FP32 state buffers,在進行 sharding 或 compression 之前,針對 10 億參數(one-billion-parameter)的模型大約會消耗 8 GB 的 memory。
- Adafactor 透過 row 和 column factorization 將 second-moment memory 從 O(nm) 降至 O(n+m),而 Lion 則透過對 blended momentum 套用 sign 操作,完全省去了 second-moment buffer。
- 像 Shampoo、SOAP 和 Muon 這類 matrix optimizers 能捕捉跨 parameter dimensions 的方向關係,而不只是對 coordinates 進行 elementwise 的 scaling。
- Muon 使用 Newton-Schulz iterations 來正交化(orthogonalize)矩陣 momentum 更新,通常會與另一種 optimizer 搭配使用,以處理 embeddings 和 vector parameters。
建構 ML 模型的 6 個步驟
建置並將 machine learning 模型部署到 production 包含六個完整的步驟,其中模型訓練與演算法選擇僅佔工作量的一小部分。整個流程始於 problem formulation 與 KPI 定義,接著是大量的 data preparation、演算法與 framework 選擇、迭代式的 model training,以及包含 bias testing 在內的嚴謹 evaluation。最後階段則需要 containerization、cloud deployment,以及持續性的 monitoring 來防範 data drift。整體 pipeline 高度依賴 engineering、infrastructure 和 MLOps 實踐,而非單純的演算法設計。
- 模型建置包含六個明確的步驟:problem definition、data preparation、algorithm selection、training、evaluation 以及包含 monitoring 的 deployment。
- 演算法選擇與 training 通常僅佔將模型推向 production 所需總工作量的 15% 左右。
- Data preparation 是最耗時的階段,需要進行資料清洗、feature engineering 以及適當的 train/validation/test splitting。
- Evaluation 需要與問題相關的 metrics(例如 accuracy、precision、recall、F1、AUC),以及跨不同族群(segments)的 fairness 與 bias testing。
- 部署後的維護需要持續進行 monitoring,以即時發現隨時間發生的 data drift 與效能衰退(degradation)。