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)
Trainable low-order support recurrence at exact P4 cadence.
Parameters
input_dimint- default=1278. Native input-channel count.
route_feature_dimint- default=118. Width of aggregated route features.
token_dimint- default=58. Width of each encoded P4 token.
state_dimint- default=16. Temporal state width.
patch_sizeint- default=4. Native timesteps represented by one block.
output_dimint- default=2. Readout-channel count; Lite requires two.
morphology_idstuple[str, ...]- default=(). Ordered morphology identity vocabulary.
behavior_adaptationbool- 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)
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
configSupportP4Config- required. Model configuration; use the defaults and constraints documented for its configuration class.
route_featurestorch.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()AdaptiveSupportP4Surrogate.aggregate_inputs()AdaptiveSupportP4Surrogate.compile_adaptation()AdaptiveSupportP4Surrogate.initial_state()AdaptiveSupportP4Surrogate.step_token()AdaptiveSupportP4Surrogate.step_p4()AdaptiveSupportP4Surrogate.forward_feature_summaries()AdaptiveSupportP4Surrogate.forward_runtime_coefficients()AdaptiveSupportP4Surrogate.forward_with_gate_features()AdaptiveSupportP4Surrogate.forward()
AdaptiveSupportP4Surrogate.reset_parameters
axosim.support_surrogate.AdaptiveSupportP4Surrogate.reset_parameters() -> None
Initialize the model’s learned parameters.
Returns
resultNone- No return value.
AdaptiveSupportP4Surrogate.aggregate_inputs
axosim.support_surrogate.AdaptiveSupportP4Surrogate.aggregate_inputs(inputs: torch.Tensor, *, morphology_indices: torch.Tensor) -> torch.Tensor
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
inputstorch.Tensor- required. Native input traces or the input tensor supplied to this operation.
morphology_indicestorch.Tensor- keyword-only, required. Integer class assignments into the model's ordered morphology vocabulary; one per batch item or persistent neuron.
Returns
summariestorch.Tensor- Morphology-routed features (batch,time,route_feature_dim).
AdaptiveSupportP4Surrogate.compile_adaptation
axosim.support_surrogate.AdaptiveSupportP4Surrogate.compile_adaptation(behavior_parameters: torch.Tensor) -> torch.Tensor
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_parameterstorch.Tensor- required. Logical behavior coefficients to compile into the model's deployed coefficient width.
Returns
coefficientstorch.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
Allocate the initial temporal state.
Allocates a zero state with shape (batch_size,state_dim) on the requested device/dtype.
Parameters
batch_sizeint- required. Examples processed per batch.
devicetorch.device- keyword-only, required. Execution or allocation device.
dtypetorch.dtype- keyword-only, required. Floating-point execution or allocation dtype.
Returns
statetorch.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]
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
tokentorch.Tensor- required. One encoded P4 token.
statetorch.Tensor- required. Temporal state returned by the matching initial-state or allocation method.
adaptation_cachetorch.Tensor | None- keyword-only, required. Compiled behavior coefficients; use the declared cache width for the neuron model.
Returns
forecasttorch.Tensor- Decoded next-block prediction (batch,4,2).
statetorch.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]
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_patchtorch.Tensor- required. Four native timesteps of routed features to encode as one token.
statetorch.Tensor- required. Temporal state returned by the matching initial-state or allocation method.
behavior_parameterstorch.Tensor | None- keyword-only, default=None. Logical behavior coefficients to compile into the model's deployed coefficient width.
adaptation_cachetorch.Tensor | None- keyword-only, default=None. Compiled behavior coefficients; use the declared cache width for the neuron model.
Returns
forecasttorch.Tensor- Decoded next-block prediction (batch,4,2).
statetorch.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
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
summariestorch.Tensor- required. Morphology-routed input-feature summaries.
morphology_indicestorch.Tensor | None- keyword-only, default=None. Integer class assignments into the model's ordered morphology vocabulary; one per batch item or persistent neuron.
behavior_parameterstorch.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
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
summariestorch.Tensor- required. Morphology-routed input-feature summaries.
runtime_coefficientstorch.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]
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
inputstorch.Tensor- required. Native input traces or the input tensor supplied to this operation.
morphology_indicestorch.Tensor | None- keyword-only, default=None. Integer class assignments into the model's ordered morphology vocabulary; one per batch item or persistent neuron.
behavior_parameterstorch.Tensor | None- keyword-only, default=None. Logical behavior coefficients to compile into the model's deployed coefficient width.
Returns
predictiontorch.Tensor- Native output trace (batch,time,2).
gate_featurestorch.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
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
inputstorch.Tensor- required. Native input traces or the input tensor supplied to this operation.
morphology_indicestorch.Tensor | None- keyword-only, default=None. Integer class assignments into the model's ordered morphology vocabulary; one per batch item or persistent neuron.
behavior_parameterstorch.Tensor | None- keyword-only, default=None. Logical behavior coefficients to compile into the model's deployed coefficient width.
Returns
predictiontorch.Tensor- Spike-logit and soma-target channels in the tensor shape specified above.