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:
- 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.
- 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.
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.
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