Skip to content

Commit b40fea2

Browse files
committed
补强中英文模型文档的原理层说明与公式表达,完善序列建模路线的技术叙述
1. 在 CNN、ResNet、BiLSTM、mLSTM 页面补充核心计算形式与结构动机,包括卷积扫描、残差连接、LSTM 门控与矩阵记忆更新。 2. 在 Transformer、Linear Transformer、iTransformer 页面补充标准注意力、线性注意力近似与通道维建模视角,强化不同注意力路线的差异说明。 3. 在 Mamba、RWKV 页面补充状态空间递推与递归加权聚合的高层公式,明确其长程序列建模逻辑。 4. 在 DNA foundation model、MAE、fusion 页面补充预训练表示流水线、重建目标与融合数学形式,完善表示学习与配对交互层的说明。 5. 中英文文档同步扩写,保留原有页面结构与历史内容,不引入构建产物。 6. 重新构建 Sphinx 文档,确认页面可生成且没有新的文档 warning。
1 parent 0bf368c commit b40fea2

24 files changed

Lines changed: 431 additions & 12 deletions

doc/source/en/BiLSTMModel.rst

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,32 @@ Architecture summary
2323
- Hidden width: 256 per direction
2424
- Output: concatenated forward/backward final states
2525

26+
At each step, an LSTM updates gates and memory through:
27+
28+
.. math::
29+
30+
i_t = \sigma(W_i x_t + U_i h_{t-1} + b_i)
31+
32+
.. math::
33+
34+
f_t = \sigma(W_f x_t + U_f h_{t-1} + b_f)
35+
36+
.. math::
37+
38+
o_t = \sigma(W_o x_t + U_o h_{t-1} + b_o)
39+
40+
.. math::
41+
42+
\tilde{c}_t = \tanh(W_c x_t + U_c h_{t-1} + b_c)
43+
44+
.. math::
45+
46+
c_t = f_t \odot c_{t-1} + i_t \odot \tilde{c}_t, \qquad
47+
h_t = o_t \odot \tanh(c_t)
48+
49+
The bidirectional encoder runs this recurrence in both directions so that each
50+
output representation can reflect both upstream and downstream context.
51+
2652
Why this helps for EPI
2753
++++++++++++++++++++++
2854

@@ -33,6 +59,9 @@ not confined to a single motif window. A BiLSTM can model:
3359
- local-to-mid-range contextual accumulation;
3460
- asymmetric sequence signals that plain pooling may wash out.
3561

62+
This matters when the functional meaning of a motif depends on order, nearby
63+
context, or the sequence of several local events rather than on isolated hits.
64+
3665
Strengths
3766
+++++++++
3867

@@ -55,4 +84,3 @@ benchmark. It helps answer whether explicit sequential recurrence remains useful
5584
after introducing Transformer-style, state-space, and foundation-model routes.
5685

5786
.. image:: ../img/div.png
58-

doc/source/en/CNNModels.rst

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ layers are naturally suited for:
1919
- offering relatively stable optimization and efficient training;
2020
- providing strong baseline performance without requiring external pretraining.
2121

22+
At the operator level, a 1D convolution behaves like a trainable motif scanner:
23+
24+
.. math::
25+
26+
h_t = \sigma\!\left(\sum_{c=1}^{C}\sum_{i=0}^{k-1} w_{c,i}\,x_{c,t+i} + b\right)
27+
28+
where :math:`x` is the multi-channel sequence input, :math:`k` is the kernel
29+
width, and :math:`h_t` is the activation at position :math:`t`. Each filter can
30+
be interpreted as a learned detector for short sequence patterns and their
31+
local variants.
32+
2233
M1: CNN single-branch baseline
2334
++++++++++++++++++++++++++++++
2435

@@ -36,6 +47,10 @@ Interpretation:
3647
already produce non-trivial predictive signal.
3748
- It is intentionally simple and easy to compare against more expressive models.
3849

50+
Because it avoids pair fusion and avoids recurrent or attention mechanisms, M1
51+
is the cleanest answer to a foundational question: how far can local feature
52+
detectors and hierarchical pooling go on their own?
53+
3954
M2: CNN dual-branch baseline
4055
++++++++++++++++++++++++++++
4156

@@ -52,6 +67,15 @@ Why it matters:
5267
- Separate branches let the model preserve region-specific representations
5368
before interaction modeling.
5469

70+
Its computation can be summarized as:
71+
72+
.. math::
73+
74+
h_e = f_e(x_e), \qquad h_p = f_p(x_p), \qquad z = \mathrm{Fuse}(h_e, h_p)
75+
76+
This makes the architecture explicitly separate the two encoding problems
77+
before asking a fusion layer to model compatibility, asymmetry, or synergy.
78+
5579
M3: k-mer embedding plus CNN
5680
++++++++++++++++++++++++++++
5781

@@ -69,6 +93,16 @@ Why use k-mers:
6993
- They can sometimes make biologically meaningful subsequence patterns easier to
7094
capture than raw one-hot channels alone.
7195

