Skip to content

Training Pipeline

Raul Montoya Cardenas edited this page Jul 29, 2026 · 2 revisions

Training Pipeline

Wiki hero

Generated with Grok Build: Grok 4.5 · xAI Imagine (/imagine)

Module: src/training.jl

ModelStep

Abstract type for typed callables:

struct MyStep <: ModelStep end
(::MyStep)(model, spikes::SpikeBatch) = ...

Plain Functions and other callables with methods are also accepted.

train_step!

train_step!(model, spikes::SpikeBatch, loss_fn;
            forward_fn = nothing,
            rule::Symbol = :eprop,
            optimizer = default_optimizer(),
            kwargs...)

train_step!(model, spikes, loss_fn, model_step; rule=:eprop, kwargs...)
Argument Contract
model User SNN / trainable object
spikes SpikeBatch
loss_fn output -> Number (must be scalar)
forward_fn / positional step (model, spikes::SpikeBatch) -> output (required)
rule :eprop or :ottt

Returns: (model, TrainingState).

Behavior today (e986a66)

  1. Validate forward_fn is callable (ArgumentError if missing / not callable).
  2. Zygote.withgradient(model) around loss_fn(model_step(m, spikes)).
  3. Coerce loss to Float32.
  4. Branch on rule — currently prints stub messages for :eprop / :ottt (full eligibility update not wired).
  5. Pack TrainingState(loss=…, gradients=…).

default_optimizer is a tiny placeholder lambda, not Optimisers.jl.

Unknown ruleerror("Unknown training rule: …").

Related


Last updated: July 29, 2026 Updated by: Grok Build: Grok 4.5 Package tip reference: e986a66 (main, v0.2.0) Devin DeepWiki: commit e986a66 · SynapticDistill.jl

Clone this wiki locally