smolvla
smolvla
¶
SmolVLA decoder with interleaved cross-attention and self-attention.
SmolVLADecoder
¶
SmolVLADecoder(input_keys, action_space, action_heads, observation_space, observation_horizon, prediction_horizon, device, vlm_backbone, expert_width_multiplier=0.75, num_expert_layers=-1, num_vlm_layers=16, self_attention_every_n_layers=2, proprioceptive_feature_key=None, min_period=0.004, max_period=4.0, freeze_vlm=True, normalization_type=value, activation=value, dropout=0.1)
Bases: BaseInterleavedVLMDecoder
SmolVLA decoder with interleaved VLM and expert processing.
Alternates between joint self-attention (expert attends alongside VLM tokens) and cross-attention (expert attends to VLM key/values) layers.
Initialize the SmolVLA decoder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_keys
|
list[str]
|
Feature keys from the encoding pipeline. |
required |
action_space
|
ActionSpace
|
Action space configuration. |
required |
action_heads
|
dict[str, ActionHead]
|
Exactly one joint action prediction head. |
required |
observation_space
|
ObservationSpace
|
Observation space configuration. |
required |
observation_horizon
|
int
|
Number of observation timesteps. |
required |
prediction_horizon
|
int
|
Number of action steps to predict. |
required |
device
|
str
|
Device string. |
required |
vlm_backbone
|
GenerativeVLM
|
Generative VLM backbone that builds the raw
observation prefix with shape |
required |
expert_width_multiplier
|
float
|
Expert hidden size as fraction of VLM hidden size. |
0.75
|
num_expert_layers
|
int
|
Number of expert layers. |
-1
|
num_vlm_layers
|
int
|
Number of VLM layers to use (truncates if fewer than available). |
16
|
self_attention_every_n_layers
|
int
|
Period for joint self-attention layers.
|
2
|
proprioceptive_feature_key
|
str | None
|
Feature key for proprioceptive state from the encoding pipeline. When set, the feature is prepended to the VLM prefix before interleaved processing. None disables state prepend. |
None
|
min_period
|
float
|
Minimum period for sinusoidal timestep embedding. |
0.004
|
max_period
|
float
|
Maximum period for sinusoidal timestep embedding. |
4.0
|
freeze_vlm
|
bool
|
Whether to freeze VLM layer parameters (disable gradients). |
True
|
normalization_type
|
str
|
Normalization layer type. |
value
|
activation
|
str
|
Activation function for expert feedforward layers. |
value
|
dropout
|
float
|
Dropout rate. |
0.1
|
Source code in src/versatil/models/decoding/decoders/factory/smolvla.py
build_action_expert
¶
Create SmolVLA expert layers and projections from VLM internals.
Note
This is called by BaseInterleavedVLMDecoder.set_vlm_backbone()
after the full VLM backbone is attached.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vlm_layers
|
ModuleList
|
VLM transformer layers used by the interleaved decoder. |
required |
rotary_emb
|
Module
|
VLM rotary positional encoding module. |
required |
vlm_hidden_dimension
|
int
|
VLM hidden dimension. |
required |
vlm_text_config
|
PretrainedConfig
|
HuggingFace text config for the VLM language tower. |
required |
Source code in src/versatil/models/decoding/decoders/factory/smolvla.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
forward
¶
Run VLM prefix layers and expert suffix layers with cross-attention.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
dict[str, Tensor]
|
Encoded observation features from the encoding pipeline. |
required |
actions
|
dict[str, Tensor] | None
|
Noisy action tensors keyed by action name. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Tensor]
|
Predicted action tensors keyed by action name. |