Quattro is an open-source framework designed to enhance the efficiency of iterative Linear Quadratic Regulators (iLQR) through the innovative integration of Transformer models. By accelerating intermediate computations in iLQR algorithms, Quattro significantly improves real-time optimal control capabilities for nonlinear robotic systems.
Real-time optimal control remains challenging in robotics due to the sequential nature of traditional iLQR methods. Quattro addresses this by employing a Transformer model to concurrently predict feedback and feedforward matrices, allowing parallel computation without sacrificing control accuracy.
- Transformer-Accelerated iLQR: Parallel computation enabled by Transformer-based prediction of intermediate feedback and feedforward matrices.
- Validated Performance: Demonstrated substantial acceleration and accuracy on cart-pole and quadrotor systems.
- FPGA Implementation: Utilizes a customized Transformer accelerator IP on FPGA, achieving up to 27.3× performance improvements and significant power efficiency.
- Algorithm-Level Acceleration:
- Overall MPC Speedup (with Apple Silicon M4 Pro):
- Cart-Pole: 2.8×.
- Quadrotor: 17.8×.
We recommend use virtual environment e.g. conda. The project is based on Python 3.10 or later versions.
# Create and activate a new virtual environment
conda create --name quattro python=3.10
conda activate quattro
# Clone the repository and navigate to the project folder
git clone https://github.com/YueWang996/quattro-transformer-ilqr
cd quattro-transformer-ilqr
# Option 1 (Recommended): Install as an editable package
pip install -e .
# Option 2: Alternatively, install the dependencies manually
pip install -r requirements.txtQuattro comes with example simulations to illustrate its performance on different robotic systems.
-
Cart-Pole Simulation:
Navigate to theexamples/cartpole/directory and run:python cartpole_sim.py
-
Quadrotor Simulation:
Similarly, navigate to theexamples/quadrotor/directory and run:python quadrotor_sim.py
To train the Transformer for iLQR acceleration:
-
Data Collection:
Use the provided data collection script located atexamples/cartpole/training/training_data_collection.pyto generate simulation logs. This script harnesses multi-core processing for efficiency. -
Model Training:
You have two options:- Run
transformer_training.pyfrom the same directory for script-based training. Suitable to run on a remote server. - Alternatively, use the Jupyter Notebook
transformer_training.ipynbfor an interactive guide.
- Run
Please cite this project if you find it useful:
@article{wang2025quattro,
title={Quattro: Transformer-Accelerated Iterative Linear Quadratic Regulator Framework for Fast Trajectory Optimization},
author={Wang, Yue and Wang, Haoyu and Li, Zhaoxing},
journal={arXiv preprint arXiv:2504.01806},
year={2025}
}
This project is licensed under the MIT License - see the LICENSE file for details.



