TL;DR
This paper introduces TVM-KA, a modular hierarchical encoder designed for long sequences of semi-structured objects (like JSON logs or user activity). By decomposing sequences into independent key-centric streams and using a novel interleaved training schedule with shared attention heads, the model effectively bypasses the memory bottlenecks of standard sequence flattening while outperforming record-centric baselines.
What Problem Does This Paper Address?
Modern digital systems generate vast amounts of semi-structured data—sequences of objects containing various key-value pairs (e.g., machine logs, clickstreams). Modeling these sequences is challenging for two main reasons:
- Extreme Sequence Length: A "trivial" approach is to flatten each object into a string of tokens. However, for real-world data, this can result in sequences tens of thousands of tokens long, far exceeding the memory limits of standard Transformers like BERT.
- Structural Complexity: Standard models often struggle to capture how specific attributes (keys) evolve over time. Existing "record-centric" methods, which compress an entire object into a single vector at each time step, often create information bottlenecks that hurt downstream task performance.
Methods
The authors propose a two-part hierarchical architecture called TVM-KA:
- Temporal Value Modeling (TVM): Instead of looking at whole objects, this module processes the sequence of values for each key independently over time. For example, it tracks how the
statusfield changes across 100 log entries. This allows the model to handle much longer temporal contexts. - Key Aggregation (KA): This module takes the final representations of each key from the TVM and performs self-attention across them to build a global representation of the entire sequence for a specific task (e.g., classification).
Novel Training Strategy: To ensure the TVM learns representations useful for the final task, the authors introduce shared attention heads between the two modules. They use an interleaved training schedule:
- Train TVM using a Masked Language Modeling (MLM) objective.
- Train KA for the downstream task.
- Repeat, allowing task-specific gradients from the KA to influence the TVM's shared attention weights.
Datasets
The model was evaluated on three distinct types of semi-structured data:
- Cloud Service Logs: An internal dataset of user interaction traces from a large cloud provider, used for "milestone prediction" (e.g., predicting if a user will upgrade their plan).
- LogHub (HDFS-1): A public dataset of Hadoop distributed file system logs, used for anomaly detection.
- Instacart eCommerce: A public dataset of grocery purchase histories, used for next-product prediction.
Key Insights and Ideas
- Key-Centricity is Scalable: By decoupling keys, the model can support an arbitrary number of fields and much longer time horizons than flattening. It essentially turns a 2D problem (time x keys) into multiple 1D problems (time) followed by a shallow 1D aggregation (keys).
- Interleaving Prevents Forgetting: Standard sequential training (pre-train then fine-tune) can lead to "catastrophic forgetting." The interleaved approach keeps the TVM's general understanding of the data aligned with the KA's specific task requirements.
- The "Goldilocks" Zone for Sharing: Sharing too few attention heads doesn't inject enough task bias, while sharing too many restricts the model's capacity. The authors found that sharing 4 to 6 heads (out of 12 in a BERT-base architecture) provided the best results.
Key Results
- Superior Performance: TVM-KA consistently outperformed flattened BERT and record-centric baselines. On the Cloud Service Logs, it achieved a 3.9% to 58.5% increase in Macro F1 score compared to flattened encodings.
- Handling Long Sequences: On the Instacart dataset, where sequences are particularly long, TVM-KA achieved a Recall@10 of 22.54, significantly higher than the best flattened BERT baseline (19.11).
- Efficiency: The model performs better than
bert-large(which has 3x the parameters) while using abert-basebackbone, proving that architectural structure is more important than raw size for this data type.
Limitations and Future Work
- Global View: The key-centric approach might miss complex patterns that occur across different fields at the same time step, as it only aggregates them at the very end.
- Task Constraints: The current architecture is not designed for sequence tagging (labeling each object in the sequence), as the aggregation step produces a single global vector.
- Future Directions: The authors suggest exploring more complex aggregation methods and testing the architecture on even more diverse semi-structured formats beyond JSON-like logs.
Summary updated