Abstract Accurate prediction of user actions is essential for optimizing digital platform workflows, enabling proactive recommendations, resource prefetching, and intelligent user assistance. Traditional Markov chain-based methods, though widely used for modeling sequential behavior, are fundamentally limited in capturing the complexity, long-range dependencies, and multi-objective nature of real-world user interactions. This paper introduces a multi-task attention-based transformer architecture for sequential API recommendation that addresses these gaps in robustness and generalizability. The core insight is that user behavior on enterprise platforms is driven by latent intent: users with different goals—such as executing a machine learning pipeline, conducting data analysis, managing user accounts, or generating quick visualizations—exhibit systematically different sequential patterns across functional API categories. Our framework exploits this structure through a shared transformer encoder backbone that produces a unified representation of the user’s action history, which is then decoded by three task-specific prediction heads operating simultaneously. The primary head predicts the next API action from a probability distribution over all available endpoints; an auxiliary goal classification head infers the user’s underlying session objective from the observed action sequence alone; and a session boundary detection head estimates the probability that the user is about to conclude their session. During inference, only the sequence of prior API calls is required as input—the model jointly infers what the user will do next, what they are trying to accomplish, and whether they are about to leave, all from the observed behavioral trace. Leveraging a large-scale simulated behavioral dataset encompassing 2, 000 user sessions and 20, 000 API calls across 100 APIs organized into 10 functional categories, with 4 distinct session goal types governing workflow-specific transition patterns, our model demonstrates strong performance across all tasks. The primary API prediction task achieves 79. 83\% top-1 accuracy and 99. 97\% top-5 hit rate, representing a +432\% improvement over a first-order Markov chain baseline. Auxiliary tasks further validate the framework’s effectiveness, with goal prediction reaching 81. 6\% accuracy and session-end detection achieving 99. 3\% accuracy. To ensure full reproducibility, we release an open-source Python package, , available on PyPI, that enables researchers and practitioners to regenerate the experimental dataset, reproduce all reported results, and—critically—apply the same multi-task transformer pipeline to their own user log data by mapping proprietary action sequences and session labels into the framework’s integer-encoded input format. Our approach not only advances prediction accuracy over conventional sequential methods but also establishes a new, reproducible benchmark for modeling multi-objective sequential user behavior on digital platforms, with direct applicability to any enterprise environment where user actions can be represented as ordered sequences of discrete events.
Building similarity graph...
Analyzing shared references across papers
Loading...
Yiqiao Yin (Sat,) studied this question.
www.synapsesocial.com/papers/69ada892bc08abd80d5bb9c2 — DOI: https://doi.org/10.1038/s41598-026-43111-9
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context:
Yiqiao Yin
Scientific Reports
Building similarity graph...
Analyzing shared references across papers
Loading...