Branch Summaries
A trxns branch can contain many field vectors from earlier payments and the latest payment. Reduction determines how much of that encoded collection reaches the parent. It follows the field interactions within the branch.
This explanation follows the 0.2.4 reduction implementation.
Choose What Reaches The Parent
| Reduction | Context passed to the parent | Main tradeoff |
|---|---|---|
rf.Attention(n_outputs=K) |
K learned summary vectors |
Learns which evidence to collect into a limited context. |
rf.Mean() |
One average of present token vectors | Simple and parameter-free at the reduction step. |
None |
The encoded token sequence | Retains more detail and increases the parent’s token count. |
These choices concern reduction. A mean reduction can still follow a learned branch encoder. Configure the branch’s attention separately; see the Branch reference.
Learned attention starts with trainable query vectors. Each query attends to the branch’s present memory and collects a summary. Multiple outputs provide multiple learned views of the same history; their meanings emerge during training.
Why An Average Loses Multiplicity
An attention head combines values with normalized weights:
\[ s = \sum_i \alpha_i v_i, \qquad \sum_i \alpha_i = 1. \]
If every value vector is the same vector \(v\), this expression returns \(v\) whether the memory contains one copy or many. A mean has the same limitation. This is a statement about that normalized combination of identical values. Other parts of a network, including positional signals and earlier encoder updates, can supply information about sequence length.
At a common account-review cutoff, multiplicity may matter: several retained payments can carry different evidence from one payment even when their merchants and amounts are identical. RelFlow’s learned branch reduction includes additive evidence alongside attention.
Additive Evidence
The learned reduction adds two trainable contributions to each normalized attention summary:
- A projection of the sum of present branch input vectors, scaled by the square root of the configured capacity.
- A learned direction scaled by the number of present tokens divided by that capacity.
Both contributions start at zero, so training decides how much to use them. The branch provides the additive evidence from its tokens before the sequence encoder; these tokens already include any coordinate attention. Absent tokens contribute neither values nor counts.
The count here is a token count. Fields can supply several tokens, and nested branch outputs can add further tokens. It is not directly a count of transactions or a sum of payment amounts. The model must learn how those vector and count signals relate to each transaction’s dispute target for the 30 days after the common review cutoff.
This mechanism supplies information that a normalized average can discard. It does not make the model an exact calculator or guarantee extrapolation to longer histories. Use the canonical proofs to inspect recorded evidence, and validate the reduction choice on the application’s held-out observations.
Next, follow the summaries through Tree Routing And Decoding.