SignatureAugmentedAttention<T>

Models & Types · AiDotNet.Finance.Portfolio

SIT’s signature-augmented attention bias (Hwang and Zohren, arXiv:2510.03129): Logits = QK^T / sqrt(d_k) + gamma * B, where B carries pairwise lead-lag evidence.

For Beginners

Attention decides how much each asset should “look at” each other asset. This nudges those decisions using evidence about which asset tends to move first.

How It Works

The distinguishing choice is WHERE the signature information enters. Prior signature work feeds signatures in as input features or uses signature kernels OUTSIDE the attention mechanism; SIT injects cross-asset signature evidence as a dynamic, query-conditioned bias INSIDE attention, so pairwise signed-area evidence modulates which assets attend to which at each decision point.

The bias is query-conditioned rather than a fixed lookup: b_{h,j,l} = <(q^dyn_j)_h, (beta_{j,l})_h>, with q^dyn_j = MLP_q(x_j) and beta_{j,l} = MLP_beta(c_{j,l}). A static bias built from the cross-signature alone could not let the current market state decide how much a given lead-lag relationship matters right now.

The bias is not symmetrized. Lead-lag is directional and the underlying signed area is antisymmetric, so b_{j,l} and b_{l,j} are meant to differ — symmetrizing would reduce the signal to something a correlation could already express and discard the asymmetry the method is built on.

Constructors

Constructor Summary
SignatureAugmentedAttention(double gammaLogit) Creates the bias module.

Properties

Property Summary
double Gamma { get; } Gets the effective bias gate gamma = softplus(gammaHat).
double GammaLogit { get; set; } Gets or sets the raw pre-softplus gate parameter.

Methods

Method Summary
Tensor<T> ApplyBias(Tensor<T> logits, Tensor<T> bias) Adds the gated bias to attention logits: logits + gamma * bias.
Tensor<T> ComputeBias(Tensor<T> dynamicQueries, Tensor<T> relationalEmbeddings) Computes the per-head bias matrix b_{h,j,l} = <(q^dyn_j)_h, (beta_{j,l})_h>.
Tensor<T> ScaledDotProductLogits(Tensor<T> queries, Tensor<T> keys) Scaled dot-product logits QK^T / sqrt(d_k) for one head.
double Softplus(double x) Numerically stable softplus, positive for every finite input.