This repository contains the code for PolicySmith, a system that discovers heuristics (i.e., code) for systems using LLMs and evolutionary search. This README will use the example of caching to demonstrate how to use PolicySmith; this codebase is extensible to support your task(s)
- Clone dependencies:
git submodule update --init - Install MongoDB on your machine.
- Install Python libraries:
pip3 install google-genai openai pymongo. - Create a file called
api_key.pyand populate it with the following:
GEMINI_API_KEY="<<secret_key_here>>"
OPENAI_API_KEY="<<secret_key_here>>"
MONGO_CONNECTION_STRING="mongodb://localhost:27017"- Go through
./hotnets_resultsto explore the caching results described in the HotNets paper. - You can view the C++ source of the heuristics discovered (PS-A, PS-B, PS-X, etc.), reproduce the boxplots in the paper.
- Follow the instructions in
webcache/README.mdto run PolicySmith for caching. Well documented. - [Experimental]
tcp_cc/bpf_scaffoldingcontains the setup to evolve TCP congestion control policies in the Linux kernel with PolicySmith. Experimental / not very well documented yet.
To use PolicySmith for your task:
- create a new directory called (e.g.
./cpu_scheduling). - Inside this directory, create a file called
./cpu_scheduling/interface.pythat subclassesEvolveInterfaceabstract class from./Evolve.py. - Look at the interface of
webcachefor more details / inspiration on what this should look like. - Profit?
@article{dwivedula2025policysmith,
title={Man-Made Heuristics Are Dead. Long Live Code Generators!},
author={Dwivedula, Rohit and Saxena, Divyanshu and Akella, Aditya and Chaudhuri, Swarat and Kim, Daehyeok},
year={2025},
eprint={2510.08803},
archivePrefix={arXiv},
primaryClass={cs.OS},
url={https://arxiv.org/abs/2510.08803},
note = {arXiv:2510.08803 [cs.OS]}
}
