Effective and Efficient Threat Hunting with Small Language Models
Not on the map. Why?
Abstract (arXiv)
Analysts in Security Operations Centers query massive telemetry streams using Kusto Query Language (KQL), but writing correct KQL demands specialized expertise that bottlenecks scaling security teams. We investigate how Small Language Models (SLMs) can enable accurate, cost-effective translation from natural language queries (NLQs) to KQL. We propose a three-knob framework spanning prompting, fine-tuning, and architecture. First, we adapt NL2KQL for SLMs with lightweight retrieval and introduce error-aware prompting that targets common parser failures with a handful of mined tips, at a fraction of the tokens KQL's full rule set would require. Second, we apply LoRA fine-tuning with rationale distillation augmenting each NLQ-KQL pair with a brief chain-of-thought to transfer teacher reasoning. This yields an informative negative result, as neither variant surpasses targeted prompting. Third, we propose a two-stage architecture pairing an SLM drafter with a low-cost LLM judge for schema-aware refinement. We evaluate nine models (five SLMs, four LLMs) on syntax correctness, semantic accuracy, table selection, filter precision, latency, and token cost. On Microsoft's NL2KQL Defender Evaluation dataset, our two-stage approach reaches 0.987 syntax and 0.906 schema-valid ("semantic") accuracy, exceeding every baseline we run under equivalent infrastructure, and it generalizes to independently authored queries over the same schema (0.964 syntax, 0.831 schema-valid). The only baselines within 0.05 schema-valid are NL2KQL+GPT-4o (0.878) and NL2KQL+GPT-5 (0.861), which cost USD 2.998 and USD 2.018 for 230 queries against USD 0.213 for ours, a 9.5-14x reduction at matched accuracy. These results establish SLMs as a practical foundation for natural-language querying in security operations.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Builds on 13 of its 34 references that are in the map. First posted on arXiv 7 Dec 2025.
Builds on
13 of 34 references.
References · 13
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,626
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,708
- 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,442
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
- 2025Small Language Models are the Future of Agentic AIcited by 270
- 2023Small Models are Valuable Plug-ins for Large Language Modelscited by 42
- 2024Knowledge-to-SQL: Enhancing SQL Generation with Data Expert LLMcited by 35
- 2024Towards Optimizing the Costs of LLM Usagecited by 33
- 2023Xpert: Empowering Incident Management with Query Recommendations via Large Language Modelscited by 22
- 2019Bridging the Semantic Gap with SQL Query Logs in Natural Language Interfaces to Databasescited by 15
- 2024NL2KQL: From Natural Language to Kusto Querycited by 3
1 more
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2026An Agentic System for Schema Aware NL2SQL Generation
- 2025Enhancing Reasoning Capabilities of Small Language Models with Blueprints and Prompt Template Search
- 2024DistillSeq: A Framework for Safety Alignment Testing in Large Language Models using Knowledge Distillation
- 2026Optimizing Small Language Models for NL2SQL via Chain-of-Thought Fine-Tuning
- 2024Small LLMs Are Weak Tool Learners: A Multi-LLM Agent
- 2026Structured Prompt Language: Declarative Context Management for LLMs
- 2024PrimeGuard: Safe and Helpful LLMs through Tuning-Free Routing
- 2026Toward Autonomous SOC Operations: End-to-End LLM Framework for Threat Detection, Query Generation, and Resolution in Security Operations