IT lexicon › Programming › MLGO

MLGO

Programming På svenska → Updated: 2026-11-07

Google's framework for replacing hand-written compiler heuristics in LLVM with models trained by reinforcement learning.

Mircea Trofin and colleagues at Google published the framework in 2021. The first target was inlining for code size: instead of the cost model's threshold, a small model looks at features of the call site and answers yes or no. It was trained with reinforcement learning on Google's own code, using the final binary size as the reward, and shaved a few percent off what -Oz produced. A policy for which live range the register allocator should evict followed.

The practical trick is that the model is compiled ahead of time into ordinary machine code and linked into clang. The compiler doesn't need TensorFlow at run time, and output stays deterministic. Speed gains are modest; for size, where the heuristics were always weakest, the difference shows.

← Back to the lexicon