Hidden State Design¶
The core innovation of STRATA is its structured, interpretable hidden state:
h = [bias, momentum, trap_risk, uncertainty]
bias ∈ [-1, 1] directional conviction
momentum ∈ [ 0, 1] structural energy
trap_risk ∈ [ 0, 1] adverse selection risk
uncertainty ∈ [ 0, 1] volatility ambiguity
Hard Bounds¶
Unlike LSTM/GRU where hidden state values are unconstrained, StrataNet enforces hard bounds at every timestep via activation functions:
# In StrataCoreCell.forward():
bias = torch.tanh(h_candidate[:, 0:1]) # [-1, 1]
momentum = torch.sigmoid(h_candidate[:, 1:2]) # [ 0, 1]
trap_risk = torch.sigmoid(h_candidate[:, 2:3]) # [ 0, 1]
uncertainty = torch.sigmoid(h_candidate[:, 3:4]) # [ 0, 1]
h_new = torch.cat([bias, momentum, trap_risk, uncertainty], dim=-1)
This means the hidden state is always in a semantically valid range, even at random initialization.
Semantic Meaning¶
bias — Directional Conviction¶
bias > 0→ bullish conviction (model has learned bullish pattern)bias < 0→ bearish convictionbias ≈ 0→ neutral / uncertain direction- Magnitude → strength of conviction
momentum — Structural Energy¶
- High
momentum→ price is breaking structure, high volume, trend strength - Low
momentum→ choppy, consolidating, no directional energy - Feeds into action decision: LONG/SHORT requires sufficient momentum
trap_risk — Adverse Selection Risk¶
- High
trap_risk→ model has learned patterns associated with liquidity traps (fake breakouts, sudden reversals, thin book) - Low
trap_risk→ clean market structure, safe to act - GUARD uses this to block actions when
trap_risk > threshold
uncertainty — Volatility Ambiguity¶
- High
uncertainty→ high ATR relative to norm, ambiguous regime - Low
uncertainty→ stable regime, high-confidence conditions - Confidence output is penalised when
uncertaintyis high
Reading the hidden state¶
result = model.predict_action(x)
h = result["state"]
# Interpret:
if h["bias"] > 0.5 and h["trap_risk"] < 0.3:
print("Strong bullish signal, low trap risk — LONG candidate")
elif h["trap_risk"] > 0.6:
print("High trap risk — avoid trading")
elif abs(h["bias"]) < 0.2:
print("Neutral — HOLD")
Comparison to LSTM Cell State¶
LSTM has two hidden vectors: h_t (hidden) and c_t (cell state).
Neither has semantic meaning — they are opaque learned representations.
StrataNet has one 4-dim vector where each dimension is always interpretable. A trader can read these values in real-time and understand why the model is making a particular decision.