[KongchangAI]
· 2 min read· 1,138 words

Event2Vec: A New Event Embedding Method for Fully Decomposable Sequence Scoring

Event2Vec: A New Event Embedding Method for Fully Decomposable Sequence Scoring

Event2Vec uses additive event embeddings to make linear scoring precisely attributable while accounting for sequence order.

Event2Vec, shared by a Reddit developer, aims to strike a balance between interpretability and sequence modeling. It models history as a rolling sum of event vectors with norm clipping, predicts the next event via softmax, and trains as self-supervised next-event prediction plus a reconstruction term, requiring no manual labels. Since history is a sum, any linear score can be precisely decomposed into individual event contributions, facilitating attribution. In response to the challenge that "additive commutativity loses order," the author points out that vectors are commutative but the training process is not, and additionally provides non-commutative or geometrized spaces such as hyperbolic Möbius addition, κ-stereographic, spherical SO(n) rotations, and the Heisenberg group. The project originated from root-cause analysis of fault logs at Berkeley Lab's Advanced Light Source, is open-sourced under MIT, and provides a scikit-learn-style API with a PyTorch backend.

Core Idea: History Is the Accumulation of Event Vectors

Event2Vec's structure is deliberately kept simple. A history h_t is defined as a rolling sum of event vectors: h_t = h_{t-1} + e_{x_t}, with norm clipping applied at each step to prevent the history vector from growing unboundedly. The prediction of the next event is done via softmax: p(x_{t+1} | h_t) = softmax(W h_t + b).

Training is self-supervised and requires no manual labels. The objective is next-event prediction, combined with a reconstruction term that requires h_t - h_{t-1} to recover e_{x_t}. According to the author, the theoretical details behind this mechanism (including how multiple loss functions work together to ensure the arithmetic properties hold during training) are written up in a NeurReps@NeurIPS Workshop paper.

The direct benefit of this design is: since history is a sum, any linear model built on top of it is also a sum. The example the author gives is churn or risk scoring: score = w·h + b = Σ_i (e_i·w) + b. In other words, the score of a sequence can be precisely decomposed into the independent contribution of each event, which is a very practical property for attribution and interpretability.

Norm clipping is a common stabilization technique in sequence modeling: after the history vector is updated via h_t = h_{t-1} + e_{x_t}, if its L2 norm exceeds a preset threshold τ, it is scaled back onto the sphere via h_t ← h_t · τ / max(τ, ‖h_t‖). Its role is similar to gradient clipping—preventing the vector from exploding linearly with sequence length, thereby keeping the logits of the subsequent softmax numerically stable and preventing training divergence. The cost is that when sequences are very long, the contributions of earlier events to h_t are gradually diluted, so the model leans toward recent events, which is itself an implicit forgetting/attention mechanism.

The reconstruction term refers to the additional requirement, beyond the next-event prediction loss, that h_t − h_{t-1} can recover the embedding e_{x_t} at that time. Since h_t − h_{t-1} is exactly equal to e_{x_t}, this constraint directly supervises the embedding itself not to degenerate, avoiding the model collapsing all events onto the same trivial vector; it works in concert with the prediction loss so that the arithmetic property "history is accumulation" truly holds during training, rather than being merely a structural assumption. This falls under self-supervised learning: the supervision signal is constructed from the sequence itself, requiring no manual annotation.

Vector Spaces Are Commutative, but Training Is Not

An easily challenged point is: e1 + e2 = e2 + e1 = e3, additive embeddings are commutative in Euclidean space, so isn't the order information lost? The author's response is: the vector embeddings themselves are commutative, but the training process is not. Due to the existence of the next-event prediction and reconstruction losses, the model treats event sequences in different orders differently during training.

