You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SKaiNET ships a Gru recurrent layer but no LSTM. Two concrete consumers are blocked:
Parakeet FastConformer-TDT ASR (SKaiNET-parakeet): the TDT prediction network is a
2-layer LSTM (hidden 640). This blocks running nvidia/parakeet-tdt-0.6b-v3 and the German primeline/parakeet-primeline on the SKaiNET stack.
Silero VAD (coraldevboard PLAN item 4.1): "needs new LSTM layer upstream (GRU is the
template)" β the last runtime-Python piece of the SL2610 demo.
Transducer-style decoding additionally needs a single-step form: one token at a time with
the recurrent state (h, c) carried by the caller β which is also exactly the shape that lowers
to a fixed-shape StableHLO graph (state as graph I/O, no loop construct needed).
Summary: Add Lstm to skainet-lang-core mirroring Gru (unrolled, primitive-ops-only),
plus an explicit-state step() API (LstmState) required by transducer decoders.
π A: ASSESS β Feasibility & Impact
βοΈ Feasibility
Direct analog of Gru.kt: built from existing primitives (matmul/add/narrow/sigmoid/tanh/ multiply/reshape/unsqueeze/concat) β no new TensorOps op, no new converter; traces to
StableHLO exactly like Gru.
One extra state tensor (cell c) vs Gru; 4 gates vs 3.
βοΈ Expected Impact
Unblocks Parakeet-TDT and Silero VAD; completes the recurrent-layer pair (GRU+LSTM).
The step()/LstmState pattern establishes the idiom for streaming/transducer models.
βοΈ Risks / Constraints
Gate order: PyTorch order i, f, g, o must be pinned in docs and tests, or imported
weights silently produce garbage.
Dual biases: PyTorch keeps b_ih and b_hh separately; keep both for weight-map fidelity
(mathematically summable).
π§ D: DOCUMENT β Problem & Opportunity
SKaiNET ships a
Grurecurrent layer but no LSTM. Two concrete consumers are blocked:2-layer LSTM (hidden 640). This blocks running
nvidia/parakeet-tdt-0.6b-v3and the Germanprimeline/parakeet-primelineon the SKaiNET stack.template)" β the last runtime-Python piece of the SL2610 demo.
Transducer-style decoding additionally needs a single-step form: one token at a time with
the recurrent state (h, c) carried by the caller β which is also exactly the shape that lowers
to a fixed-shape StableHLO graph (state as graph I/O, no loop construct needed).
Summary: Add
Lstmtoskainet-lang-coremirroringGru(unrolled, primitive-ops-only),plus an explicit-state
step()API (LstmState) required by transducer decoders.π A: ASSESS β Feasibility & Impact
βοΈ Feasibility
Gru.kt: built from existing primitives (matmul/add/narrow/sigmoid/tanh/ multiply/reshape/unsqueeze/concat) β no newTensorOpsop, no new converter; traces toStableHLO exactly like Gru.
c) vs Gru; 4 gates vs 3.βοΈ Expected Impact
step()/LstmStatepattern establishes the idiom for streaming/transducer models.βοΈ Risks / Constraints
weights silently produce garbage.
b_ihandb_hhseparately; keep both for weight-map fidelity(mathematically summable).
Gruexactly (matmul-ready[in, 4H]/
[H, 4H]weights).βοΈ Dependencies
skainet-lang-coreprimitives. Autodiff via the standard tape (unrolled).π R: RESEARCH β What Must Be Understood First?
torch.nn.LSTMcontract: gate order i,f,g,o;weight_ih_l{k} [4H, in],weight_hh_l{k} [4H, H], dual biases; recurrencec' = fβc + iβtanh(g),h' = oβtanh(c')β https://docs.pytorch.org/docs/stable/generated/torch.nn.LSTM.htmlGru.ktas the in-repo design template (unroll-at-trace-time, matmul-ready weights).torch.nn.LSTM(stacked, batch-first) β weightimport must be layer-by-layer single-layer cells to keep the step() API.
Gru.step()/GruStatein the same PR? (proposed: yes,follow-up acceptable)
π οΈ C: CODE β Implementation Plan
Development Tasks
skainet-lang-core/.../nn/Lstm.kt:Lstm<T, V>module β sequence forward[B,S,in] β [B,S,H](unrolled, h0=c0=0) +step(xt, state, ctx): Pair<out, LstmState>+
LstmState<T, V>(h, c)+initialState(batch, ctx)GruTestin skainet-backend-cpu)step()consistency test: sequence forward == iteratedstep()outputs.apidump sync (apiCheck)feature/lstm-layerβdevelop)Acceptance Criteria
torch.nn.LSTMgolden β€ 1e-5 (G2 gate of SKaiNET-parakeet)lstm-stepplanned)