LocoFormer (wip)
LocoFormer - Generalist Locomotion via Long-Context Adaptation
The gist is they trained a simple Transformer-XL in simulation on robots with many different bodies (cross-embodiment) and extreme domain randomization. When transferring to the real-world, they noticed the robot now gains the ability to adapt to insults. The XL memories span across multiple trials, which allowed the robot to learn in-context adaptation.
Install
$ pip install locoformer
Usage
import torch
from locoformer.locoformer import Locoformer
# mock robot embodied with some state dimensions and action dimensions
locoformer = Locoformer(
embedder = dict(
dim = 512,
dim_state = [32, 16], # support multiple bodies / robots
),
unembedder = dict(
num_continuous = 12 + 6,
selectors = [
list(range(12)),
list(range(12, 12 + 6))
]
),
transformer = dict(
dim = 512,
depth = 6,
heads = 8,
window_size = 32
)
)
# mock state from one of the robots (0th one)
state = torch.randn(1, 1, 32)
# forward to get action logits
action_logits, _ = locoformer(
state,
state_embed_kwargs = dict(state_type = 'raw'),
state_id_kwarg = dict(state_id = 0),
action_select_kwargs = dict(selector_index = 0)
)
# sample action using the internal distribution
action = locoformer.unembedder.sample(action_logits, selector_index = 0) # (1, 1, 12)
Sponsors
This open sourced work is sponsored by Safe Sentinel
Citations
@article{liu2025locoformer,
title = {LocoFormer: Generalist Locomotion via Long-Context Adaptation},
author = {Liu, Min and Pathak, Deepak and Agarwal, Ananye},
journal = {Conference on Robot Learning ({CoRL})},
year = {2025}
}
@inproceedings{anonymous2025flow,
title = {Flow Policy Gradients for Legged Robots},
author = {Anonymous},
booktitle = {Submitted to The Fourteenth International Conference on Learning Representations},
year = {2025},
url = {https://openreview.net/forum?id=BA6n0nmagi},
note = {under review}
}
@misc{ashlag2025stateentropyregularizationrobust,
title = {State Entropy Regularization for Robust Reinforcement Learning},
author = {Yonatan Ashlag and Uri Koren and Mirco Mutti and Esther Derman and Pierre-Luc Bacon and Shie Mannor},
year = {2025},
eprint = {2506.07085},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2506.07085},
}
@misc{osband2026delightfulpolicygradient,
title = {Delightful Policy Gradient},
author = {Ian Osband},
year = {2026},
eprint = {2603.14608},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2603.14608},
}
@misc{schwarzer2021dataefficientreinforcementlearningselfpredictive,
title = {Data-Efficient Reinforcement Learning with Self-Predictive Representations},
author = {Max Schwarzer and Ankesh Anand and Rishab Goel and R Devon Hjelm and Aaron Courville and Philip Bachman},
year = {2021},
eprint = {2007.05929},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2007.05929},
}
@misc{teoh2026nextlatentpredictiontransformerslearn,
title = {Next-Latent Prediction Transformers Learn Compact World Models},
author = {Jayden Teoh and Manan Tomar and Kwangjun Ahn and Edward S. Hu and Tim Pearce and Pratyusha Sharma and Akshay Krishnamurthy and Riashat Islam and Alex Lamb and John Langford},
year = {2026},
eprint = {2511.05963},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2511.05963},
}
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file locoformer-0.2.7.tar.gz.
File metadata
- Download URL: locoformer-0.2.7.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46672858a3f50b8a67d2531b68bac3aa91f1698afbcaa42fe2687fc2f8f7eedd
|
|
| MD5 |
9b5421ed79a04dd914f4aaeaf616ba7a
|
|
| BLAKE2b-256 |
1b26a8a68fb0cc95f3cd80a594660d30283743aaa59fe8d42b2eefdd0abadacb
|
File details
Details for the file locoformer-0.2.7-py3-none-any.whl.
File metadata
- Download URL: locoformer-0.2.7-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67535b11f1885c1ca634a64b23e7fd852e93ce109cca1296b4f77e1b4df9ee04
|
|
| MD5 |
45c496bc99d5a6255b8723d64dfa9a59
|
|
| BLAKE2b-256 |
14887e1b27010d93d3ed22a43657cfc50f48632f3b7a0ac663cb272109ca8ec3
|