Abstract

Whether a time-series pattern is anomalous often depends on the operating regime of the monitored process. A missing event can signal a fault in one regime and be routine in another, and the query alone may not reveal which regime applies. We study in-context learning (ICL) for time series anomaly detection (TSAD) through reference-conditioned detection, where a reference record provides evidence about expected behavior and model parameters remain fixed at inference. Supplying the reference is not enough: when training anomalies are recognizable from the query alone, the detector can fit its targets while ignoring the reference. We therefore introduce counterfactual supervision, which pairs one query with two references that support different normal rules and labels the query under each. At positions where the two labels disagree, no detector that ignores the reference can fit both targets. Anlu learns from this supervision by adding a reference memory and zero-initialized gated adapters to a frozen time-series foundation model (TSFM) pretrained for anomaly detection. On the 350 TSB-AD-U evaluation sequences, Anlu raises the mean VUS-PR of the frozen TSFM from 0.542 to 0.607. Replacing the reference with zeros lowers Anlu's score to 0.499.

Keywords

Subject

Publication details

Journal
Not available
Open access
Green open access

Cite this article

APA 7

Lan, T., Gao, Y., Lu, Y., An, X., Wang, M., Pan, Y., He, W., & Zhang, C. (2026). Anlu: Enabling In-Context Time Series Anomaly Detection in Foundation Models via Counterfactual Supervision. https://omanscience.com/en/articles/anlu-enabling-in-context-time-series-anomaly-detection-in-foundation-models-via-counterfactual-supervision

MLA 9

Lan, Tian, et al. "Anlu: Enabling In-Context Time Series Anomaly Detection in Foundation Models via Counterfactual Supervision." https://omanscience.com/en/articles/anlu-enabling-in-context-time-series-anomaly-detection-in-foundation-models-via-counterfactual-supervision.

Chicago (author–date)

Lan, Tian, Yifei Gao, Yimeng Lu, Xuming An, Meng Wang, Yue Pan, Wenjun He, and Chen Zhang. 2026. "Anlu: Enabling In-Context Time Series Anomaly Detection in Foundation Models via Counterfactual Supervision." https://omanscience.com/en/articles/anlu-enabling-in-context-time-series-anomaly-detection-in-foundation-models-via-counterfactual-supervision.

Harvard

Lan, T., Gao, Y., Lu, Y., An, X., Wang, M., Pan, Y., He, W. and Zhang, C. (2026) 'Anlu: Enabling In-Context Time Series Anomaly Detection in Foundation Models via Counterfactual Supervision', Available at: https://omanscience.com/en/articles/anlu-enabling-in-context-time-series-anomaly-detection-in-foundation-models-via-counterfactual-supervision.

Vancouver

Lan T, Gao Y, Lu Y, An X, Wang M, Pan Y, et al. Anlu: Enabling In-Context Time Series Anomaly Detection in Foundation Models via Counterfactual Supervision. https://omanscience.com/en/articles/anlu-enabling-in-context-time-series-anomaly-detection-in-foundation-models-via-counterfactual-supervision

IEEE

T. Lan, Y. Gao, Y. Lu, X. An, M. Wang, Y. Pan, W. He, and C. Zhang, "Anlu: Enabling In-Context Time Series Anomaly Detection in Foundation Models via Counterfactual Supervision," https://omanscience.com/en/articles/anlu-enabling-in-context-time-series-anomaly-detection-in-foundation-models-via-counterfactual-supervision.