96+
Formally, the input representation becomes:
97+
98+
.. math::
99+
100+
s = (t_1, \dots, t_n), \qquad e_i = E[t_i]
101+
102+
where :math:`t_i` is a k-mer token and :math:`E` is the embedding table. The
103+
CNN then operates over token vectors rather than raw nucleotide channels, which
104+
places M3 between classical motif CNNs and language-model style representations.
105+
72106
Shared strengths
73107
++++++++++++++++
74108

@@ -95,4 +129,3 @@ work. For that reason, it plays two roles at once:
95129
- practical baseline against which all later architectures are evaluated.
96130

97131
.. image:: ../img/div.png
98-

doc/source/en/DNAFoundationModels.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ Two usage modes
2727
head;
2828
- finetune mode: update the backbone with a smaller learning rate.
2929

30+
In representation terms, the pipeline is:
31+
32+
.. math::
33+
34+
\text{DNA sequence} \rightarrow \text{tokenizer} \rightarrow \text{pretrained backbone}
35+
\rightarrow \text{sequence embedding} \rightarrow \text{task head}
36+
37+
The scientific question is whether broad genomic pretraining has already
38+
captured regulatory priors that a project-level dataset would struggle to learn
39+
from scratch.
40+
3041
Why multiple backbones are useful
3142
+++++++++++++++++++++++++++++++++
3243

@@ -46,4 +57,3 @@ learning. It asks whether external genomic prior knowledge can outperform or
4657
complement task-specific training from raw sequence encodings.
4758

4859
.. image:: ../img/div.png
49-

doc/source/en/FusionStrategies.rst

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,39 @@ Supported strategies
1616
- ``bilinear``
1717
- ``concat_sub_mul``
1818

19+
If enhancer and promoter embeddings are written as :math:`h_e` and :math:`h_p`,
20+
the main fusion forms can be summarized as:
21+
22+
.. math::
23+
24+
\mathrm{concat}: [h_e; h_p]
25+
26+
.. math::
27+
28+
\mathrm{add}: h_e + h_p
29+
30+
.. math::
31+
32+
\mathrm{subtract}: h_e - h_p
33+
34+
.. math::
35+
36+
\mathrm{multiply}: h_e \odot h_p
37+
38+
.. math::
39+
40+
\mathrm{concat\_sub\_mul}: [h_e; h_p; h_e - h_p; h_e \odot h_p]
41+
1942
Why fusion matters
2043
++++++++++++++++++
2144

2245
Even a strong encoder can underperform if the pairwise interaction layer is too
2346
weak. Fusion determines how much relational information between enhancer and
2447
promoter embeddings is exposed to the classifier.
2548

49+
This is why fusion should not be treated as a minor implementation detail. It
50+
defines what kinds of pair structure the classifier is allowed to see directly.
51+
2652
Interpretation of the main options
2753
++++++++++++++++++++++++++++++++++
2854

@@ -43,4 +69,3 @@ balanced representation-rich option without requiring the parameter overhead of
4369
full bilinear interaction.
4470

4571
.. image:: ../img/div.png
46-

doc/source/en/LinearTransformerModel.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,28 @@ Project implementation highlights
2121
- Attention: ELU+1 kernel feature map
2222
- Pooling: mean pooling over sequence positions
2323

24+
The key approximation replaces softmax attention with feature maps:
25+
26+
.. math::
27+
28+
\mathrm{Attn}(Q, K, V) \approx
29+
\frac{\phi(Q)\big(\phi(K)^\top V\big)}
30+
{\phi(Q)\big(\phi(K)^\top \mathbf{1}\big)}
31+
32+
where :math:`\phi(\cdot)` is a positive kernel feature map such as ELU+1. This
33+
reorders the computation so sequence length scaling becomes linear in style.
34+
2435
Why it matters for EPI
2536
++++++++++++++++++++++
2637

2738
This model asks an important question: can we keep the global interaction flavor
2839
of attention while scaling better to long DNA sequences than a standard
2940
Transformer?
3041

42+
That question matters directly for genomic inputs because long-range regulatory
43+
dependencies are scientifically relevant, but full quadratic attention becomes
44+
costly exactly in the length regime where those dependencies matter most.
45+
3146
Strengths
3247
+++++++++
3348

@@ -44,4 +59,3 @@ Limitations
4459
relevant to the task.
4560

4661
.. image:: ../img/div.png
47-

doc/source/en/MAEModel.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ The model uses a Masked Autoencoder style workflow:
1515
3. reconstruct the masked content;
1616
4. reuse the learned encoder for supervised EPI prediction.
1717

18+
The reconstruction objective can be written as:
19+
20+
.. math::
21+
22+
\mathcal{L}_{\mathrm{MAE}} =
23+
\frac{1}{|\mathcal{M}|}\sum_{i \in \mathcal{M}}
24+
\ell(\hat{x}_i, x_i)
25+
26+
where :math:`\mathcal{M}` is the masked patch set and :math:`\ell` measures how
27+
well the decoder recovers hidden sequence content.
28+
1829
Why this is different from M13
1930
+++++++++++++++++++++++++++++++
2031

@@ -40,6 +51,10 @@ Implementation logic
4051
- Pretraining objective: masked reconstruction
4152
- Finetuning objective: paired enhancer-promoter classification
4253

