ml-rnn-sequencelisted
Install: claude install-skill fieldlu/Machine-learning-skills
# 序列建模路线决策 — 任务定形,再选主干
## R — 原文 (Reading)
> **来源说明**: 本 skill 属扩充批D——主题超出西瓜书覆盖范围(西瓜书第 5、10 章未系统涉及循环网络),R 段改引序列建模奠基文献并标注来源性质;凡无法保证逐字精确处一律标(转述)。
> Long Short-Term Memory is designed to overcome the error back-flow problems of conventional RNNs: constant error carousels (memory cell with input and output gates) allow errors to flow back through time without vanishing or blowing up.(转述)
>
> — 转述自 S. Hochreiter & J. Schmidhuber, "Long Short-Term Memory", Neural Computation (1997)(来源性质:奠基论文公认表述)
> Encoder-decoder architectures compress a variable-length source sequence into a fixed-length vector, which becomes an information bottleneck for long sentences; Bahdanau et al. let the decoder softly attend to all encoder states weighted by relevance instead.(转述)
>
> — 转述自 K. Cho 等 "Learning Phrase Representations using RNN Encoder-Decoder"(EMNLP 2014)、I. Sutskever 等 "Sequence to Sequence Learning"(NeurIPS 2014)、D. Bahdanau 等 "Neural Machine Translation by Jointly Learning to Align and Translate"(ICLR 2015)(来源性质:奠基论文公认表述)
---
## I — 方法论骨架 (Interpretation)
序列建模的路线选择分三步走:**先给任务定形,再诊断时序训练的病,最后按数据规模和工程约束选主干。**
- **第一步·任务定形**(决定结构出口): 多对一(整段序列→一个输出,如情感分类);一对一(逐帧预测,如词性标注);多对多同步(等长映射);多对多异步(编码器读入→解码器生成,长度不等,如翻译);以及流式(边收边出,如在线识别)。出口形态定了,才谈得上选哪族单元。
- **第二步·病因认识**: 普通 RNN 把历史压进一个不断被覆写的隐状态,BPTT 沿时间反传的连乘让远距离误差指数消失或爆炸——这是 BP 梯度消失的**时序版**。门控机制是对症药:LSTM 用细胞状态+输入/输出/遗忘三门,让信息沿"传送带"近乎无衰减地穿越时间步,由门决定何时写入/读出/清空;GRU 是其简化变体(更新门+重置门),参数更少、效果多数场合相当。
- **第三步·路线边界**: seq2seq 把变长输入压成固定向量造成信息瓶颈——长句翻译质量骤降;注意力