API reference

Lite neuron and configuration

Signatures, parameters, return contracts, and source for lite neuron and configuration.

Overview

AxoSimLite aliases AdaptiveSupportP4Surrogate. Route features have shape (morphologies, input_dim, route_feature_dim). The Lite neuron forecasts four native outputs from preceding input blocks; sequence losses should mask the first four causal padding positions. SupportP4Config requires positive dimensions, patch_size=4, output_dim=2, and at least one morphology ID.

Source revision: caef7be03abd. Public export index.

SupportP4Config

axosim.support_surrogate.SupportP4Config(input_dim: int = 1278, route_feature_dim: int = 118, token_dim: int = 58, state_dim: int = 16, patch_size: int = 4, output_dim: int = 2, morphology_ids: tuple[str, ...] = (), behavior_adaptation: bool = True)

Source

Trainable low-order support recurrence at exact P4 cadence.

Parameters

input_dim int
default=1278. Native input-channel count.
route_feature_dim int
default=118. Width of aggregated route features.
token_dim int
default=58. Width of each encoded P4 token.
state_dim int
default=16. Temporal state width.
patch_size int
default=4. Native timesteps represented by one block.
output_dim int
default=2. Readout-channel count; Lite requires two.
morphology_ids tuple[str, ...]
default=(). Ordered morphology identity vocabulary.
behavior_adaptation bool
default=True. Enable the learned behavior adaptation bank.

Attributes

Constructor fields are retained as read-only attributes.

AdaptiveSupportP4Surrogate

axosim.support_surrogate.AdaptiveSupportP4Surrogate(config: SupportP4Config, route_features: torch.Tensor)

Source

Learned support dynamics with compiled neuron adaptation.

Bases: nn.Module.

route_features must match (len(config.morphology_ids),config.input_dim,config.route_feature_dim). They are cloned as a fixed floating-point buffer. Runtime cache width is 2token_dim+3state_dim+2*(patch_size*output_dim).

Parameters

config SupportP4Config
required. Model configuration; use the defaults and constraints documented for its configuration class.
route_features torch.Tensor
required. Fixed morphology-conditioned route-feature tensor.

Read-only attributes

AdaptiveSupportP4Surrogate.patch_size: int
Native timesteps represented by one forecast block. Source
AdaptiveSupportP4Surrogate.gate_feature_dim: int
Width of the concatenated token and state gate features. Source
AdaptiveSupportP4Surrogate.runtime_coefficient_slices: dict[str, slice]
Named packed slices of the direct deployed adaptation coefficients. Source

Methods

AdaptiveSupportP4Surrogate.reset_parameters

axosim.support_surrogate.AdaptiveSupportP4Surrogate.reset_parameters() -> None

Source

Initialize the model’s learned parameters.

Returns

result None
No return value.

AdaptiveSupportP4Surrogate.aggregate_inputs

axosim.support_surrogate.AdaptiveSupportP4Surrogate.aggregate_inputs(inputs: torch.Tensor, *, morphology_indices: torch.Tensor) -> torch.Tensor

Source

Project input histories through morphology-conditioned route features.

inputs is (B,T,input_dim), and morphology_indices is integer (B,). Selects each item’s route feature bank and returns feature summaries (B,T,route_feature_dim).

Parameters

inputs torch.Tensor
required. Native input traces or the input tensor supplied to this operation.
morphology_indices torch.Tensor
keyword-only, required. Integer class assignments into the model's ordered morphology vocabulary; one per batch item or persistent neuron.

Returns

summaries torch.Tensor
Morphology-routed features (batch,time,route_feature_dim).

AdaptiveSupportP4Surrogate.compile_adaptation

axosim.support_surrogate.AdaptiveSupportP4Surrogate.compile_adaptation(behavior_parameters: torch.Tensor) -> torch.Tensor

Source

Project logical behavior rows into deployed runtime coefficients.

behavior_parameters is (B,behavior_parameter_count). Returns compiled coefficients (B,cache_width). Raises ValueError if the configuration disables the adaptation compiler or the width is incompatible.

Parameters

behavior_parameters torch.Tensor
required. Logical behavior coefficients to compile into the model's deployed coefficient width.

Returns

coefficients torch.Tensor
Compiled adaptation coefficients (batch,cache_width).

AdaptiveSupportP4Surrogate.initial_state

axosim.support_surrogate.AdaptiveSupportP4Surrogate.initial_state(batch_size: int, *, device: torch.device, dtype: torch.dtype) -> torch.Tensor

Source

Allocate the initial temporal state.

Allocates a zero state with shape (batch_size,state_dim) on the requested device/dtype.

Parameters

batch_size int
required. Examples processed per batch.
device torch.device
keyword-only, required. Execution or allocation device.
dtype torch.dtype
keyword-only, required. Floating-point execution or allocation dtype.

Returns

state torch.Tensor
Zero tensor (batch_size,state_dim) on the selected device and dtype.

AdaptiveSupportP4Surrogate.step_token

axosim.support_surrogate.AdaptiveSupportP4Surrogate.step_token(token: torch.Tensor, state: torch.Tensor, *, adaptation_cache: torch.Tensor | None) -> tuple[torch.Tensor, torch.Tensor]

Source

Advance the support recurrence and decode one four-step forecast.

token is (B,token_dim), state is (B,state_dim), and optional adaptation_cache is (B,cache_width). Returns (forecast,next_state) with shapes (B,4,2) and (B,state_dim). This low-level step returns the decoded forecast directly.

Parameters

