Overview
Log parsing—the process of converting semi-structured system logs into structured templates and variables—is a foundational task for modern DevOps operations, including anomaly detection and root cause analysis. While Large Language Models (LLMs) have achieved state-of-the-art accuracy in log parsing, their deployment in production environments is often hindered by high latency and computational costs.
InferLog is a novel inference optimization framework designed to bridge this gap. By intelligently refining In-Context Learning (ICL) prompts to maximize prefix cache hits and utilizing meta-learning for rapid configuration tuning, InferLog reduces p95 latency by over 43% and achieves up to a 4.02× throughput improvement without sacrificing parsing accuracy.
The Bottlenecks of LLM-based Log Parsing
The authors identify three primary bottlenecks that limit the efficiency of LLMs in online log parsing environments:
- The Prefill Bottleneck: Log parsing prompts are typically long, containing detailed instructions and multiple examples, while the generated output is concise. This results in the "prefill" phase (processing input tokens) accounting for approximately 85% of total latency.
- Cache Inefficiency: Standard prefix caching, which saves intermediate Key-Value (KV) states to avoid recomputation, often fails in ICL scenarios. Because examples are dynamically selected and reordered for each query, cache misses are frequent.
- Suboptimal Configurations: Default settings for LLM serving engines are rarely optimized for the specific token distributions and workload patterns characteristic of log data.
Methodology: The InferLog Approach
InferLog introduces two synergistic components to address these challenges: Prefix-aware ICL Refinement (PAIR) and Fast Configuration Tuning.
1. Prefix-aware ICL Refinement (PAIR)
Instead of treating the prompt as a static entity, PAIR dynamically refines it to maximize KV cache reuse. It operates through three key steps:
- Matching: It searches a history table to identify previous example sets with the highest potential for cache reuse.
- Modifying: If a current example shares a template with a cached one but has different variable values, PAIR swaps it with the cached version. Since LLMs prioritize structural patterns in log parsing, this modification does not impact accuracy.
- Reordering: It rearranges examples to ensure the longest possible sequence matches the existing cache prefix.
2. Fast Configuration Tuning via AttMAML
To optimize inference parameters such as max-num-batched-tokens, InferLog employs AttMAML (Attention-based Model-Agnostic Meta-Learning). This approach allows the system to learn from historical tuning data across diverse log types. When a new workload arrives, AttMAML can recommend an optimal configuration in just 15 iterations, significantly faster than traditional optimization methods.
Experimental Evaluation
The researchers evaluated InferLog using the Loghub-2k benchmark, which contains 2,000 logs from 16 diverse systems, including HDFS, Spark, and Android. The framework was tested across several models, including Qwen2.5-14B, LLaMA3-8B, and Mixtral-7B.
Key Results
- Performance: Compared to standard vLLM setups, InferLog reduced p95 latency by 71.9% and achieved a 4.02× speedup in throughput.
- Accuracy: Across all 16 datasets, parsing accuracy remained virtually identical to standard LLM parsers, proving that prompt modification for caching is highly effective.
- Generalizability: The system showed consistent performance gains across different model architectures and varying levels of request concurrency.
Conclusion
InferLog demonstrates that by aligning prompt engineering with the underlying mechanics of LLM inference engines, it is possible to achieve production-grade performance for complex log parsing tasks. The combination of prefix-aware refinement and meta-learning-based tuning provides a robust path for deploying LLMs in real-time DevOps pipelines.
Summary updated