TL;DR
PILLM is an evolutionary framework that uses Large Language Models (LLMs) to automatically generate, evaluate, and refine anomaly detection rules for HVAC systems. By infusing the evolutionary loop with domain physics—via physics-informed reflection and crossover—it produces human-readable, executable Python rules that achieve state-of-the-art detection accuracy ($F_1 = 0.926$) while remaining fully transparent and actionable for building engineers.
What Problem Does This Paper Address?
Heating, Ventilation, and Air-Conditioning (HVAC) systems consume massive amounts of energy—buildings account for roughly 40% of global energy consumption and a third of greenhouse gas emissions. Undetected operational faults (such as stuck dampers, leaking heating coils, or sensor drift) lead to massive energy waste and indoor discomfort.
Existing Automated Fault Detection and Diagnostics (AFDD) methods face a persistent trade-off:
- Classical rule-based heuristics are interpretable, but they require tedious manual authoring by domain experts and are too brittle to handle evolving building dynamics.
- Deep learning models (such as LSTMs and Transformers) achieve strong predictive power but act as inscrutable "black boxes" that generalize poorly without physical constraints and offer no diagnostic rationale.
- Standard LLM-based approaches can write heuristic code, but they typically treat time-series data purely as abstract numbers, ignoring physical principles and yielding physically nonsensical rules or high false-alarm rates.
Methods
PILLM adapts the Reflective Evolution paradigm, using an LLM (specifically Google's Gemini 2.5 Flash) as a reasoning and mutation engine to iteratively evolve diagnostic rules written in executable Python. Instead of manipulating code blindly, PILLM grounds each step in thermodynamic and control principles:
[Initial Heuristic + Sensor Metadata]
│
▼
┌──► Physics-Informed Reflection (PIR) ── Analyzes physical validity & feature semantics
│ │
│ ▼
│ Physics-Informed Crossover (PIC) ──── Combines rules respecting causal physical links
│ │
│ ▼
│ Elitist Mutation ──────────────────── Refines top rules (schedules, weather normalization)
│ │
└───────┴── Evaluated on building data (Iterative loop)
- Initialization: Prompts the LLM with system specifications, physical feature descriptions (e.g., how fan speed interacts with airflow and pressure), and a simple baseline heuristic (like a peak-over-threshold rule) to generate an initial pool of candidate Python functions.
- Physics-Informed Reflection (PIR): Compares pairs of rules (higher vs. lower performance) alongside semantic sensor descriptions. The LLM generates structured reflections explaining why a rule failed or succeeded based on building dynamics (e.g., identifying that outdoor temperature alone cannot explain indoor cooling load variation).
- Physics-Informed Crossover (PIC): Rather than performing arbitrary code splicing, PIC uses natural-language reflections to synthesize child rules that model causal relationships (such as linking indoor-outdoor thermal gradients directly to airflow control).
- Elitist Rule Mutation: Periodically applies targeted modifications to top-performing rules, such as adding occupancy schedules or weather normalization terms.
Datasets
The framework was evaluated on the public LBNL Automated Fault Detection for Buildings dataset (from Lawrence Berkeley National Laboratory).
- Target Task: Multivariate time-series anomaly detection covering common building faults, including leaking heating coils, stuck dampers, sensor drift/biases, and control logic conflicts (e.g., simultaneous heating and cooling).
- Evaluation Metric: Event-F1 with Point Adjustment (Event-F1 PA), which treats contiguous fault events as single detection instances while strictly penalizing point-level false alarms.
Key Insights and Ideas
- Transparent Code Over Black-Box Weights: Instead of training neural network weights, the system outputs transparent, inspectable Python rules accompanied by natural-language rationales. Facility operators can read, verify, and edit the code directly.
- Physics as an Evolutionary Regularizer: Without physical grounding, genetic algorithms and LLMs often exploit spurious correlations. Supplying semantic context (e.g., what physical quantity a sensor represents) guides the LLM toward causal relationships rather than numerical flukes.
- Reflection Closes the Semantic Gap: Comparing good and bad rules using thermodynamic reasoning lets the system build cumulative domain insights across generations, bridging raw statistical performance metrics and actionable engineering logic.
Key Results
PILLM outperformed both classical machine learning and deep learning baselines, as well as recent LLM-based agentic frameworks on the LBNL benchmark:
| Method | Precision | Recall | $F_1$ Score |
|---|---|---|---|
| AnomalyTransformer | 0.482 | 0.395 | 0.282 |
| AutoRegression | 0.731 | 0.699 | 0.668 |
| LSTMAD | 0.861 | 0.781 | 0.818 |
| LLMAD | 0.045 | 0.835 | 0.083 |
| SigLLM | 0.012 | 0.502 | 0.021 |
| ARGOS (Agentic LLM) | 0.921 | 0.885 | 0.902 |
| PILLM (Ours) | 0.968 | 0.859 | 0.926 |
| — w/o PIR (No Physical Reflection) | 0.889 | 0.851 | 0.869 |
| — w/o PIC (No Physical Crossover) | 0.945 | 0.803 | 0.868 |
Ablation results highlight the necessity of both domain-guided mechanisms: removing either Physics-Informed Reflection (PIR) or Crossover (PIC) dropped the $F_1$ score significantly from $0.926$ to under $0.87$.
Limitations and Future Work
- Subsystem Scope: The experimental validation focuses strictly on HVAC systems within a single public dataset (LBNL); applicability across diverse building architectures and other subsystems (e.g., chillers, lighting, electrical microgrids) remains to be demonstrated.
- Latency and Real-Time Operation: While the evolved Python rules run efficiently during inference, the iterative LLM-guided evolutionary search process is computationally intensive and currently limited to offline rule generation.
- Future Directions: The authors plan to extend PILLM to other building sub-systems and evaluate its scaling properties for real-time anomaly detection in city-scale smart building infrastructure.
Summary updated