CoChat

System log anomaly detection based on contrastive learning and retrieval augmented

Open access
Li, Weian, Wu, Yang, Huang, Wei, Zhou, Faheng, Ou, Weihua, Wang, Hongbing, Deng, Lunzhi · 2025 · Scientific Reports

The DOI matches its Crossref record; 31 of the 31 references it cites were found in a registry or an index.

Abstract

System logs are run-time significant events of computer systems recorded by software. By analyzing the system logs, a lot of important information and issues can be detected promptly. Log anomaly detection is a popular research topic in recent years. However, log anomaly detection faces lots of challenges such as the variability of logs, imbalance of normal and abnormal records in log, the continuous emergence of new log formats. To address these challenges, we propose a log anomaly detection framework named LogSentry based on contrastive learning and retrieval-augmented. Our framework consists of a training phase and an inference phase. In the training phase, a BERT based log anomaly detection model using contrastive learning is pre-trained and fine-tuned. In the inference phase, a retrieval-augmented method based on KNN is introduced. During inference, the prediction result of the log anomaly detection model and the average output of the retrieval-augmented method based on KNN will do a weighted summation to obtain the final result, which is whether the log data is abnormal or normal. Our experiments on widely used log datasets indicate the solution proposed in this paper achieves high performance over baseline methods.

Overview

The claims and statistics of this paper haven’t been checked yet.

Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.

A few free checks a day · papers already verified open instantly · results are public

Integrity signals

Registry

Crossref · 10.1038/s41598-025-22208-7

Cites

31 of 31 references verified0 citation errors · 0 not checkable

Statistics

Figures

Fig. 1 Construction process of log key sequence.
Fig. 1 Construction process of log key sequence.CC BY-NC-ND · PubMed Central
Fig. 2 Combination of log key similarity and dissimilarity pairs.
Fig. 2 Combination of log key similarity and dissimilarity pairs.CC BY-NC-ND · PubMed Central
Fig. 3 The process of the inference phase in our framework.
Fig. 3 The process of the inference phase in our framework.CC BY-NC-ND · PubMed Central
Algorithm 1 Two-stage training: Pre-training and fine-tuning.
Algorithm 1 Two-stage training: Pre-training and fine-tuning.CC BY-NC-ND · PubMed Central
Fig. 4 Log anomaly detection model pre-training architecture.
Fig. 4 Log anomaly detection model pre-training architecture.CC BY-NC-ND · PubMed Central
Fig. 5 Log anomaly detection model fine-tuning architecture.
Fig. 5 Log anomaly detection model fine-tuning architecture.CC BY-NC-ND · PubMed Central
Fig. 6 Retrieval-augmented method architecture.
Fig. 6 Retrieval-augmented method architecture.CC BY-NC-ND · PubMed Central
Fig. 7 Performance across varying β values based on different top-K values.
Fig. 7 Performance across varying β values based on different top-K values.CC BY-NC-ND · PubMed Central
Fig. 8 Impact of dataset usage ratio in fine-tuning phase.
Fig. 8 Impact of dataset usage ratio in fine-tuning phase.CC BY-NC-ND · PubMed Central
Fig. 9 Impact of the window size while deviding log sequence.
Fig. 9 Impact of the window size while deviding log sequence.CC BY-NC-ND · PubMed Central
Fig. 10 t-SNE visualizations of feature extraction.
Fig. 10 t-SNE visualizations of feature extraction.CC BY-NC-ND · PubMed Central

Verification

Claims the paper makes

The claims and statistics of this paper haven’t been checked yet.

Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.

A few free checks a day · papers already verified open instantly · results are public

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

The self-check needs the paper’s full text.

Citations

Cites

Show all 31 references

Research works printed but not linked: 8

  1. Lou, J.-G., Fu, Q., Yang, S., Xu, Y. & Li, J. Mining invariants from console logs for system problem detection. In 2010 USENIX Annual Technical Conference (USENIX ATC 10) (2010).
  2. Guo, H. et al. Logformer: A pre-train and tuning pipeline for log anomaly detection. Proc. AAAI Conf. Artif. Intell. 38, 135–143 (2024).
  3. Meng, W. et al. Loganomaly: Unsupervised detection of sequential and quantitative anomalies in unstructured logs. In IJCAI 19, 4739–4745 (2019).
  4. Cai, W. et al. A survey on mixture of experts. arXiv preprint arXiv:2407.06204 (2024). · arXiv
  5. Chen, T., Kornblith, S., Norouzi, M. & Hinton, G. A simple framework for contrastive learning of visual representations. In International conference on machine learning, 1597–1607 (PMLR, 2020).
  6. Guu, K., Lee, K., Tung, Z., Pasupat, P. & Chang, M. Retrieval augmented language model pre-training. In International conference on machine learning, 3929–3938 (PMLR, 2020).
  7. Li, J., Li, D., Xiong, C. & Hoi, S. Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation. In International conference on machine learning, 12888–12900 (PMLR, 2022).
  8. He, S., Zhu, J., He, P. & Lyu, M. R. Loghub: A large collection of system log datasets towards automated log analytics. arXiv e-prints arXiv–2008 (2020).

Cited by

See all 10

Metadata

Authors
Li, W., Wu, Y., Huang, W., Zhou, F., Ou, W., Wang, H., & Deng, L.
Affiliations
Guizhou Normal University (CN)
Corresponding author
Ou, Weihua
Venue
Scientific Reports
Published
2025-11-03
Volume
15
Issue
1
Pages
38370-38370
ISSN
2045-2322 (ISSN-L)
OpenAlex
W4415787937
Cited by
6
References
25
Citations by year
2026: 5 · 2025: 1
FWCI
2.52
Type
journal article
Language
en
Open access
Licence
Locations
  • Scientific Reports (publishedVersion, cc-by-nc-nd)
  • Europe PMC (PubMed Central) (publishedVersion, cc-by-nc-nd)
  • PubMed (publishedVersion)
  • DOAJ (DOAJ: Directory of Open Access Journals) (submittedVersion, cc-by-sa)
Funders
  • Guizhou Provincial Basic Research Program (Qiankehejichu-ZK[2023]Yiban252, Qiankehejichu-JC[2024]Zhongdian013)
  • High-level Innovative Talents in Guizhou Province (No. GCC[2023]033, No. BQW[2024]015)
  • Natural Science Research Project of Guizhou Provincial Department of Education (No. QJJ[2024]009, Grant No. [2023]010)
  • National Natural Science Foundation of China (No.U22A2026)
Topics
  • Physical Sciences › Computer Science › Computer Networks and Communications › Software System Performance and Reliability
  • Physical Sciences › Computer Science › Artificial Intelligence › Anomaly Detection Techniques and Applications
  • Physical Sciences › Computer Science › Computer Networks and Communications › Network Security and Intrusion Detection
Keywords
log anomaly detection, system logs, contrastive learning, retrieval-augmented generation, BERT, k-nearest neighbors, class imbalance

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review

How to cite

Cite CoChat for the checks on this page, and the paper for its own findings.

This page
CoChat. (2026). Citation check: System log anomaly detection based on contrastive learning and retrieval augmented. https://app.cochat.ai/papers/10.1038/s41598-025-22208-7
The paper
Li, W., Wu, Y., Huang, W., Zhou, F., Ou, W., Wang, H., & Deng, L. (2025). System log anomaly detection based on contrastive learning and retrieval augmented. Scientific Reports. https://doi.org/10.1038/s41598-025-22208-7

Data sources

Bibliographic data: Semantic Scholar, OpenAlex, Crossref.

Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).

Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.