InstructMPC: A Human-LLM-in-the-Loop Framework for Context-Aware Control

Ruixiang Wu, Jiahao Ai, Tongxin Li

Introduction

Model Predictive Control (MPC) has long been the industry standard for managing complex dynamical systems, such as autonomous vehicles, power grids, and climate-controlled buildings. By optimizing actions over a sliding future horizon, MPC provides a robust mathematical framework for decision-making. However, traditional MPC suffers from "context blindness." It typically relies on historical averages or static mathematical models to predict future disturbances, leaving it unable to account for real-time, semantic information provided by humans—such as weather warnings or specific schedule changes.

InstructMPC is a novel framework designed to bridge this gap. By integrating a Large Language Model (LLM) directly into the MPC loop, the system can "understand" and act upon natural language context, translating fuzzy human instructions into precise numerical disturbance predictions.

The InstructMPC Framework

The InstructMPC architecture consists of three primary components that transform semantic context into physical control actions:

  1. Language-to-Distribution (L2D) Module: At the core of the system is an LLM (specifically LLaMA-8B) that acts as a sophisticated sensor. It takes natural language input—for example, "A heavy storm is expected at 4 PM"—and maps it to a probability distribution of potential disturbance trajectories, such as predicted energy demand or environmental forces.
  2. MPC Integration: These context-aware forecasts are fed into a standard MPC optimizer. Rather than assuming a zero-disturbance baseline, the controller optimizes its trajectory based on the LLM’s predictions, allowing for proactive rather than reactive adjustments.
  3. Closed-Loop Fine-Tuning: To ensure the system improves over time, InstructMPC utilizes a feedback loop. Once the actual disturbance is observed, the system calculates the error between the prediction and reality. It then employs Direct Preference Optimization (DPO) to fine-tune the LLM, teaching it to better associate specific linguistic cues with physical outcomes.

Theoretical Foundations

A significant contribution of this work is the establishment of theoretical guarantees for using "black-box" LLMs in safety-critical control loops. The authors address the "loss discrepancy" problem—the fact that an LLM’s training objective (predicting the next token) does not naturally align with an MPC’s objective (minimizing control cost).

By defining and bounding this discrepancy, the authors prove that for linear systems, the InstructMPC framework achieves a sublinear regret bound of $O(\sqrt{T \log T})$. This ensures that as the system gathers more data and undergoes fine-tuning, its performance converges toward the theoretical optimum, providing a rigorous foundation for context-aware control.

Experimental Evaluation

The researchers evaluated InstructMPC across two distinct domains to test its versatility:

  • Robot Path Tracking: In a 2D simulation, a robot was tasked with following a complex "astroid" path while subjected to wind gusts described only in text (e.g., "a gust of wind blows toward the lower left"). InstructMPC successfully interpreted these cues to maintain high tracking precision where traditional baselines failed.
  • Building Energy Management: Using 500 days of real-world weather data and the PVLIB simulator, the framework managed battery storage and solar generation. The system processed human-provided schedules and news (e.g., "I will be running a high-intensity simulation at 3 PM").

Key Results

  • Energy Efficiency: In the building management task, InstructMPC reduced electricity costs by 58.29% compared to classic MPC.
  • The Importance of Fine-Tuning: InstructMPC significantly outperformed a "Zero-Shot" LLM approach, which only achieved a 43.73% reduction. This 14.56% difference highlights that the closed-loop fine-tuning mechanism is essential for grounding the LLM in physical reality.
  • Robustness: The system demonstrated a consistent ability to translate semantic information into physical parameters across varying environments.

Limitations and Future Directions

While InstructMPC marks a major advancement in semantic control, several challenges remain:

  • Non-Linear Dynamics: Current theoretical proofs are centered on linear systems; extending these guarantees to non-linear dynamics is a primary goal for future research.
  • Computational Demands: Operating an 8-billion parameter model in a real-time control loop requires significant computational resources. Future iterations may explore model distillation or smaller, specialized architectures to reduce latency.
  • Physical Deployment: The researchers plan to move from simulations to the OpenCEM physical energy testbed to evaluate the framework's performance against hardware constraints and sensor noise.

Conclusion

InstructMPC demonstrates that Large Language Models can serve as more than just chatbots; they can function as intelligent, adaptable sensors within high-stakes control systems. By providing a mathematically sound method for integrating human context into the MPC loop, this framework paves the way for more intuitive and efficient automation in the real world.

Summary updated

BibTeX
@inproceedings{wu2025instructmpc,
  author = {Ruixiang Wu and Jiahao Ai and Tongxin Li},
  title = {{InstructMPC: A Human-LLM-in-the-Loop Framework for Context-Aware Control}},
  booktitle = {CDC},
  year = {2025},
  doi = {10.1109/cdc57313.2025.11312156},
}
Figure