token torch.Tensor
required. One encoded P4 token.
state torch.Tensor
required. Temporal state returned by the matching initial-state or allocation method.
adaptation_cache torch.Tensor | None
keyword-only, required. Compiled behavior coefficients; use the declared cache width for the neuron model.

Returns

forecast torch.Tensor
Decoded next-block prediction (batch,4,2).
state torch.Tensor
Updated recurrent state (batch,state_dim).

AdaptiveSupportP4Surrogate.step_p4

axosim.support_surrogate.AdaptiveSupportP4Surrogate.step_p4(feature_patch: torch.Tensor, state: torch.Tensor, *, behavior_parameters: torch.Tensor | None=None, adaptation_cache: torch.Tensor | None=None) -> tuple[torch.Tensor, torch.Tensor]

Source

Encode a four-step feature patch and advance the support recurrence.

feature_patch is (B,4,route_feature_dim) and state is (B,state_dim). Supply either logical behavior_parameters or compiled adaptation_cache. Returns (forecast,next_state) with shapes (B,4,2) and (B,state_dim).

Parameters

feature_patch torch.Tensor
required. Four native timesteps of routed features to encode as one token.
state torch.Tensor
required. Temporal state returned by the matching initial-state or allocation method.
behavior_parameters torch.Tensor | None
keyword-only, default=None. Logical behavior coefficients to compile into the model's deployed coefficient width.
adaptation_cache torch.Tensor | None
keyword-only, default=None. Compiled behavior coefficients; use the declared cache width for the neuron model.

Returns

forecast torch.Tensor
Decoded next-block prediction (batch,4,2).
state torch.Tensor
Updated recurrent state (batch,state_dim).

AdaptiveSupportP4Surrogate.forward_feature_summaries

axosim.support_surrogate.AdaptiveSupportP4Surrogate.forward_feature_summaries(summaries: torch.Tensor, *, morphology_indices: torch.Tensor | None=None, behavior_parameters: torch.Tensor | None=None) -> torch.Tensor

Source

summaries is (B,T,route_feature_dim), with T>0. Select logical adaptation by morphology_indices or supply behavior_parameters when configured. Returns (B,T,2) with four initial causal padding positions.

Parameters

summaries torch.Tensor
required. Morphology-routed input-feature summaries.
morphology_indices torch.Tensor | None
keyword-only, default=None. Integer class assignments into the model's ordered morphology vocabulary; one per batch item or persistent neuron.
behavior_parameters torch.Tensor | None
keyword-only, default=None. Logical behavior coefficients to compile into the model's deployed coefficient width.

Returns

torch.Tensor

AdaptiveSupportP4Surrogate.forward_runtime_coefficients

axosim.support_surrogate.AdaptiveSupportP4Surrogate.forward_runtime_coefficients(summaries: torch.Tensor, *, runtime_coefficients: torch.Tensor) -> torch.Tensor

Source

Run with direct deployed coefficients instead of a compiler.

summaries is (B,T,route_feature_dim), and runtime_coefficients must be (B,cache_width). Bypasses the logical adaptation compiler and returns (B,T,2) with the same causal padding as the summary sequence path.

Parameters

summaries torch.Tensor
required. Morphology-routed input-feature summaries.
runtime_coefficients torch.Tensor
keyword-only, required. Direct deployed adaptation coefficients, with shape (batch, cache_width).

Returns

torch.Tensor

AdaptiveSupportP4Surrogate.forward_with_gate_features

axosim.support_surrogate.AdaptiveSupportP4Surrogate.forward_with_gate_features(inputs: torch.Tensor, *, morphology_indices: torch.Tensor | None=None, behavior_parameters: torch.Tensor | None=None) -> tuple[torch.Tensor, torch.Tensor]

Source

Return predictions and their existing causal token/state values.

inputs is (B,T,input_dim); morphology_indices is required. Returns (predictions,gate_features) with shapes (B,T,2) and (B,floor(T/4),token_dim+state_dim). Gate features are shifted causally by one block, and their first block is zero.

Parameters

inputs torch.Tensor
required. Native input traces or the input tensor supplied to this operation.
morphology_indices torch.Tensor | None
keyword-only, default=None. Integer class assignments into the model's ordered morphology vocabulary; one per batch item or persistent neuron.
behavior_parameters torch.Tensor | None
keyword-only, default=None. Logical behavior coefficients to compile into the model's deployed coefficient width.

Returns

prediction torch.Tensor
Native output trace (batch,time,2).
gate_features torch.Tensor
Causally shifted token/state features (batch,floor(time/4),token_dim+state_dim), with a zero first block.

AdaptiveSupportP4Surrogate.forward

axosim.support_surrogate.AdaptiveSupportP4Surrogate.forward(inputs: torch.Tensor, *, morphology_indices: torch.Tensor | None=None, behavior_parameters: torch.Tensor | None=None) -> torch.Tensor

Source

Predict native spike and soma outputs for the supplied sequence.

inputs is (batch,native_steps,input_dim), with one morphology index per batch item where required. Return shape is (batch,native_steps,2). Mask the first four causal padding positions.

Parameters

inputs torch.Tensor
required. Native input traces or the input tensor supplied to this operation.
morphology_indices torch.Tensor | None
keyword-only, default=None. Integer class assignments into the model's ordered morphology vocabulary; one per batch item or persistent neuron.
behavior_parameters torch.Tensor | None
keyword-only, default=None. Logical behavior coefficients to compile into the model's deployed coefficient width.

Returns

prediction torch.Tensor
Spike-logit and soma-target channels in the tensor shape specified above.

Search guides, examples, and API signatures.