Hypergraph-Guided Regex Filter Synthesis for Event-Based Anomaly Detection

Margarida Ferreira, Victor Nicolet, Luan Pham, Joey Dodds, Daniel Kroening, Inês Lynce, Ruben MartinsarXiv 2025 · DOI

Abstract

HyGLAD is an unsupervised anomaly detection algorithm that synthesizes interpretable regular expressions (regex) from system event logs modeled as hypergraphs. Unlike "black-box" deep learning models, HyGLAD produces human-readable filters that capture normal behavior patterns. Evaluation on five datasets shows that HyGLAD outperforms state-of-the-art deep learning models in precision and recall while operating orders of magnitude faster on standard CPU hardware.

Introduction

In modern cloud infrastructure, systems generate billions of events—API calls, resource updates, and logins—every day. Detecting anomalies within these logs is a "needle in a haystack" problem critical for identifying malicious activity or system failures. Currently, engineers face a difficult trade-off: supervised learning requires rare labeled data, while unsupervised deep learning (DL) methods are computationally expensive and lack interpretability. When a DL model flags an event, it rarely explains why, complicating root-cause diagnosis. Furthermore, traditional log-parsing tools often fail to capture complex multi-entity relationships, such as specific user permissions on particular resources.

Methodology: The HyGLAD Framework

The authors propose HyGLAD (Hypergraph-Guided Regex Filter Synthesis), which reframes anomaly detection as a pattern-synthesis problem. Instead of statistical modeling, HyGLAD uses structural analysis of system events to build a representation of normal system behavior.

The HyGLAD end-to-end pipeline, from event log ingestion to the synthesis of anomaly detection filters.

Hypergraph Representation and Vertex Similarity

Every event is modeled as a "hyperedge" connecting various "vertices" (entities like UserID, Operation, and ResourceID). This captures the multi-dimensional relationships inherent in system logs. The algorithm then identifies entities that behave similarly using a modified LSimRank. For example, if two service accounts consistently perform the same set of read operations, HyGLAD recognizes them as belonging to the same "equivalence class."

Regex Synthesis and Compression

Once similar entities are grouped, HyGLAD synthesizes a regular expression to generalize their values. Instead of memorizing individual IDs like User-A and User-B, it might synthesize a pattern like User-[A-Z]. To prevent the regex from becoming too broad (risking false negatives) or too specific (risking false positives), a cost-benefit merging function balances generalization against precision.

A compressed hypergraph where specific identifiers have been generalized into human-readable regular expressions.

Evaluation and Results

HyGLAD was evaluated on five datasets, including three newly released benchmarks (Falcon, Flask, and Live) totaling 8.5 million events, alongside the BETH cybersecurity dataset and real-world incident data.

Performance and Efficiency

HyGLAD significantly outperformed seven state-of-the-art unsupervised methods from the DeepOD library:

  • Accuracy: It achieved a 1.2x improvement in precision and a 1.3x improvement in recall over the second-best baseline. On the "Live" dataset, HyGLAD reached an F1-score of 0.99, while most DL baselines failed to exceed 0.50.
  • Speed: Processing events at approximately 27 MB/s on a single CPU, HyGLAD was 400x faster to train and 120x faster during inference than the leading DL competitor, NeuTraL.

Discussion and Limitations

A key advantage of HyGLAD is its interpretability; engineers can inspect synthesized regex filters to understand exactly why an event was flagged. It also handles "cold start" scenarios well by grouping rare entities with their more common peers.

However, the current iteration struggles with numerical data. In the BETH dataset, HyGLAD could not effectively generalize over low-level attributes like IP addresses or port numbers, often treating every new IP as a potential anomaly. Future work involves incorporating specialized generalization techniques, such as grouping IP addresses by CIDR blocks or geographical location.

Summary updated

BibTeX
@misc{ferreira2025hypergraph,
  author = {Margarida Ferreira and Victor Nicolet and Luan Pham and Joey Dodds and Daniel Kroening and Inês Lynce and Ruben Martins},
  title = {{Hypergraph-Guided Regex Filter Synthesis for Event-Based Anomaly Detection}},
  year = {2025},
  eprint = {2509.06911},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.06911},
}
Figure