Predicting User Behavior in Smart Spaces with LLM-Enhanced Logs and Personalized Prompts

Yunpeng Song, Jiawei Li, Yiheng Bian, Zhongmin Cai

Introduction

The evolution of smart environments, from connected vehicles to automated homes, hinges on the ability to anticipate user needs. Seamless automation—such as a vehicle pre-adjusting climate controls or a home setting the evening ambiance—requires highly accurate prediction of the "next move" in a sequence of user actions. However, traditional predictive models often struggle with the cryptic nature of system logs and the inherent variability of individual human habits. This paper presents a novel framework that leverages the semantic reasoning of Large Language Models (LLMs) and graph-based personalized prompts to overcome these challenges.

Challenges in Smart Space Prediction

Current predictive methods face two primary obstacles:

  1. Semantic Sparsity: System logs are typically stored as technical codes (e.g., AC_Cool_Req: 1). Traditional models treat these as discrete, unrelated IDs. This prevents the model from understanding that "opening a window" and "turning on the AC" are semantically related to thermal comfort, making it difficult to generalize from common actions to rare ones.
  2. Lack of Personalization: User behavior is highly idiosyncratic. A "one-size-fits-all" model fails to capture the unique routines of different individuals, leading to suboptimal predictions for specific users.

Methodology

The proposed architecture addresses these hurdles through a multi-stage process involving semantic enrichment and personalized context injection.

Overview of the proposed framework architecture, including personalized prompt generation and LLM-enhanced log encoding.

LLM-Enhanced Logs

To resolve semantic sparsity, the framework employs LLMs (such as Ernie Bot or Qwen2.5) as "expert engineers." These models decode technical logs into descriptive natural language. For instance, a cryptic code is transformed into: "Activating the air conditioner's cooling mode to lower the cabin temperature." These descriptions are then processed by a BERT-based text encoder to generate semantic embeddings. This allows the model to learn the underlying intent of actions, facilitating better performance on rare events by relating them to semantically similar common events.

Personalized Prompt Generator

To capture individual habits without compromising privacy, the system constructs Transition Graphs (capturing sequential dependencies) and Co-occurrence Graphs (capturing simultaneous actions) from a user's history. A Graph Convolutional Network (GCN) processes these graphs to produce "soft continuous prompts." These mathematical vectors act as a prefix to the behavior sequence, effectively "priming" the Transformer-based decoder with the specific user's behavioral style.

Sequence Decoding

The final prediction is made by a Transformer decoder that integrates the personalized prompt with the semantically enriched behavior sequence. The model is trained using a Bayesian Personalized Ranking (BPR) loss to prioritize the most likely next action.

Experimental Evaluation

The framework was rigorously tested on four datasets:

  • Industrial Smart Vehicle Datasets (City A & City B): Comprising 9.5 million events from 100 private vehicles, covering 357 sensors.
  • Public Smart Home Datasets (Aruba & Milan): Benchmarks tracking household interactions with various appliances and sensors.

Key Insights and Results

The proposed method consistently outperformed eight state-of-the-art baselines, including BERT4Rec and RecFormer.

Performance sensitivity analysis showing the impact of the number of prompts and the ratio hyper-parameter λ on Hit Rate (H@3) and NDCG (N@3).
  • Accuracy Gains: On smart vehicle datasets, the model achieved a Hit Rate@1 (H@1) between 0.3450 and 0.3743, significantly higher than traditional sequential models.
  • Rare Event Prediction: The most notable success was a 40% improvement in predicting low-frequency events (occurring <1% of the time). By understanding the meaning of these events through LLM descriptions, the model avoids the "cold start" problem associated with ID-based embeddings.
  • Efficiency: By utilizing the LLM only during the preprocessing stage and storing the resulting embeddings, the system maintains a real-time inference latency of under 0.1 seconds.

Conclusion

By combining the broad semantic knowledge of LLMs with specialized graph-based personalization, this framework sets a new standard for behavior prediction in smart spaces. Future work will explore the integration of continuous sensor data and the scalability of personalized graph construction for larger user bases.

Summary updated

BibTeX
@inproceedings{song2025predicting,
  author = {Yunpeng Song and Jiawei Li and Yiheng Bian and Zhongmin Cai},
  title = {{Predicting User Behavior in Smart Spaces with LLM-Enhanced Logs and Personalized Prompts}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i1.32059},
}
Figure