← Latest papers
🤖 AI

Towards Small Language Models for Security Query Generation in SOC Workflows

This paper proposes a cost-effective, three-knob framework leveraging Small Language Models with error-aware prompting, rationale distillation, and a two-stage refinement architecture to achieve high-accuracy natural-language-to-KQL translation for Security Operations Centers, significantly reducing token costs compared to large language models while maintaining robust performance across syntax and semantic metrics.

Original authors: Saleha Muzammil, Rahul Reddy, Vishal Kamalakrishnan, Hadi Ahmadi, Wajih Ul Hassan

Published 2026-02-27
📖 4 min read☕ Coffee break read

Original authors: Saleha Muzammil, Rahul Reddy, Vishal Kamalakrishnan, Hadi Ahmadi, Wajih Ul Hassan

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a detective in a massive, high-tech police station (a Security Operations Center, or SOC). Every day, millions of digital "witness statements" (logs) pour in from cameras, computers, and networks. To find a specific criminal, you need to ask the database a very specific question using a secret, complex code called KQL.

The problem? Writing this code is like speaking a foreign language that only a few experts know. If you ask the wrong question, you get no answers. If you ask a slightly wrong question, you might accidentally lock yourself out or get the wrong suspect.

This paper asks a simple question: Can we teach a small, cheap, and fast computer brain (a "Small Language Model" or SLM) to translate our plain English questions into this secret code, so regular detectives can solve crimes faster?

Here is the breakdown of their solution, using some everyday analogies:

1. The Problem: The "Expert" Bottleneck

Currently, you need a senior code-wizard to translate your question ("Show me all computers that connected to that suspicious IP address yesterday") into KQL.

  • The Old Way: You hire a super-expensive, slow, and energy-hungry "Super-Brain" (a Large Language Model or LLM) to do the translation. It's great, but it costs a fortune and takes time.
  • The New Idea: Can we use a "Junior Detective" (a Small Language Model)? They are fast, cheap, and can run on a regular laptop, but they aren't very smart on their own. They often hallucinate (make things up) or get the grammar wrong.

2. The Solution: A Three-Step Training Camp

The authors didn't just throw the Junior Detective at the problem. They built a three-step training camp to turn them into a pro.

Step A: The "Cheat Sheet" (Prompting)

Imagine giving the Junior Detective a cheat sheet that says, "Hey, don't forget to put a semicolon at the end, and don't mix up the table names!"

  • What they did: They figured out the most common mistakes these small models make (like missing parentheses or wrong table names) and added specific "error-aware" instructions to the prompt.
  • The Result: The Junior Detective stopped making silly grammar mistakes without needing more brainpower.

Step B: The "Mentorship" (Fine-Tuning with Distillation)

Imagine the Junior Detective is studying for a test. Instead of just memorizing the answer key, a Mentor (a powerful LLM) explains how they solved the problem.

  • What they did: They used a powerful AI to generate thousands of practice questions and answers, but they added a "thought process" explanation for each one. They then taught the small model to mimic this reasoning.
  • The Result: The small model learned how to think, not just what to output.

Step C: The "Two-Stage Assembly Line" (The Architecture)

This is the paper's biggest innovation. Imagine a factory line:

  1. Stage 1 (The Fast Worker): The cheap, fast Junior Detective (SLM) quickly drafts 5 different answers. It's fast and cheap, but maybe a bit sloppy.
  2. Stage 2 (The Quality Inspector): A slightly smarter, but still affordable, "Inspector" (a small LLM) looks at those 5 drafts. It picks the best one, fixes any remaining errors, and checks it against the rulebook (the database schema) to make sure it makes sense.
  • The Result: You get the speed and low cost of the Junior Detective, but the high accuracy of the Quality Inspector.

3. The Results: Fast, Cheap, and Accurate

They tested this system against the "Super-Brains" (like GPT-5).

  • Accuracy: The new system was almost as good as the expensive Super-Brains. It got the grammar right 98.7% of the time and the meaning right 90.6% of the time.
  • Cost: This is the big win. The new system cost 10 times less than the expensive Super-Brains.
  • Speed: It was much faster, which is crucial when you are trying to stop a cyber-attack in real-time.

The Big Picture

Think of this like cooking.

  • The Old Way: You hire a world-famous, Michelin-star chef (LLM) to cook every single meal for your restaurant. It tastes amazing, but it's incredibly expensive and slow.
  • The New Way: You hire a fast, local cook (SLM) to prep the ingredients and cook the basics. Then, you have a head chef (the Oracle) who just tastes the dish, adds a pinch of salt, and fixes the plating.
  • The Outcome: The food tastes just as good, but you can feed 10 times more people for the same price.

In summary: This paper proves that we don't need to rely on expensive, slow AI giants to handle security tasks. By combining a fast, small AI with a smart "quality check" step, we can make cybersecurity faster, cheaper, and accessible to everyone.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →