GA-Agent:用 LLM 在元层面配置遗传算法,自动优化 PID 控制器
GA-Agent: Large Language Models as Hyperparameter Optimizers for Evolutionary Controller Synthesis
把 LLM 当遗传算法的调参师用,8 个控制案例全部跑通,成本才 $0.002 一次,做控制或自动化的朋友可以看看这套架构。
PID 控制器调参需要平衡跟踪误差、超调、稳定时间等多个目标,而遗传算法(GA)的元级配置(种群规模、代数预算、增益边界、适应度权重)通常靠人工试错。GA-Agent 将两层解耦:标准 GA 负责底层 PID 增益的数值搜索,LLM 智能体在元层面观察已完成的 GA 运行、诊断与控制目标的差距并更新 GA 配置。在 DC 电机、倒立摆、飞机俯仰、水下航行器等 8 个控制案例上,GA-Agent 达到 100% 成功率,函数评估次数比 Cascade-GA 基线少一到两个数量级,通常 1-3 次优化尝试内收敛。使用 2-3 条的记忆缓冲和 DeepSeek-V4-Flash 等低成本模型,单次运行成本约 $0.002。
GA-Agent: Large Language Models as Hyperparameter Optimizers for Evolutionary Controller Synthesis
Tuning PID controllers to satisfy competing objectives - low tracking error, fast settling, limited overshoot, and moderate control effort - is labor-intensive and requires expertise. Genetic algorithms (GAs) offer gradient-free optimization of controller gains against a weighted fitness function, but success depends on meta-level choices: population size, generation budget, gain bounds, and fitness weights. These are usually set by manual trial-and-error or costly bilevel optimization, exposing a tension: GAs excel at dense numerical search, but configuring them needs high-level, context-dependent semantic reasoning. We propose GA-Agent, which decouples these modes. A standard GA handles low-level PID gain optimization. A large language model (LLM) agent operates at the meta-level: it observes completed GA runs, diagnoses gaps versus user control objectives, and proposes updated GA configurations. The architecture uses structured memory, quantitative goal translation, resource-aware termination, and outcome-driven routing. We evaluate GA-Agent on eight control case studies with diverse dynamics (DC motor, inverted pendulum, aircraft pitch, autonomous underwater vehicle, and others). GA-Agent achieves 100% success on all benchmarks, outperforming a Regular GA with fixed hyperparameters in solution quality and sample efficiency. It matches or surpasses a Cascade-GA baseline while reducing function evaluations by one to two orders of magnitude, typically converging in one to three optimization attempts. Sensitivity analysis shows robustness across LLM backbones and memory configurations. A compact memory buffer (size 2-3) and cost-effective models (DeepSeek-V4-Flash at about $0.002 per run) achieve superior performance.