arXiv:2608.28922cs.LGAug 2026

Manuscript Offprint

arXiv:2608.28922

RankShift: In-Database Detection and Explanation of Categorical Shifts

Omair Shafi Ahmed

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Omair Shafi Ahmed

Microsoft

oshafiahmed@microsoft.com

Abstract—A login service can receive its usual number of failed sign-ins while one source grows from 2% to 30% of them. The same pattern appears in system logs when a rare event template becomes common while the message rate stays stable. These events change which categories are active without changing how many events occur. RankShift detects such changes inside the analytical database that stores the data. It compares each window's category shares with a benign reference using a Pearson score whose terms identify the categories responsible for the change. The same query returns the score, calibrated alert, and largest increasing contributions.

We evaluate RankShift on HDFS, BGL, and Thunderbird. It matches the count-vector autoencoder within 0.001 AUROC on HDFS (0.999 versus 1.000) and leads on Thunderbird (0.983 versus 0.949). In a controlled fixed-volume experiment, RankShift detects rare-category shifts that are invisible to event-count monitoring, reaching 0.787 AUROC compared with 0.771 for the autoencoder. Across all three corpora, observed false-alarm rates track the requested operating levels. RankShift requires no model training or inference service, and the autoencoder's deployed state is 137× larger.

Index Terms—categorical data, anomaly detection, distribution shift, data streams, in-database analytics

I. INTRODUCTION

Monitoring systems often summarize each time window by request rate, error count, or latency. These measures can remain stable while the shares of source addresses, routes, event templates, or error codes change sharply. Figure 1 illustrates this pattern in a failed-sign-in stream. Changes in categorical composition can reveal an emerging source, a failing component, or a new workload pattern that aggregate monitoring misses. A useful monitor must detect the change and identify which categories gained or lost share.

Existing log detectors require a preprocessing, fitting, and scoring pipeline. Count-vector methods first group parsed events into windows and fit a model over the resulting vectors [1]. The autoencoder evaluated here learns normalization statistics from benign fitting windows, trains an encoder-decoder, and scores later windows by reconstruction error. Sequence detectors construct ordered event-template sequences and train next-event or masked-event predictors [2], [3]. Deployment retains preprocessing statistics, learned weights, and an inference runtime.

Distribution-change methods use different operational state. QuantTree estimates a partition from reference observations, while MStream maintains hash sketches and decayed counts [4], [5]. They run as dedicated streaming algorithms outside the analytical event table.

This paper makes three contributions:

  • Monitoring method. RankShift uses category-level Pearson contributions to score a window and identify the categories driving the change. Benign score ranks calibrate the alert.

  • Evaluation. We evaluate RankShift on three real log datasets and use fixed-total shifts to show when it leads or trails a count-vector autoencoder.

  • Native execution. It implements equivalent NumPy, DuckDB SQL, and ADX KQL semantics and measures correctness, event-volume scaling, setup, online cost, and deployed state.