A Word is Worth 4-bit: Efficient Log Parsing with Binary Coded Decimal Recognition

Prerak Srivastava, Giulio Corallo, Sergey Rybalko · DOI

Abstract

Log parsing is a critical precursor to automated system monitoring, yet existing solutions often struggle to balance granularity, ambiguity, and computational efficiency. This paper introduces 4bitparser, a lightweight character-level model that employs a novel 4-bit Binary Coded Decimal (BCD) encoding scheme. By aggregating character sequences into compressed blocks, 4bitparser achieves state-of-the-art accuracy comparable to Large Language Models (LLMs) while maintaining the efficiency required for high-throughput industrial log streams.

Introduction

System logs are semi-structured data consisting of static templates and dynamic parameters. Extracting these templates—a process known as log parsing—is essential for downstream tasks like anomaly detection. However, current methods face a "trilemma": syntax-based parsers lack granularity, semantic parsers struggle with tokenization ambiguity, and LLM-based solutions are too computationally expensive for real-time use.

The 4bitparser Architecture

The core innovation of 4bitparser is its character-level neural architecture, which bypasses traditional tokenization issues. Instead of predicting a binary mask for every character, the model uses a "4-bit" encoding trick. Characters are grouped into blocks of four, and their binary masks (e.g., 1100) are mapped to a single decimal value (0–15). This Binary Coded Decimal (BCD) approach reduces the sequence length by a factor of four, significantly lowering the computational burden on subsequent layers.

The 4bitparser architecture featuring character-level embedding, CNN downsampling, and CRF sequence labeling.

The model pipeline consists of four main stages:

  1. Character Embedding & Transformer: Raw characters are converted into dense vectors, and a single-layer Transformer captures global context.
  2. CNN Downsampling: A 1D Convolutional Neural Network with a stride of 4 performs the BCD aggregation.
  3. BiLSTM Layer: This layer captures bidirectional dependencies between the compressed blocks.
  4. CRF Layer: A Conditional Random Field ensures the predicted sequence of 16 possible BCD classes is globally optimal.

Experimental Evaluation

The authors evaluated 4bitparser on several benchmarks, including a massive dataset of 50 million log lines (Loghub-2.0), a refined version of Loghub-2k, and a new industrial dataset (Idata).

Accuracy and Performance

4bitparser demonstrates exceptional accuracy, matching the performance of LILAC, a state-of-the-art LLM-based parser, across various metrics such as Parsing Accuracy (PA) and Parameter Mask Agreement (PMA). Notably, it achieves a PMA score of 0.98, indicating near-perfect character-level alignment with ground-truth templates.

Performance comparison of 4bitparser against state-of-the-art parsers across multiple datasets.

Efficiency

Despite its high accuracy, 4bitparser remains remarkably efficient. With only 312k parameters (approx. 4.2 MB), it is suitable for edge deployment. In terms of speed, the cacheless version is 5x faster than LILAC, while the version utilizing a parsing cache is up to 20x faster than LILAC and 8x faster than LogPPT.

Conclusion

By treating log parsing as a character-level sequence labeling task and utilizing BCD compression, 4bitparser successfully bridges the gap between efficiency and accuracy. While future work may address limitations such as fixed vocabularies and the need for supervised training, 4bitparser currently stands as a highly effective solution for large-scale industrial log parsing.

Summary updated

BibTeX
@inproceedings{srivastava2025word,
  author = {Prerak Srivastava and Giulio Corallo and Sergey Rybalko},
  title = {{A Word is Worth 4-bit: Efficient Log Parsing with Binary Coded Decimal Recognition}},
  booktitle = {ICWS},
  year = {2025},
  doi = {10.1109/icws67624.2025.00127},
}
Figure