Manuscript Offprint

arXiv:2610.21308

PocketTSLM: Deploying an On-Device Soft-Prompt Time-Series Language Model for Privacy-Preserving Smartphone Reasoning

Max Rosenblattl, Nikhil Krishnaswamy, Leon Nissen, Manuel Milling, Nicolas Zumarraga, Ning Wang, Thomas Kaar, Robert Jakob, Björn W. Schuller, Elgar Fleisch, Patrick Langer, Paul Schmiedmayer

Max Rosenblatt 1^{1}, Nikhil Krishnaswamy 1^{1}, Leon Nissen 1^{1}, Manuel Milling 2^{2}, Nicolas Zumarraga 4^{4}, Ning Wang 4^{4}, Thomas Kaar 1,3,4^{1,3,4}, Robert Jakob 3,4^{3,4}, Björn W. Schuller 2,5^{2,5}, Elgar Fleisch 4,6^{4,6}, Patrick Langer 1,3,4^{1,3,4}, and Paul Schmiedmayer 1^{1}

1^{1}Stanford University, USA; 2^{2}CHI, Technical University of Munich University Hospital, Germany; 3^{3}Aionic Labs, Switzerland; 4^{4}ETH Zurich, Switzerland; 5^{5}GLAM, Imperial College London, UK; 6^{6}Centre for Digital Health Interventions (CDHI), University of St. Gallen, Switzerland

Correspondence mrosenbl@stanford.edu · Code github.com/SchmiedmayerLab/PocketTSLM · Code license MIT

Abstract

Consumer phones and wearables increasingly collect physiological time-series data, yet most mobile systems treat these streams as summaries or text rather than as temporal evidence. This representation is poorly matched to personal health systems that need to retrieve, route, or summarize sensor evidence while preserving temporal structure. Cloud-hosted time-series language models avoid smartphone limits, but they repeatedly move sensitive physiology off the device and add latency and per-query compute cost. Mobile model alternatives that aggregate time-series data into statistical features or serialize raw samples as text either compress temporal structure or exhaust the context and memory budgets of small on-device models. We present PocketTSLM, a mobile-native deployment of OpenTSLM SoftPrompt, the soft-prompt variant of the OpenTSLM time-series language model. PocketTSLM runs fully on a consumer smartphone by injecting encoded time-series windows as embeddings instead of tokenizing time series as text. A numerical parity protocol verifies identical greedy-decoded token sequences between the Swift port and a Python reference using Apple's MLX machine-learning framework. Answers also match the PyTorch reference, although rationale wording can differ. An on-device context-economics benchmark compares the soft-prompt path with a text-serialized baseline on the same backbone. In our benchmark format, soft-prompting uses approximately 12× fewer time-series tokens and reduces prompt-prefill cost. PocketTSLM processes 30-second Sleep-EDF electroencephalography clips for sleep staging and a 1,000-sample (10 s) 12-lead electrocardiogram clip from ECG-QA. In comparison, text-serialized baselines exceed the phone's context or memory budget at longer time-series windows. All inference runs entirely on the device, with no health data transmitted during inference.

A version of this paper was accepted at the Workshop on Deploying AI in Healthcare (DAIH) at the Conference on Language Modeling (COLM 2026).

1 Introduction

Consumer devices now collect physiological time-series data that were previously limited to clinical or research environments [1, 2]. Smartwatch irregular-pulse notifications have been evaluated for atrial fibrillation screening in large cohorts [3], phone-connected systems make electroencephalography (EEG) acquisition more accessible [4], and passive wearable streams such as heart rate, sleep, and activity have been used for infectious-disease surveillance, COVID-19 detection, and prospective health-risk assessment [5–7]. In each case, measurements are captured close to the patient, but the interpretation delivered to a patient or downstream system is often a label, score, or study endpoint. Digital biomarker pipelines make this pattern explicit: continuous measurements are translated into digital endpoints or biomarkers for evaluation and decision support [8]. Those outputs support screening, monitoring, and study endpoints, but they do not explain the source time-series window itself. Recent personal-health large language model (LLM) systems interpret wearable-derived sleep, activity, and fitness data through natural-language coaching or insight generation [9, 10]. Therefore, patient-facing assistants, clinician review tools, and supervised health agents need descriptions grounded in source time-series windows that can be retrieved, routed, summarized, or used to defer a response when the evidence is insufficient.

Time-series language models (TSLMs) are designed for this time-series-to-language interface. They couple time-series encoders to language models and generate natural-language descriptions or rationales from raw physiological time-series data such as electrocardiogram (ECG), EEG, and accelerometry [11, 12]. These outputs give software a text interface to sensor evidence while preserving the temporal structure in the model input [11]. Time Series Language Models may enable systems that reason over sensor windows rather than only aggregate features.

Personal-health LLM systems are important reference points, but they do not solve the deployment problem addressed here: they reason over derived wearable data with large language models rather than running a time-series-native model on the phone [9, 10]. When interpretation is served remotely, personal physiological streams or derived sensor evidence must leave the device, making privacy and secondary-use risks part of the inference pathway [13]. Server-side inference also adds a network dependency and per-query compute cost. General on-device LLM work identifies limited device memory as a central inference bottleneck [14]. Medical LLM benchmarks show the same tradeoff: local inference improves the privacy and cost posture, while memory and efficiency become the limiting constraints [15]. For physiological time-series data, moving inference onto the phone shifts the system boundary: raw data can remain local, offline analysis becomes possible, and cloud storage is no longer required for each query.

The main obstacle is representation rather than model size. Mobile LLM runtimes are built around token-identifier input and do not expose a path for injecting precomputed embeddings, so a time-series encoder's output cannot be fed to the model directly. If the runtime cannot accept encoder embeddings, the time-series data must be serialized as text. Text serialization reuses an unchanged language-model interface and can cast time series as next-token prediction [16], but it expands each sample into multiple vocabulary tokens, formats or rounds numeric values, and spends the same limited context window needed for instructions and generated text. OpenTSLM soft-prompt (OpenTSLM-SP) avoids that prompt-level bottleneck by using representation-level fusion: a time-series encoder projects time-series windows into soft-prompt embeddings that are injected directly into the LLM's embedding sequence [11]. That design is better matched to physiological time-series data, but it requires embedding-level access to the forward pass and cannot be expressed through token-only generation interfaces.

We present PocketTSLM, an on-device port of OpenTSLM-SP to MLX-Swift that evaluates whether the soft-prompt pathway can run on a consumer smartphone without changing the reference model's greedy-decoding behavior. The port preserves the encoder-projector-LLM architecture while modifying the on-device generation path to accept projected time-series embeddings. PocketTSLM is scoped as a deployment and evaluation of on-device soft-prompt physiological time-series reasoning, not clinical validation, autonomous medical action, or behavior-change efficacy. We contribute: (1) a method for migrating soft-prompt TSLMs to MLX-Swift; (2) a numerical parity protocol that compares the on-device implementation against the reference under greedy decoding; (3) an on-device context-economics benchmark comparing soft-prompt encoding with a text-serialized baseline on the same backbone; and (4) a HealthKit-enabled iPhone demo that runs ECG and EEG reasoning locally without sending health data off-device.

References (36)