Polymorph: Operating System Kernel Optimization Through Artificial Intelligence

Dean Sysman, Georgios Liargkovas, Tal Zussman, Hasan Zengin, Petra Hedesiu, Hubertus Franke, Tamar Eilam, Kostis Kaffes, Asaf CidonarXiv 2026 · arXiv

TL;DR

Polymorph is a novel framework that uses AI to optimize operating system kernel policies—like memory management and task scheduling—in real-time. Instead of using expensive AI to "guess" a fixed policy offline, Polymorph uses an AI agent once to design a highly flexible, parameterized policy that a lightweight tuner then optimizes on-the-fly, doubling the performance gains of previous state-of-the-art methods.

What Problem Does This Paper Address?

Modern operating systems like Linux use "one-size-fits-all" policies for critical tasks. For example, the page cache (which decides which data to keep in RAM) usually defaults to a "Least Recently Used" (LRU) approach. While LRU is a good generalist, it's often suboptimal for specific applications like databases or search engines.

Recent technologies like eBPF allow developers to inject custom code into the kernel to change these policies without rebooting. However, the "search space" for the perfect policy is massive. Previous AI-driven attempts to solve this fall into two traps:

  1. Offline Evolutionary Search: Uses LLMs to iteratively write and test code against recorded traces. This is incredibly expensive (costing hundreds of millions of tokens) and often produces "brittle" policies that overfit to the training data and fail when the workload changes.
  2. Online Knob Tuning: Adjusts existing system settings (knobs) in real-time. While fast, it's limited by the lack of expressivity in the existing "knobs" provided by the kernel.

Methods

The authors propose a "write once, tune online" approach called Polymorph.

  • The Design Phase: An AI agent (like Claude or Gemini) is used just once to write a generalized eBPF policy. This policy isn't a single fixed algorithm; it's a flexible structure with "tunable parameters" (e.g., thresholds for moving data between memory lists).
  • The Tuning Phase: A lightweight, non-LLM user-mode tuner monitors live system telemetry (like I/O stats and CPU utilization). Every 2 seconds, it adjusts the parameters of the eBPF policy via a shared memory map.
  • No LLM in the Loop: Crucially, no expensive AI calls happen during runtime. The "intelligence" is baked into the flexible policy design and the deterministic tuning logic.
Figure 1. LevelDB (Twitter) and filesystem (Meta) throughput with different page cache policies.

Datasets

The researchers evaluated Polymorph across 17 diverse workloads:

  • Page Cache: 10 production storage traces from Twitter (running on LevelDB) and 1 block storage trace from Meta.
  • Process Scheduler: 6 workloads including CPU-bound batch processing, PostgreSQL databases (OLTP), and the Xapian search engine.
  • Baselines: They compared against standard Linux defaults (LRU, MGLRU, EEVDF), specialized static policies (LFU, S3-FIFO, LHD), and state-of-the-art offline AI generators like OpenEvolve.

Key Insights and Ideas

  • Generalization is the "Killer": The paper proves that offline AI search is prone to overfitting. As shown in Figure 3, while an LLM can "evolve" a policy to perform perfectly on a specific 4-minute trace, that same policy often performs worse than the default when faced with "unseen" data.
  • The "White Box" Advantage: Feeding AI agents internal system telemetry (like I/O traces) during the design phase significantly improves the quality of the generated code compared to treating the OS as a "black box."
  • Structural Flexibility > Algorithmic Perfection: Instead of trying to find the "one true algorithm," it is more effective to build a structure that can become many algorithms (like LRU, SLRU, or LFU) simply by changing a few numbers in a map.
Figure 3. Throughput using OpenEvolve on Twitter cluster 17, demonstrating the noisy and non-monotonic nature of offline evolutionary search.

Key Results

  • Page Cache Performance: Polymorph improved throughput by 8.4% over Linux’s default LRU on unseen data. This is nearly double the gain of the best existing static policy (LHD at 4.2%).
  • Scheduler Performance: It achieved a 2.75x improvement over the Linux default (EEVDF) across six workloads, outperforming the best fixed custom policies.
  • Cost Efficiency: Generating a policy with Polymorph costs roughly 16M tokens once. In contrast, agentic offline search requires 125–240M tokens per workload to achieve inferior generalization.
  • Rapid Adaptation: In scheduler tests, Polymorph successfully detected workload shifts and adapted its policy parameters within 2.5 seconds.

Limitations and Future Work

  • Scope: The current study focuses on the page cache and scheduler. Future work could extend this to other subsystems like network congestion control or prefetching.
  • Tuner Sophistication: The current user-mode tuner uses a relatively simple "one parameter at a time" search. Integrating more advanced control theory or reinforcement learning (without the overhead of an LLM) could further refine performance.
  • Initial Seeds: The initial "generalized" policy still relies on being designed against at least one representative workload; if a future workload is radically different from anything seen during the design phase, the parameters might not have enough "stretch" to compensate.

Summary updated

Abstract

While popular operating systems such as Linux and Windows were originally designed as monolithic kernels, an increasing number of kernel subsystems have become extensible using eBPF. Users can now define custom policies for essential kernel mechanisms, such as the process scheduler, page cache, and network stack, without recompiling the kernel. These mechanisms give developers significant freedom to fit the kernel to their applications' workloads, but the question of which policy to deploy remains open. We study how to use agentic AI to automate kernel policy development, selection, and deployment, focusing on the page cache and the process scheduler as two representative subsystems. We show that existing approaches fall short: evolutionary and agentic search runs offline, is relatively expensive, and often fails to generalize to online workloads, while online knob tuners are encumbered by the knobs' lack of expressivity. In contrast, we propose Polymorph, which learns online: an AI agent writes a generalized, granular policy once, and a user mode tuner adjusts its parameters during runtime, with no LLM in the loop. For the page cache, Polymorph improves throughput over Linux's LRU by 8.4% on unseen data, nearly twice the gain of the best existing policy, while adapting to workload changes at runtime and costing only 16M tokens once, versus 125-240M tokens per workload for agentic offline search. For the process scheduler, it improves on Linux's default by 2.75x across six workloads, versus 2.27x for the best fixed sched_ext policy.
BibTeX
@misc{sysman2026polymorph,
  author = {Dean Sysman and Georgios Liargkovas and Tal Zussman and Hasan Zengin and Petra Hedesiu and Hubertus Franke and Tamar Eilam and Kostis Kaffes and Asaf Cidon},
  title = {{Polymorph: Operating System Kernel Optimization Through Artificial Intelligence}},
  year = {2026},
  eprint = {2611.23644},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.23644},
}
Figure