54+
This means the encoder is first optimized to model sequence structure without
55+
labels, then repurposed as a supervised feature extractor for the downstream
56+
interaction task.
57+
4358
Project role
4459
++++++++++++
4560

@@ -51,4 +66,3 @@ This model gives the documentation a full representation-learning ladder:
5166
- in-project self-supervised pretraining.
5267

5368
.. image:: ../img/div.png
54-

doc/source/en/MambaModel.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ Project implementation
2020
- Fallback runtime: PyTorch approximation that preserves pipeline usability
2121
- Output: sequence mean pooling after stacked blocks
2222

23+
At a high level, the selective state-space update can be summarized as:
24+
25+
.. math::
26+
27+
h_t = \bar{A}(x_t) h_{t-1} + \bar{B}(x_t) x_t, \qquad
28+
y_t = C(x_t) h_t
29+
30+
Unlike fixed-coefficient state-space models, the transition depends on the
31+
current input, which is why Mamba can adapt its memory behavior to sequence
32+
content.
33+
2334
Why this matters in practice
2435
++++++++++++++++++++++++++++
2536

@@ -43,4 +54,3 @@ The fallback path is useful for portability and pipeline validation, but should
4354
not be treated as identical to the optimized implementation.
4455

4556
.. image:: ../img/div.png
46-

doc/source/en/RWKVModel.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,28 @@ Project implementation highlights
2424
- Channel component: per-position feed-forward style mixing
2525
- Stabilization: log-space handling in the recurrent weighting path
2626

27+
Its weighted key-value accumulation can be viewed schematically as a decayed
28+
running summary:
29+
30+
.. math::
31+
32+
s_t = \alpha_t \odot s_{t-1} + \beta_t \odot v_t, \qquad
33+
y_t = \frac{s_t}{z_t}
34+
35+
where the decay terms control how much old evidence is retained and the
36+
normalization path keeps the recurrent aggregation numerically stable.
37+
2738
Why this is relevant for EPI
2839
++++++++++++++++++++++++++++
2940

3041
Enhancer-promoter prediction needs more than isolated motif hits. RWKV offers an
3142
alternative way to accumulate sequence evidence across long contexts while
3243
avoiding classic quadratic attention.
3344

45+
This makes RWKV attractive when the task depends on gradual evidence
46+
accumulation across many positions rather than only on a few sharp token-token
47+
links.
48+
3449
Strengths
3550
+++++++++
3651

@@ -45,4 +60,3 @@ Limitations
4560
- requires careful numerical treatment for stable sequence accumulation.
4661

4762
.. image:: ../img/div.png
48-

doc/source/en/ResNetModels.rst

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ line in the most classical way:
1818
- deepen the network substantially;
1919
- use skip connections to stabilize optimization and preserve gradient flow.
2020

21+
Residual formulation
22+
++++++++++++++++++++
23+
24+
The defining idea of a residual block is to learn a correction rather than a
25+
full replacement transform:
26+
27+
.. math::
28+
29+
y = F(x; W) + x
30+
31+
Here, :math:`x` is the block input and :math:`F(x; W)` is the learned residual
32+
branch. The identity shortcut creates a direct information and gradient path,
33+
which is why much deeper convolutional stacks remain trainable.
34+
2135
Relationship to earlier resource limits
2236
+++++++++++++++++++++++++++++++++++++++
2337

@@ -52,6 +66,22 @@ Compared with a plain CNN stack, a residual network offers:
5266
- better preservation of lower-level features while building higher-level
5367
abstractions.
5468

69+
In a typical block, the residual path can be written as:
70+
71+
.. math::
72+
73+
F(x; W) = \mathrm{Conv}_2(\sigma(\mathrm{BN}(\mathrm{Conv}_1(x))))
74+
75+
and when shape changes require adjustment, the shortcut becomes:
76+
77+
.. math::
78+
79+
y = F(x; W) + W_s x
80+
81+
with :math:`W_s` denoting a projection on the skip path. This gives the model a
82+
clean way to preserve motif-scale evidence while progressively adding higher
83+
level context.
84+
5585
Why ResNet still matters for genomic sequence modeling
5686
++++++++++++++++++++++++++++++++++++++++++++++++++++++
5787

@@ -62,6 +92,13 @@ For regulatory DNA tasks, deeper convolution can be useful when the aim is to:
6292
- stay within the convolutional inductive-bias family without jumping directly
6393
to attention or state-space formalisms.
6494

95+
From a genomic modeling standpoint, this naturally supports a hierarchy:
96+
97+
- early layers detect motif-like sequence signatures;
98+
- middle layers compose motifs into local regulatory modules;
99+
- deeper layers summarize wider context without erasing the earlier evidence
100+
path.
101+
65102
Documentation role
66103
++++++++++++++++++
67104

@@ -70,4 +107,3 @@ active registry is centered on ``M1-M14``, ResNet should be treated as a
70107
documented, expected branch of the project rather than an obsolete footnote.
71108

72109
.. image:: ../img/div.png
73-

0 commit comments

Comments
 (0)