Smart-home sensor-based behavioral monitoring holds significant potential for healthcare, independent living, and early detection of functional or cognitive changes. In this setting, tasks like activity recognition, prediction, and pattern discovery provide complementary views of daily life, supporting the modeling of personal routines and habits, and their long-term changes. Existing approaches, however, face critical limitations. Supervised approaches require impractical amounts of labeled activity data to capture the variability of daily behavior across residents and environments. Foundation models represent a promising direction for learning transferable representations of latent behavioral patterns from sensor data. Still, current efforts are mostly designed for continuous inertial or physiological sensor data and do not address the sparse, discrete, and semantically rich event streams produced by smart homes. In this paper, we introduce DomusFM, a domain-specific foundation model for sensor-based behavioral monitoring in smart homes based on semantic event streams. DomusFM employs a self-supervised dual contrastive learning paradigm to capture both event-level semantic attributes and sequence-level temporal dependencies. By integrating semantic embeddings from a lightweight language model and specialized encoders for temporal patterns and binary states, DomusFM learns transferable representations that can be adapted across heterogeneous smart-home environments and tasks related to activity and event analysis. Through a leave-one-dataset-out evaluation across seven public smart-home datasets, we demonstrate that DomusFM consistently outperforms baselines on three downstream tasks: ADL recognition, next-k event prediction, and unsupervised clustering. DomusFM has a small footprint and can be deployed on edge devices.
Figures & tables
Figure 1. High level architecture
Figure 2. Detailed architecture of DomusFM’s two main components. The Event-level Feature Extraction encodes sensor event attributes through specialized encoders and integrates them via Attribute Self-Attention. The Contextualized Event-level Feature Extraction uses transformer layers to capture temporal dependencies and produce context-aware event representations.
Figure 3. Dual contrastive learning framework for pretraining DomusFM. Attribute-level contrastive loss learns robust event representations by masking individual attributes, while event-level contrastive loss captures temporal context by masking entire events. Both stages use augmented data streams to learn representations through contrastive objectives.
Figure 4. t-SNE visualization of the learned embeddings before (left) and after (right) fine-tuning, for CASAS Milan (top) and Kasteren C (bottom), using 5% of the fine-tuning data. Points are colored by ground-truth class. Before fine-tuning, embeddings form clusters that do not align with class labels, reflecting the self-supervised nature of pretraining. After fine-tuning, clusters correspond closely to the classes, showing that our model effectively adapts to the downstream task even with limited fine-tuning data.
Train Data %
5%
10%
DeepCASAS
Chronos-2
DomusFM
DeepCASAS
Chronos-2
DomusFM
CASAS Milan
0.54
0.54
0.72
0.55
0.56
0.82
CASAS Aruba
0.71
0.70
0.76
0.72
0.72
0.78
Kasteren A
0.25
0.21
0.48
0.34
0.31
0.56
Kasteren C
0.31
0.30
0.59
0.35
0.35
0.67
Orange4Home
0.77
0.79
0.89
0.80
0.82
0.91
Table 1. ADL recognition performance (Weighted F1-score) comparing DomusFM against the DeepCASAS and Chronos-2 baselines across seven smart-home datasets and different Train Data percentages (5%, 10%, 15%, 30%). Results are averaged over 5-fold cross-validation. DomusFM outperforms the baseline for all Train Data percentages, across all datasets.
Train Data %
5%
10%
GPT-2
Chronos-2
DomusFM
GPT-2
Chronos-2
DomusFM
CASAS Milan
0.39
0.42
0.57
0.49
0.51
0.61
CASAS Aruba
0.52
0.55
0.59
0.55
0.55
0.62
Kasteren A
0.29
0.39
0.66
0.29
0.41
0.74
Kasteren C
0.46
0.48
0.59
0.47
0.50
0.69
Orange4Home
0.70
0.73
0.86
0.74
0.79
0.87
Table 2. Next- 30 events prediction performance (F1-score) comparing DomusFM against the GPT-2-based and Chronos-2 baselines across seven smart-home datasets and different Train Data percentages (5%, 10%, 15%, 30%). Results are averaged over 5-fold cross-validation. DomusFM outperforms the baseline in all scenarios across all datasets.
Train Data %
5%
10%
GPT-2
Chronos-2
DomusFM
GPT-2
Chronos-2
DomusFM
CASAS Milan
0.37
0.39
0.52
0.41
0.44
0.56
CASAS Aruba
0.47
0.48
0.54
0.50
0.49
0.57
Kasteren A
0.28
0.28
0.45
0.43
0.45
0.54
Kasteren C
0.30
0.29
0.52
0.28
0.36
0.61
Orange4Home
0.62
0.65
0.79
0.64
0.69
0.83
Table 3. Next- 10 events prediction performance (F1-score) comparing DomusFM against the GPT-2-based and Chronos-2 baselines across seven smart-home datasets and different Train Data percentages (5%, 10%, 15%, 30%). Results are averaged over 5-fold cross-validation. DomusFM outperforms the baseline in all scenarios across all datasets.
Dataset
5%
10%
15%
30%
Backbone
Purity
Noise
#
Purity
Noise
#
Purity
Noise
#
Purity
Noise
#
Milan
DeepCASAS
0.24
0.20
50.20
0.27
0.21
53.20
0.25
0.20
56.40
0.29
0.23
54.20
Chronos-2
0.39
0.29
68.40
0.41
0.29
68.00
0.45
0.31
70.20
0.51
0.30
71.40
DomusFM
0.62
0.30
71.20
0.62
0.29
73.40
0.65
0.31
71.40
0.71
0.33
72.80
Aruba
DeepCASAS
0.26
0.29
70.20
0.31
0.28
72.60
0.38
0.31
66.80
0.45
0.28
64.60
Chronos-2
0.32
0.29
67.20
0.39
0.31
71.40
0.44
0.32
74.20
0.51
0.30
71.40
Table 4. Purity, Noise, and number of discovered patterns (#) and training data percentages for each dataset and clustering backbone.
Train Data %
5%
10%
15%
30%
w/o Context
Full
w/o Context
Full
w/o Context
Full
w/o Context
Full
CASAS Milan
0.67
+0.05
0.76
+0.06
0.82
+0.04
0.90
+0.02
CASAS Aruba
0.67
+0.09
0.71
+0.07
0.77
+0.05
0.84
+0.07
Kasteren A
0.43
+0.05
0.51
+0.05
0.55
+0.06
0.62
+0.06
Kasteren C
0.50
+0.09
0.59
+0.08
0.63
+0.09
0.74
+0.07
Orange4Home
0.81
+0.08
0.86
+0.05
0.88
+0.06
0.91
+0.05
Table 5. ADL recognition performance (F1-score) for the ablation study, comparing DomusFM without the contextualization module (w/o Context) against the full architecture (Full) across all seven datasets and different Train Data percentages (5%, 10%, 15%, 30%).
Train Data %
5%
10%
15%
30%
w/o Context
Full
w/o Context
Full
w/o Context
Full
w/o Context
Full
CASAS Milan
0.50
+0.07
0.53
+0.08
0.55
+0.10
0.61
+0.12
CASAS Aruba
0.49
+0.10
0.51
+0.11
0.56
+0.09
0.59
+0.11
Kasteren A
0.59
+0.07
0.64
+0.10
0.69
+0.11
0.71
+0.16
Kasteren C
0.52
+0.07
0.60
+0.09
0.65
+0.10
0.61
+0.25
Orange4Home
0.80
+0.06
0.83
+0.04
0.83
+0.06
0.85
+0.04
Table 6. Next- 30 events prediction performance (F1-score) for the ablation study, comparing DomusFM without the contextualization module (w/o Context) against the full architecture (Full) across all seven datasets and different Train Data percentages (5%, 10%, 15%, 30%).
Train Data %
5%
10%
15%
30%
w/o Context
Full
w/o Context
Full
w/o Context
Full
w/o Context
Full
CASAS Milan
0.51
+0.11
0.52
+0.10
0.56
+0.09
0.59
+0.12
CASAS Aruba
0.40
+0.08
0.41
+0.13
0.45
+0.12
0.49
+0.12
Kasteren A
0.39
+0.11
0.43
+0.08
0.46
+0.07
0.49
+0.08
Kasteren C
0.52
+0.11
0.53
+0.12
0.56
+0.09
0.61
+0.11
Orange4Home
0.69
+0.05
0.71
+0.06
0.75
+0.06
0.79
+0.05
Table 7. Unsupervised clustering performance (Purity) for the context ablation study, comparing DomusFM without the contextualization module (w/o Context) against the full architecture (Full) across all seven datasets and different Train Data percentages (5%, 10%, 15%, 30%). The Full columns report the gain over the W/O Context version.
Train Data %
5%
10%
15%
30%
w/o Pretrain
Full
w/o Pretrain
Full
w/o Pretrain
Full
w/o Pretrain
Full
CASAS Milan
0.58
+0.14
0.71
+0.11
0.82
+0.04
0.87
+0.05
CASAS Aruba
0.65
+0.11
0.69
+0.09
0.74
+0.08
0.80
+0.11
Kasteren A
0.44
+0.04
0.47
+0.09
0.49
+0.12
0.57
+0.11
Kasteren C
0.44
+0.15
0.52
+0.15
0.60
+0.12
0.75
+0.06
Orange4Home
0.84
+0.05
0.85
+0.06
0.88
+0.06
0.92
+0.04
Table 8. ADL recognition performance (F1-score) for the ablation study, comparing DomusFM without the pretrain (w/o Pretrain) against the full pipeline (Full) across all seven datasets and different Train Data percentages (5%, 10%, 15%, 30%).
Train Data %
5%
10%
15%
30%
w/o Pretrain
Full
w/o Pretrain
Full
w/o Pretrain
Full
w/o Pretrain
Full
CASAS Milan
0.46
+0.11
0.48
+0.13
0.50
+0.15
0.55
+0.18
CASAS Aruba
0.49
+0.10
0.51
+0.11
0.53
+0.12
0.59
+0.11
Kasteren A
0.51
+0.15
0.56
+0.18
0.58
+0.22
0.67
+0.20
Kasteren C
0.41
+0.18
0.47
+0.22
0.54
+0.21
0.66
+0.20
Orange4Home
0.65
+0.21
0.66
+0.21
0.70
+0.19
0.74
+0.15
Table 9. Next- 30 events prediction performance (F1-score) for the ablation study, comparing DomusFM without the pretrain (w/o Pretrain) against the full pipeline (Full) across all seven datasets and different Train Data percentages (5%, 10%, 15%, 30%).
Train Data %
5%
10%
15%
30%
w/o Pretrain
Full
w/o Pretrain
Full
w/o Pretrain
Full
w/o Pretrain
Full
CASAS Milan
0.35
+0.27
0.36
+0.26
0.38
+0.27
0.45
+0.26
CASAS Aruba
0.30
+0.18
0.32
+0.22
0.40
+0.17
0.41
+0.20
Kasteren A
0.44
+0.06
0.43
+0.08
0.45
+0.08
0.49
+0.08
Kasteren C
0.50
+0.13
0.53
+0.12
0.54
+0.11
0.59
+0.13
Orange4Home
0.52
+0.22
0.54
+0.23
0.62
+0.19
0.66
+0.18
Table 10. Unsupervised clustering performance (Purity) for the ablation study, comparing DomusFM without pretraining (w/o Pretrain) against the full architecture (Full) across all seven datasets and different Train Data percentages (5%, 10%, 15%, 30%). The Full columns report the gain over the w/o Pretrain version.
Metric
DomusFM
LLM-based Solution
Memory Usage
< 500 MB
18 GB
Inference Time
ADL recognition
9.9±1 ms
8±3 s
Next- k Events Prediction
9.6±1 ms
15±5 s
Deployment Requirements
Standard gateway
Specialized hardware
Table 11. Computational Requirements Comparison: DomusFM demonstrates significantly lower memory footprint and faster inference times compared to the LLM-based solution, enabling deployment on standard smart-home gateways without specialized hardware.
LLM
DomusFM
Zero-shot
5%
10%
15%
30%
CASAS Milan
0.56
0.72
0.82
0.86
0.92
Kasteren C
0.48
0.59
0.67
0.72
0.81
Table 12. ADL recognition performance (Weighted F1-score) comparing DomusFM against the zero-shot LLM approach.
LLM
DomusFM
Zero-shot
5%
10%
15%
30%
CASAS Milan
0.45
0.57
0.61
0.65
0.73
Kasteren C
0.49
0.59
0.69
0.75
0.86
Table 13. Next- 30 events prediction performance (F1-score) comparing DomusFM against the zero-shot LLM approach.
Train Data %
5%
10%
GPT-2
Chronos
DomusFM
GPT-2
Chronos
DomusFM
CASAS Milan
0.36
0.39
0.55
0.43
0.47
0.58
Kasteren C
0.40
0.41
0.52
0.42
0.46
0.63
Table 14. Next-events prediction performance (F1-score) over a fixed 5-minute time window, comparing DomusFM against the GPT-2 and Chronos baselines on CASAS Milan and Kasteren C, for Train Data percentages of 5% and 10%. Results are averaged over 5-fold cross-validation.
Figure 5. Three windows from the same CASAS Milan cluster. Bars show sensor activations (ON to OFF). Despite coming from different days, all windows show repeated bedroom and near-bed activity around midday.
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
Figure 6. Event streams from the two different kinds of sensors.
With the rise in aging populations and single-person households, privacy-preserving smart-home behavior monitoring is increasingly essential for daily living analysis and home-care applications. Smart-home sensors continuously record daily activities; however, these data are typically stored as low-level event logs, which are not directly interpretable as meaningful behavioral patterns. This paper presents a knowledge graph (KG)-guided local large language model (LLM) agent for temporal behavior interpretation in smart homes. The proposed system utilizes Home Assistant sensor histories and Qwen2.5-0.5B-Instruct, a lightweight local LLM, to interpret and explain daily behavior patterns. Sensor records are transformed into behavior-level summaries and organized into rolling-window features to capture multi-day changes. The proposed framework further adapts Qwen2.5 using Low-Rank Adaptation (LoRA) with KG-guided input. Experimental results using an external dataset and local Home Assistant data demonstrate that KG-guided fine-tuning improves the stability and consistency of temporal-state interpretation compared to the base model. Additionally, five-day and seven-day windows yield more stable KG-guided interpretations than shorter windows.
Tianle Hu, Hong Chen, Yenjou Wang
Department of Information, Artificial Intelligence and Data Science, Daiichi Institute of Technology, Tokyo, Japan · School of Artificial Intelligence, Xiamen Institute of Technology, Xiamen, China
Human Activity Recognition (HAR) from ambient sensors enables smart-home applications such as health monitoring and assisted living. In realistic deployments, however, sensor events arrive as a continuous stream and activity boundaries are unknown. Sliding-window inference therefore produces many windows that straddle transitions and contain mixed activities, creating boundary contamination that violates the pre-segmented instance assumption used by most benchmarks and models. Moreover, many pipelines under-use spatial context by treating sensor IDs as independent tokens. We present LastAct, a trajectory-centric framework for streaming smart-home HAR that targets the most recent activity under mixed windows while explicitly modeling spatial structure. LastAct projects sensor events onto the home floorplan to form a layout-aligned trajectory image sequence that preserves spatial continuity. A lightweight gate identifies contaminated windows, and a boundary localizer estimates the last transition to enable boundary-guided masking that emphasizes post-boundary evidence and suppresses stale context. For efficiency, we reuse a precomputed layout-aligned template cache to avoid repeated rendering. Empirically, across four public smart-home datasets under near-realistic mixed-activity protocols, LastAct achieves competitive or superior performance on pure windows and yields substantial Macro-F1 gains on cross/mixed windows, demonstrating improved robustness under near-realistic sliding-window regimes.
Ambient sensors offer a privacy-preserving solution for activity recognition in smart homes, yet they face a critical challenge in multi-resident environments known as Data Association, which aims to identify the resident triggering a specific anonymous sensor event. Existing approaches fundamentally fail to maintain global consistency by often yielding conflicting associations for silent residents. Additionally, these methods frequently suffer from severe trajectory fragmentation caused by the ontological mismatch of applying continuous physical motion models to discrete logical behaviors. To address these limitations, we propose a novel framework that reformulates data association as a sequential decision-making task within a Markov Decision Process (MDP). We solve the defined MDP via Behavior Cloning (BC) to avoid complex reward engineering by directly learning from expert demonstrations. We instantiate the policy using two complementary architectures, including a lightweight Transformer that treats association as a multi-label classification task over linearized event histories, and a fine-tuned Large Language Model (LLM) that reformulates the problem as conditional text generation to leverage pre-trained semantic knowledge. Extensive evaluations on three diverse datasets demonstrate that our approach significantly outperforms state-of-the-art baselines, particularly in resolving concurrent multi-resident events. Furthermore, the LLM-based policy shows preliminary cross-environment transfer potential under benchmark settings, while its robustness in real deployments still requires further validation.