小型本地大语言模型引导生成 Linux 内核语义补丁研究
Guided Generation of Linux Kernel Semantic Patches with Small Local Language Models
AI 导读
一项 arXiv 研究探索用笔记本上运行的小型开源大语言模型将内核 API 迁移示例转化为 Coccinelle 语义补丁,框架含变化变体分解、语法修复、规则贪心组合与编译批评器。
正文 · 原文
Abstract:When a Linux kernel API changes, hundreds of drivers are converted by hand over months, and the earlier conversions are reviewed examples for the later ones. We ask whether small open language models running on a laptop can turn such examples into Coccinelle semantic patches, the rules kernel maintainers already use for tree-wide changes. We adapt guided code generation to this task: the training examples are decomposed by script into a tree of change variants, the model writes one small rule per variant under feedback from applying it to the examples, deterministic components repair SmPL syntax and generalise driver-specific names, rules are composed greedily, and a compile critic repairs or rejects a rule whose output does not build. We evaluate on a pre-registered test set of 7 migrations whose new APIs appeared after the training cutoffs of all three models (Qwen2.5-Coder 7B, Llama 3.1 8B, Gemma 3 4B), with 122 held-out driver conversions, counting a conversion as solved only if the rule's output matches the human fix and compiles. With the framework, Qwen2.5-Coder solves 35.3 conversions on average over three seeds (range 32-41), against 1.0 when prompted directly; Spinfer solves 41 and a frontier LLM agent 66. The local model solves fewer conversions than Spinfer but its rules are the most precise on the test set (0.74 of the files they change are solved, against 0.55 for Spinfer and 0.70 for the frontier agent), and the compile critic removes every output that matches the human fix but does not build. The two general-purpose models stay weak even with guidance (at most 12 solved). All code, prompts, model responses and results are released.
| Comments: | 7 pages, 6 tables, 1 figure. Code, data, prompts and model responses: this https URL |
| Subjects: | Software Engineering (cs.SE); Artificial Intelligence (cs.AI) |
| ACM classes: | D.2.7; I.2.2 |
| Cite as: | arXiv:2611.16215 [cs.SE] |
| (or arXiv:2611.16215v1 [cs.SE] for this version) | |
| https://doi.org/10.48550/arXiv.2611.16215 arXiv-issued DOI via DataCite (pending registration) |
Submission history
From: Mohanned Ahmed [view email]
[v1]
Thu, 12 Nov 2026 03:08:17 UTC (17 KB)
来源:arXiv cs.AI · arxiv.org