TL;DR
This paper introduces a novel two-part encoder, TVM-KA, for modeling complex semi-structured object sequences, like user activity logs. By independently encoding values for each key and then aggregating these key representations, their method effectively handles long sequences and outperforms existing flattening and record-centric approaches. A key innovation is the shared attention mechanism between the two modules, trained via an interleaved schedule, which significantly boosts performance.
What Problem Does This Paper Address?
The digital world is awash in data that isn't neatly structured like a traditional database table or purely unstructured like raw text. Think of user interactions on a website, machine logs, or even shopping cart data – these are often sequences of "objects," where each object is a collection of key-value pairs that evolve over time. Modeling these "semi-structured object sequences" is challenging, primarily because they can become incredibly long. A single object might have many key-value pairs, and a sequence can contain thousands of these objects. Simply flattening everything into a long sequence of tokens (like words in a sentence) quickly overwhelms standard models due to memory constraints and computational complexity. Existing "record-centric" approaches, which treat each object as a unit, also struggle with very long sequences. The paper aims to develop a more efficient and effective way to represent and model these complex, long sequences.
Methods
The core of the proposed solution is a two-part architecture called TVM-KA:
- Temporal Value Modeling (TVM): This module focuses on each key independently. For a given key (e.g., "timestamp," "user_id"), it collects all its values across the entire sequence and encodes them into a "key-representation." This is done by treating the sequence of values for that key as an input to a standard transformer-based language encoder (like BERT or Longformer). This effectively models how a specific attribute evolves over time.
- Key-Aggregation (KA): Once TVM generates key-representations for all keys in an object sequence, the KA module takes these representations and aggregates them to produce a single, comprehensive representation for the entire sequence. This aggregation is also done using a transformer-based encoder, but it's designed to be "position-invariant" since it operates on a set of key-representations.
A crucial innovation is the shared attention heads between the TVM and KA modules. This allows the KA module to influence how TVM generates key-representations, guiding them towards what's most relevant for the downstream task. To train this effectively, they employ an interleaved training schedule, alternating between training TVM (using a Masked Language Modeling objective) and KA (using a task-specific objective). This iterative process helps the models learn from each other and prevents catastrophic forgetting.
Datasets
The authors evaluated their approach on three real-world datasets:
- Cloud Service Logs (CSL): An internal dataset of application event traces from a cloud provider, used for predicting milestone events (like plan upgrades or chatbot interactions).
- LogHub (HDFS-1): A publicly available dataset of system log messages from the Hadoop distributed file system, used for anomaly detection.
- Instacart eCommerce Data: A publicly available dataset of grocery purchase orders, used for predicting the next product a user will purchase.
Key Insights and Ideas
- Key-centric is better than flattened: Decoupling the modeling of each key's values from the overall sequence structure is key to handling long sequences. Flattening everything leads to performance degradation.
- Shared attention is powerful: Allowing the downstream task (via KA) to influence the intermediate representations (from TVM) through shared attention heads significantly improves performance. It's not just about encoding the data, but encoding it for the task.
- Interleaved training is crucial: A simple end-to-end training of TVM and KA is difficult due to memory constraints. The interleaved schedule, combined with shared heads, effectively trains the modules collaboratively, leading to better task-specific representations.
- Not all sequences are equal: The paper highlights that while their method excels on long sequences, models like Longformer can perform comparably on datasets with very long tokenized sequences if the underlying task is simpler. This suggests that the structure of semi-structured data is a distinct challenge from just long text.
Key Results
The TVM-KA model consistently outperformed baseline methods, including flattened encoding and record-centric representations, across the evaluated datasets.
- On the Cloud Service Logs dataset, TVM-KA achieved a 3.9%-58.5% increase in macro F1 scores compared to flattened encodings.
- For the Instacart dataset, TVM-KA showed strong performance in next product prediction.
- On the LogHub dataset, TVM-KA achieved a 99.32% binary F1-score, comparable to Longformer's 98.54%, though the paper notes LogHub's unique characteristics.
- The interleaved training approach was shown to be superior to a "no interleaving" baseline.
- Sharing 4 to 6 attention heads between TVM and KA yielded the best performance, with sharing too few or too many leading to drops in accuracy.
Limitations and Future Work
- Task Specificity: The authors acknowledge that while their key-centric approach is excellent for tasks that benefit from understanding attribute evolution, it might not be ideal for tasks like sequence tagging or modeling graph sequences where a global view of structured objects is more critical. For such tasks, a record-centric approach might be more suitable.
- Scalability of Training: While their interleaved training addresses memory constraints, training very large models on extremely long sequences can still be computationally intensive.
- Future Work: The paper suggests exploring how their framework can be extended to handle tasks like sequence tagging or graph sequence modeling. They also hint at further investigating the optimal number of shared attention heads and exploring different encoder architectures within the TVM-KA framework.
Summary updated