To handle order and structure more explicitly, Event2Vec also provides several non-commutative or geometrized alternative spaces as part of the library:

  • Hyperbolic space (Möbius addition): suitable for expressing hierarchical structure;
  • κ-stereographic model: uses a single curvature knob to continuously adjust between hyperbolic, flat, and spherical (Bachmann et al., 2020);
  • Spherical space: uses SO(n) rotations to represent cyclic structure; rotations are non-commutative, so different orders yield different endpoints;
  • Heisenberg group: same endpoint, but with a signed area coordinate used to record order.

The existence of these spaces allows the model to accommodate more types of sequence structure while keeping additive scoring decomposable.

Möbius addition is the operation in hyperbolic space analogous to Euclidean addition: a ⊕_c b = ((1 + 2c⟨a,b⟩ + c‖b‖²)a + (1 − c‖a‖²)b) / (1 + 2c⟨a,b⟩ + c²‖a‖²‖b‖²), where c is the curvature. It is neither commutative nor associative, but satisfies the group axioms and can "translate" points along geodesics. When used for event accumulation, order produces different results, and the step size automatically shrinks near the boundary, making it naturally suited for encoding tree-like/hierarchical structures.

The κ-stereographic model (Bachmann et al., 2020) uses a single curvature parameter κ to uniformly describe constant-curvature spaces: κ > 0 for spherical, κ = 0 for Euclidean, κ < 0 for hyperbolic, and it can be continuously adjusted during training, without needing to design a separate operator for each geometry. SO(n) refers to the n-dimensional special orthogonal group, i.e., the set of rotation matrices with determinant +1; composition of rotations is not commutative, so when representing events with SO(n) rotations, different orders lead to different endpoints, making it suitable for modeling periodic or cyclic structure. The Heisenberg group is a three-dimensional zero-curvature Lie group whose coordinates can be understood as (x, y, area), with multiplication containing a cross term, so that the resulting commutator is exactly the signed area spanned by the two vectors—this is precisely how it records "order": the endpoints are the same but the area swept out by the path differs, thereby carrying order information.

Starting from the Fault Logs of a Synchrotron Light Source

Event2Vec's starting point was not recommender systems or advertising, but root-cause analysis of fault sequences at the Advanced Light Source (Berkeley Lab). The author originally naively used Word2Vec on event logs, but quickly found that a solution was needed that could express directionality without becoming a black-box sequence model.

This background explains many of the library's design choices: an emphasis on interpretable additive structure, a scikit-learn-style fit/transform API, gensim-style most_similar compatibility, a PyTorch backend with CPU/CUDA/MPS support. The code is open-sourced under the MIT license, installable via pip install event2vector, with paper number arXiv 2509.12188, and the official website also provides documentation with interactive graphics.

For teams that need event-level attribution under linear scoring, Event2Vec offers a lightweight and mathematically clean option. It does not attempt to replace large sequence models, but rather draws a clear boundary between interpretability and sequence modeling.

One-line Summary

Event2Vec uses additive event embeddings to make linear scoring precisely attributable while accounting for sequence order.

Paragraph Summary

Event2Vec, shared by a Reddit developer, aims to strike a balance between interpretability and sequence modeling. It models history as a rolling sum of event vectors with norm clipping, predicts the next event via softmax, and trains as self-supervised next-event prediction plus a reconstruction term, requiring no manual labels. Since history is a sum, any linear score can be precisely decomposed into individual event contributions, facilitating attribution. In response to the challenge that "additive commutativity loses order," the author points out that vectors are commutative but the training process is not, and additionally provides non-commutative or geometrized spaces such as hyperbolic Möbius addition, κ-stereographic, spherical SO(n) rotations, and the Heisenberg group. The project originated from root-cause analysis of fault logs at Berkeley Lab's Advanced Light Source, is open-sourced under MIT, and provides a scikit-learn-style API with a PyTorch backend.

#Event2Vec#event embedding#additive embedding#sequence modeling#interpretability#root cause analysis#hyperbolic space#self-supervised learning
Share:

Related articles