Principle:ARISE Initiative Robomimic Algorithm Instantiation
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Imitation_Learning, Offline_RL |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
A factory-based algorithm construction pattern that creates fully-initialized neural network models from algorithm names and configuration objects, supporting polymorphic instantiation across diverse robot learning algorithm families.
Description
Algorithm Instantiation resolves an algorithm name (e.g., "bc", "bcq", "cql") to a concrete algorithm class and constructs a fully-initialized model with all required neural networks. This pattern is essential because robomimic supports nine distinct algorithm families spanning imitation learning (BC, Diffusion Policy), offline reinforcement learning (BCQ, CQL, IQL, TD3+BC), goal-conditioned learning (GL), and hierarchical methods (HBC, IRIS).
Each algorithm class defines its own network architecture, loss functions, and training procedures, yet they all share a common Algo base class interface. The factory pattern enables a single training loop implementation to work with any algorithm.
The algorithm hierarchy follows this structure:
- Algo - Base class with train_on_batch, process_batch_for_training, log_info
- PolicyAlgo - Adds get_action for rollout evaluation
- ValueAlgo - Adds value function interfaces
- PlannerAlgo - Adds subgoal planning
- HierarchicalAlgo - Composes multiple sub-algorithms
Usage
Use this principle after dataset loading, since the algorithm constructor needs observation key shapes and action space dimension derived from the dataset metadata. The instantiated algorithm is then used in the training loop and for rollout evaluation.
Theoretical Basis
The Algorithm Instantiation principle uses a two-level factory pattern:
# Abstract pattern (not real implementation)
# Level 1: Registry maps algo_name -> factory_func
REGISTERED_ALGOS = {"bc": bc_factory, "bcq": bcq_factory, ...}
# Level 2: Factory func returns (algo_class, extra_kwargs)
def bc_factory(algo_config):
return BC, {}
# Instantiation chains both levels:
def algo_factory(algo_name, config, obs_key_shapes, ac_dim, device):
factory_func = REGISTERED_ALGOS[algo_name]
algo_cls, algo_kwargs = factory_func(config.algo)
return algo_cls(
algo_config=config.algo,
obs_config=config.observation,
obs_key_shapes=obs_key_shapes,
ac_dim=ac_dim,
device=device,
**algo_kwargs
)
The two-level design allows algorithm variants (e.g., BC_RNN, BC_GMM) to be selected based on config flags within a single registry entry.