ProTuner: Tuning Programs with Monte Carlo Tree Search
Paper · 2020 · Ameer Haj-Ali, Hasan Genc, Qijing Huang et al.
Summary
A program can compute the right answer and still run slowly because its calculations are organized poorly. This is especially important for image processing and deep learning, where much of the work takes place inside nested loops. Changing how those loops are divided, ordered, parallelized, or assigned to vector instructions can alter execution time without changing the intended computation. ProTuner studies how to choose these implementation decisions automatically. Its central proposal is to use Monte Carlo tree search, or MCTS, to investigate complete scheduling possibilities before committing to the next optimization.
The authors build ProTuner on Halide, which separates the description of a computation from its execution schedule. Their main comparison is with a Halide scheduler that uses beam search and a learned cost model. Beam search retains a limited collection of promising partial schedules at each stage. The difficulty is that these unfinished programs do not yet have an execution time that can be measured directly, while the predictor was trained on finished schedules. A partial choice that looks unattractive can therefore be discarded even when it permits a strong final implementation. ProTuner instead completes sampled scheduling paths and uses their predicted costs to assess the earlier choices.
The resulting search combines exploration with reuse of promising discoveries. Each search tree records both average outcomes and its best completed schedule. Average outcomes guide further investigation; the best discovered outcome determines which scheduling decision becomes permanent. Several trees run in parallel, sharing the selected next decision. Most complete their exploratory paths randomly, while a minority use greedy completion. An additional version compiles and times promising finished schedules before deciding how to continue, placing a direct measurement at an important boundary between prediction and commitment.
Experiments cover 16 applications, including matrix operations, image-processing pipelines, and ResNet50. Across the reported configurations, MCTS improves the geometric mean of execution performance over beam search by 1.06×-1.36×. The largest improvement discussed in the main execution-time comparison is on interpolate, with gains of 1.8×-3.25× across MCTS configurations. Under a shared autotuning allowance of 15 minutes, the configuration using shorter search intervals reaches a geometric-mean advantage of 1.35× and an individual improvement of up to 3.43×. These findings support MCTS as a useful scheduler for the tested setting, while also revealing that longer optimization against a predictor can produce worse real execution times. The paper’s practical contribution is therefore a search procedure and an investigation of when its guidance deserves trust.
Interesting ideas
Evaluate completed alternatives. An unfinished construction may be difficult to score because its value depends on choices that have not yet been made. ProTuner estimates the usefulness of an intermediate scheduling decision by following it through to finished programs. This approach can help in other sequential design tasks where partial artifacts have ambiguous quality, including transformation pipelines, structured analysis, and bounded planning.
Use different statistics for exploration and commitment. The average result of a branch helps decide whether it deserves more investigation, while its best verified result answers whether it has already produced something worth keeping. ProTuner separates those questions. The distinction is useful whenever an optimizer seeks a strong final artifact but must avoid spending its entire budget on a branch that happened to get lucky early.
Place expensive measurements at decision boundaries. Direct execution is more trustworthy than predicted runtime, but compiling and timing every candidate would be costly. The hybrid scheduler measures promising completed candidates when choosing the next root. More broadly, a system can use a cheap approximation for broad exploration and reserve expensive validation for decisions that constrain what happens next.
Maintain diversity through explicit search roles. Random completion and greedy completion contribute different kinds of evidence. The authors find that a mostly exploratory collection of trees can benefit from a small greedy component, whereas adding more greedy trees does not consistently help. This suggests organizing search diversity around distinct behaviors whose contributions can be measured, instead of assuming that a larger collection of similar searches is sufficient.
Evaluate the optimizer under a complete budget. A search algorithm spends time generating candidates, computing features, making predictions, compiling programs, and measuring results. Counting only its central search loop can conceal the cost that matters to users. ProTuner’s fixed-budget comparison includes these activities, making the final execution performance interpretable as the product of a complete tuning procedure.
Treat optimization against a predictor as a possible source of error. A search can become increasingly successful at finding low predicted costs while becoming less successful at finding fast programs. ProTuner demonstrates this separation experimentally. The lesson transfers to any system that optimizes a surrogate score: monitor the relationship between the score and the actual objective, and do not assume that more search necessarily improves the result.
Deep dive: ProTuner: Tuning Programs with Monte Carlo Tree Search
ProTuner uses Monte Carlo tree search to tune program schedules, improving execution speed while exposing the limits of predicted costs. · about 38 minutes to read
How Mova uses it
Mova is a small language system implemented in Rust, with explicit linguistic rules, structured interpretation, mathematical components, and bounded execution interfaces. The connections below are proposals grounded in those mechanisms. They do not establish that ProTuner has been implemented in Mova or that its scheduling results transfer to language understanding. The status marks describe how each proposal relates to existing mechanisms; they are not measured application outcomes.
Idea: Evaluate completed alternatives before rejecting an intermediate decision. Where: Challenges in Beam Search and The Proposed ProTuner Scheduler. Area: reasoning and search. Mova could compare complete, bounded analysis paths when an intermediate frame or decomposition cannot be judged reliably in isolation. Mova: частково є (the top-K judge and decomposition in math::steps and deduct). Those components already examine alternatives, but an MCTS procedure over completed interpretations is not established. Why Mova: this could preserve a useful analysis whose early score is weak but whose final justification is coherent.
Idea: Define a bounded search problem through explicit states and actions. Where: Background, Markov Decision Processes, and The Proposed ProTuner Scheduler. Area: mathematics and operational planning. A Mova task could declare its current artifact, allowed transformations, terminal conditions, and objective before any search begins. Mova: частково є (configured capabilities and bounded plans in tools/octopus, together with groupant contracts). Formalizing a particular task as an MDP would remain a separate proposal. Why Mova: explicit transitions would make the scope of exploratory planning inspectable and keep unsupported operations outside the search.
Idea: Check whether the state contains everything needed for the next decision. Where: Background, Markov Decision Processes. Area: representation and reasoning. The paper’s Markov assumption requires decision consequences to depend on the represented state rather than an omitted history. Mova could use that requirement as a review question for search-state design, retaining unresolved referents, constraints, and provenance when they affect later choices. Mova: частково є (world, coref, and context state in layers). Why Mova: a richer state may prevent a planner from treating contextually different situations as interchangeable.
Idea: Balance exploration and exploitation with an inspectable rule. Where: Background, Monte Carlo Tree Search, Equation 1. Area: statistics and search. Mova could test a UCB-style selection rule for bounded alternative analyses, logging both observed utility and the contribution from limited visitation. Mova: нове. The digest does not establish such a policy, so the mark is provisional. Why Mova: an explicit selection calculation fits transparent reasoning and would show whether a branch was revisited because it looked useful or because evidence about it remained sparse.
Idea: Keep average branch quality separate from the best artifact found. Where: The Proposed ProTuner Scheduler and Figure 3. Area: search statistics. Mova could retain a branch’s mean outcome alongside its strongest admitted result, using the former for exploration and the latter when selecting a concrete artifact. Mova: частково є (retained experiment outcomes in self-play and explicit checks in groupants). The specific dual-statistic tree policy is unverified. Why Mova: this separation could reduce premature commitment while preserving the strongest result already supported by evidence.
Idea: Preserve the completed artifact that supports a search score. Where: The Proposed ProTuner Scheduler and Figure 3. Area: provenance and data. ProTuner stores the complete schedule responsible for a node’s best cost. Mova could similarly require every best-analysis score to identify the exact interpretation, rule set, or execution artifact that produced it. Mova: вже є (source-bound groupant evidence, worker results, and retained experiment journals). The useful transfer is to apply that discipline consistently to any future search tree.
Idea: Use inexpensive guidance broadly and direct checks selectively. Where: Figure 6 and the section on combining Real Execution Time Measurement with the Cost Model. Area: evaluation and operational planning. A Mova search could use a cheap estimate to propose candidates, then run the relevant native checker before choosing a consequential next step. Mova: частково є (review and admission gates in tools/enrich, worker inspection, and groupant checks). Why Mova: this could concentrate expensive verification on decisions that restrict later work while retaining broad exploratory coverage.
Idea: Maintain different kinds of evidence as different fields. Where: Integrating the Cost Model with Measurements of Actual Execution Time; Execution Time and Cost. Area: data and epistemic status. Predicted cost and measured runtime can disagree, so a Mova tuning record should preserve both without silently promoting the estimate into an observation. Mova: вже є (typed evidential information in prag/src/frames.rs, source-bound evidence, and the separation between worker receipts and admitted knowledge). The proposed application would extend an existing distinction to search diagnostics.
Idea: Combine exploratory and greedy search roles. Where: Improving Scheduling Time by Adding Greedy MCTSes and Figures 4–6. Area: search organization. Mova could assign different bounded completion policies to analysis workers, then compare their admitted outputs through the same checks. Mova: частково є (specialist profiles over a shared graph in world/src/knowledge/retention/mice.rs). Those specialists are not an MCTS ensemble. Why Mova: explicit behavioral diversity could help distinguish a quickly discovered conventional interpretation from alternatives requiring broader exploration.
Idea: Measure which search role actually supplies accepted decisions. Where: Figure 4 and Improving Scheduling Time by Adding Greedy MCTSes. Area: evaluation. Mova could record whether accepted proposals originate from a greedy, exploratory, or specialist path, instead of reporting only the final score. Mova: частково є (retained worker results and specialist observations). A role-contribution experiment is not established. Why Mova: this would show whether an added search role contributes useful results or merely consumes resources.
Idea: Synchronize parallel searches through a checked common decision. Where: The Proposed ProTuner Scheduler and Figure 6. Area: parallel execution. Independent Mova searches could propose a next state, compare completed evidence, and continue from one selected state at an explicit boundary. Mova: частково є (worker protocols and deterministic combination of mouse observations). The synchronized tree-search procedure remains a hypothesis. Why Mova: controlled synchronization could make parallel exploration easier to reproduce and explain than unrestricted sharing of mutable search state.
Idea: Evaluate the complete optimization budget. Where: Autotuning with Limited Time Budget and Figure 9. Area: evaluation and resource accounting. A Mova experiment should include preparation, candidate generation, checking, and final assessment when comparing alternative search procedures. Mova: частково є (tools/jobs records estimates and actual resource use; tools/twin compares predictions with measured runs). Why Mova: complete accounting would reveal whether an apparent search improvement survives the costs of making its output usable.
Idea: Detect overoptimization of a surrogate. Where: Execution Time and Future Work. Area: evaluation and statistics. Mova could track whether increasingly favorable internal scores continue to predict gains on the actual task. Mova: частково є (held-out self-play gates and before-and-after checks in tools/enrich). ProTuner supplies a specific warning about search exploiting predictor error. Why Mova: this matters when tuning rule weights or proposal rankings, where a better internal score may conceal worse answers.
Idea: Diagnose mismatch between predictor training and search queries. Where: Challenges in Beam Search and Figures 1–2. Area: data and evaluation. ProTuner’s predictor learns from complete schedules but is queried on incomplete ones by beam search. Mova could audit whether any learned scorer is being asked to evaluate a different kind of object from those used in its training. Mova: нове. The digest does not establish this particular audit. Why Mova: identifying such mismatches could explain failures that would otherwise be blamed on insufficient data or weak rules.
Idea: Test local retraining before assuming it fixes the problem. Where: Challenges in Beam Search and Figure 2. Area: experimental design. The authors retrain on the same benchmark programs and still find mixed outcomes. Mova could compare task-specific retraining with a structural change in how a scorer is used. Mova: частково є (separate training procedures and regression-gated revisions). The proposed controlled comparison is unverified. Why Mova: it could distinguish missing task coverage from a scoring problem that additional examples cannot resolve.
Idea: Represent uncertainty about unfinished artifacts through multiple completions. Where: Challenges in Beam Search and Figure 1. Area: reasoning and representation. The paper explains why a partial schedule can lead to different final costs. Mova could preserve several admissible completions of an ambiguous analysis rather than forcing a single early value. Mova: частково є (explicit ambiguities and complementary observations in groupants, plus alternative mathematical branches). Why Mova: this would make uncertainty about future decisions visible instead of hiding it inside a confident score.
Idea: Give stopping decisions explicit resource limits. Where: The Proposed ProTuner Scheduler. Area: operational control. ProTuner commits when an iteration allowance or timeout is reached. Mova could apply the same discipline to exploratory interpretation or model comparison, preserving the best checked result and an explicit account of incomplete exploration. Mova: вже є (bounded native tasks, job limits, and capped mouse epochs). The paper reinforces an existing requirement that search completion and proof of optimality must remain separate claims.
Idea: Test reward transformations as substantive algorithm changes. Where: Improving Scheduling Time by Adding Greedy MCTSes. Area: mathematics and statistics. Turning costs into a binary improvement signal changes what the search learns, even if it simplifies configuration. Mova could compare such transformations against the original task objective before adopting them. Mova: нове. A corresponding search-reward experiment is not established in the digest. Why Mova: this could prevent a convenient normalization from removing distinctions needed to rank useful candidates.
Idea: Adapt search parameters to the task’s scale. Where: Execution Time and Future Work. Area: search configuration. Mova could investigate whether larger decomposition problems need different exploration strengths or longer search windows than small, well-constrained tasks. Mova: частково є (explicit budgets and resource prediction in tools/jobs and tools/twin). Automatic search-parameter adaptation is not established. Why Mova: task-dependent settings could reduce wasted effort on simple cases while leaving room for harder reasoning paths.
Idea: Consider changing exploration as the search progresses. Where: Future Work. Area: statistics and search. The authors suggest reducing exploration deeper in the tree when child costs become less variable. Mova could test a similarly declared policy for a bounded search whose remaining alternatives narrow over time. Mova: нове. This is a proposal rather than a reported Mova mechanism. Why Mova: a fixed exploration setting may allocate effort poorly when early decisions are broad and later decisions are tightly constrained.
Idea: Profile candidate construction separately from candidate evaluation. Where: Search Time and Future Work. Area: data processing and performance. Mova could report how much tuning time goes to constructing alternatives, extracting features, and evaluating them. Mova: частково є (tools/twin, job measurements, and enrichment profiling). The detailed decomposition proposed here would require measurement. Why Mova: ProTuner shows that the obvious scoring component need not be the dominant expense.
Idea: Generate only the candidate that a sampling policy needs. Where: Search Time and Future Work. Area: data structures and algorithms. ProTuner identifies waste from constructing every possible child before selecting one randomly. A future Mova sampler could request a legal next transformation directly instead of materializing the whole candidate collection. Mova: нове. No equivalent optimization is established by the digest. Why Mova: this could reduce allocation and enumeration costs in large rule or plan spaces, provided sampling remains correct and reproducible.
Idea: Keep a common search space when comparing search policies. Where: The Proposed ProTuner Scheduler and Evaluation. Area: evaluation design. The authors reuse scheduling enumeration and cost-evaluation techniques from the beam-search baseline. Mova could compare greedy, beam, and exploratory procedures over the same allowed transformations and checks. Mova: частково є (controlled self-play changes and regression gates). Why Mova: a common space would help attribute a gain to the search policy rather than to extra capabilities granted only to the new method.
Idea: Control parallel resources in baseline comparisons. Where: Evaluation. Area: evaluation and parallel computing. ProTuner compares parallel MCTS with parallel beam searches. Mova could explicitly match worker allowances when assessing alternative planners or readers. Mova: частково є (bounded jobs and configured workers). An equal-resource comparison for a future MCTS planner remains unmeasured. Why Mova: this would avoid crediting a search strategy for gains that actually come from additional concurrent computation.
Idea: Protect timing measurements from interference. Where: Measuring and Evaluating Actual Execution Time in Combination with the Cost Model. Area: performance evaluation. The authors run candidate benchmarks serially and control their machine setup. Mova could isolate timing-sensitive checks while allowing independent preparation work to proceed where safe. Mova: частково є (CPU reference execution and measured runs in tools/twin). The specific measurement protocol would need to be declared. Why Mova: trustworthy runtime evidence is necessary before a tuning decision can be justified as a speed improvement.
Idea: Report the selection procedure used across repeated runs. Where: Evaluation and Autotuning with Limited Time Budget. Area: statistics and reproducibility. ProTuner reports the strongest schedule found across its repeated searches. Mova should similarly identify whether a result describes a single run, a typical run, or a selected best artifact. Mova: частково є (fixed seeds, repeatability requirements, and retained experiment journals). Why Mova: this makes an optimizer’s result interpretable without confusing reproducible selection with typical search behavior.
Idea: Preserve measurement failures as coverage limits. Where: Bringing Measurements of Actual Execution Time Together with the Cost Model. Area: evaluation and operational robustness. The paper treats wrapper failures and the ResNet50 measurement restriction explicitly. Mova could require unsupported checks to remain visible in reports, rather than letting an available proxy stand in silently. Mova: вже є (unsupported native requests preserve failure, and dictionary-index reviews record absent coverage). This existing practice is directly relevant to any future tuning benchmark.
Idea: Record search-space restrictions alongside results. Where: Related Work and Future Work. Area: evaluation and representation. Mova could state which rule combinations, transformations, or model compositions were allowed and which were pruned before claiming a search improvement. Mova: вже є (configured capability boundaries and groupant conformance profiles). ProTuner’s restrictions on scheduling choices illustrate why a strong result within a space does not establish optimality outside it.
Idea: Reuse prediction infrastructure while changing decision placement. Where: Challenges in Beam Search and The Proposed ProTuner Scheduler. Area: architecture. ProTuner changes where the predictor is consulted rather than relying only on a replacement predictor. Mova could investigate whether an existing scorer becomes more useful when applied after a complete native interpretation or checkable decomposition. Mova: частково є (separate linguistic, combinatorial, and operational responsibilities). Why Mova: this offers a route to better behavior through explicit orchestration, consistent with Mova’s emphasis on rules and inspectable interfaces.
Idea: Separate a theoretically convergent procedure from a finite-budget claim. Where: Monte Carlo Tree Search, The Proposed ProTuner Scheduler, and Evaluation. Area: mathematics and scientific reporting. Mova should distinguish an algorithm’s asymptotic property from what a particular bounded run has established. Mova: вже є (source-bound groupants, explicit approximation evidence, and limits on automatic composition claims). The transfer is especially relevant if exploratory search is added: finding the best checked candidate is weaker than proving that no better candidate exists.
These proposals concern search organization, measurement, and evidence handling. They do not imply that runtime rewards can replace linguistic correctness, dictionary admission, or the reasons attached to Mova’s answers. Any application would need its own declared objective, admissible alternatives, and evaluation on the actual task.
The problem and its context
The same calculation can have very different execution costs
ProTuner addresses a problem in code and programming languages: choosing how a fixed computation should execute. Its target programs contain substantial loop-based work. A loop might traverse an image, calculate part of a convolution, or contribute to a matrix operation. Once several loops are nested and several intermediate functions are connected, there are many opportunities to reorganize execution.
The relevant choices are related. Tiling divides a larger iteration space into smaller regions. Vectorization arranges suitable work for simultaneous execution through vector instructions. Multithreading distributes work across processor threads. Inlining changes whether an intermediate computation is inserted into the code that consumes it. Decisions about storage determine where intermediate results exist and how long they remain available.
The paper treats these as scheduling decisions. They change the mapping from the algorithm to the machine while preserving the intended computation. This distinction matters because the fastest schedule cannot be identified merely by reading the mathematical description of the task. A schedule has consequences for execution order, parallel work, and intermediate storage.
The authors describe the number of possibilities as growing exponentially with the loops involved. Searching all schedules is therefore impractical for the workloads they consider. They also motivate automatic tuning through changing hardware: a schedule suitable for one target need not be the best choice elsewhere. Their discussion of specialized hardware emphasizes the cost of repeatedly handcrafting implementations.
Manual tuning can yield strong results, but the authors present it as expensive in engineering time. Heuristic scheduling reduces that effort by applying general rules, yet those rules do not guarantee the best implementation for each program. The research question is how to search more effectively without paying the cost of exhaustive compilation and measurement.
Why Halide provides a useful setting
Halide exposes the separation between an algorithm and its schedule directly. A developer can express what should be computed and then specify how its stages should be organized. This gives an automatic scheduler a defined set of choices to explore.
That structure is important to ProTuner’s contribution. The paper does not introduce a general system that invents arbitrary compiler transformations from scratch. It works within Halide’s scheduling framework and reuses the baseline’s techniques for enumerating schedules and estimating their costs. The search policy changes while much of the underlying representation remains shared.
The authors situate their work among earlier Halide schedulers. They describe the original Halide approach as combining heuristic guidance with genetic exploration of rewritten schedules. Because it depended on executing candidates, tuning could become lengthy even for moderate workloads.
The default scheduler used in their comparison follows a different tradeoff. It uses greedy search and a cost model, avoiding repeated execution during scheduling. Its speed comes with restrictions: the paper describes a fixed collection of optimization heuristics and limited treatment of tiling and fusion. Other cited approaches improve these restrictions or use different manually designed cost models, but the authors still characterize their search spaces as narrower than ProTuner’s.
The paper also discusses compilers built around polyhedral loop analysis. It says these systems exclude many schedules available in Halide. This is a comparison of representable optimization choices, rather than a claim that polyhedral methods are generally ineffective. Indeed, the authors later identify polyhedral representation as a possible ingredient in more accurate prediction.
The attraction and weakness of beam search
The strongest direct baseline is a Halide scheduler based on beam search. Beam search explores a decision tree level by level. At a level, it generates possible extensions of the partial solutions currently retained, assigns scores, and keeps a limited set for the next level.
The beam size controls how many alternatives survive. A larger beam can preserve more possibilities than a purely greedy procedure, but it still discards branches before their final consequences are known. If the score at an intermediate point is misleading, the branch containing the best eventual schedule can disappear.
A cost model makes this procedure practical by estimating runtime without compiling and timing every candidate. However, the authors identify a mismatch between its training and its use. Training examples consist of complete schedules. Beam search repeatedly asks it to score incomplete schedules.
The issue is deeper than ordinary prediction noise. An unfinished schedule does not specify a unique future program. Several completions may remain possible, and those completions can have substantially different execution costs. Assigning a single meaningful runtime to the unfinished object is therefore difficult.
The paper also observes errors on completed schedules. Even when an estimate concerns a finished program, a smaller predicted cost need not identify a faster executable. Errors at intermediate stages can additionally affect which later possibilities remain reachable.
ProTuner’s response is to change the search process so that the predictor evaluates completed schedules. Instead of asking which unfinished object looks best now, it asks what completed outcomes can be reached through a proposed decision. That shift connects the scheduling problem to sequential decision-making.
Connections to the surrounding compiler literature
The authors relate their work to TVM and its tuning methods. Their discussion of Learning to Optimize Tensor Programs describes AutoTVM as using tree-based methods while still requiring manually specified search spaces for individual loops. They also emphasize that optimizing operations separately differs from exploring a larger connected program.
Another cited line applies reinforcement learning to compiler decisions. The paper mentions scheduling, optimization ordering, vectorization, and device mappings as examples of compiler choices studied with learning methods. These references establish that automatic optimization already had a broad methodological context. ProTuner’s specific intervention is the use of MCTS within the Halide scheduling problem.
The discussion of Tensor Comprehensions belongs to the comparison with polyhedral approaches. The paper does not experimentally compare ProTuner with every compiler it cites. Its main empirical argument remains the controlled comparison against the Halide beam-search system and the additional search baselines.
The method, step by step
Represent scheduling as a sequence of decisions
The authors formulate scheduling as a Markov decision process, abbreviated MDP. A state describes the scheduling choices already made. An action adds an allowed optimization decision. The transition leads to a new partial schedule, and eventually to a fully specified schedule.
The paper’s general MDP definition includes a state set, an action set, a reward function, and transition probabilities. The initial state represents the starting point before scheduling decisions have been applied. A policy is a rule that selects an action from the current state.
The Markov condition says that the consequences of the next action depend on the current state rather than on a separate, unrepresented history. For scheduling, the intended representation carries the choices already applied, so the next legal transformations and their consequences can be considered from that representation.
The paper expresses its objective in terms of rewarding fast execution. Its motivation describes reward as inverse execution time. The implementation discussion also uses costs directly, recording execution-time estimates and choosing lower-cost schedules. These are different presentations of the same optimization direction, but the exact numerical treatment matters for the exploration rules examined later.
For a tensor with n dimensions, the scheduling procedure described by the authors has n stages. It works backward from the output-side stage towards the inputs. Each decision can introduce a tiling and determine the granularity of computation and storage. The resulting tiled work may be unrolled or assigned across threads or SIMD lanes.
This is the search space inherited from the earlier Halide approach. MCTS chooses among these possibilities; it does not remove the need for a legal scheduling representation or an enumeration mechanism.
How ProTuner chooses successive scheduling decisions
The steps in order.
Build a tree through sampled completions
MCTS grows a search tree incrementally. A node corresponds to a partial schedule, and an edge corresponds to a scheduling action. Rather than evaluating the entire tree, the algorithm repeatedly selects a path worth investigating, expands the represented tree, and completes the remaining decisions through simulation.
Here, simulation means constructing a possible completed schedule. It does not necessarily mean executing the program. In the standard trees, the remaining actions are sampled randomly. Once a terminal schedule has been reached, the cost model supplies an estimated execution cost.
That result travels back through the ancestors visited during the search. Each ancestor updates its statistics. ProTuner retains an average cost, the best cost discovered through that node, and the completed schedule responsible for the best cost.
These records serve different purposes. The average describes the outcomes observed during exploration. The best result preserves a concrete successful discovery. Keeping the associated completed schedule makes it possible to compile that candidate later or use it to identify the next scheduling decision.
The predictor is trained on randomly generated, fully scheduled programs. The central alignment is therefore between the type of artifact used in training and the type evaluated after simulation. The authors do not claim that this makes prediction perfect. It removes one particular source of mismatch: asking a predictor trained on finished programs to assign execution costs to unfinished ones.
Select branches through upper confidence bounds
The standard MCTS background uses an upper confidence bound, or UCB, to combine evidence of good outcomes with an incentive to investigate less-visited branches. The paper gives the following expression:
UCB = X̄ⱼ + 2Cₚ√(2ln(n) / nⱼ)
UCB is the score used to select a child. X̄ⱼ is the mean reward observed in simulations through child j. The symbol n counts visits to the parent, while nⱼ counts visits to that child. The function ln is the natural logarithm. Cₚ is a positive constant controlling exploration.
The average-reward term favors branches that have done well. The other term grows in importance when a child has relatively little visitation. Increasing Cₚ gives exploration more influence; decreasing it makes the procedure rely more strongly on the observed outcomes.
This formula explains the basic search principle. ProTuner’s experiments also modify the selection expression because its implementation works with execution costs and because the authors want to study different amounts of exploration.
The main cost-based configuration combines reciprocal average cost with a multiplicative exploration factor:
Scoreⱼ = (1 / ((Σᵢ ExecTimeᵢ) / nⱼ)) × (1 + √(ln(n) / nⱼ))
Scoreⱼ is the selection score for child j. ExecTimeᵢ denotes a simulated execution-time cost included in that child’s accumulated outcomes, and Σᵢ means those costs are added across the relevant simulations. Dividing by nⱼ produces the average cost. Its reciprocal makes a smaller average cost yield a larger exploitation score. The remaining factor rewards exploration through the parent and child visit counts.
The configuration named mcts_Cp10_30s strengthens that exploration factor:
Scoreⱼ = (1 / ((Σᵢ ExecTimeᵢ) / nⱼ)) × (1 + 10√(ln(n) / nⱼ))
The symbols retain the same meanings. The coefficient 10 changes the influence of the exploration component relative to the main multiplicative setting. The authors compare this configuration with other formulas instead of presenting it as a universally preferable constant.
Their more exploratory additive configuration, mcts_sqrt2_30s, uses:
Scoreⱼ = 1 / ((Σᵢ ExecTimeᵢ) / nⱼ) + √2√(2ln(n) / nⱼ)
Again, the reciprocal average cost provides the exploitation component, and the term based on visit counts supplies exploration. The paper associates this configuration with the original UCB form and uses Cₚ = 1/√2. It discusses that choice through earlier work on rewards in the range [0, 1].
These distinctions matter because a cost-based search does not become fully specified merely by saying that it uses UCB. The scale of costs, the transformation into reward, and whether exploration is added or multiplied affect behavior. The authors explicitly observe that the same exploration setting need not suit programs with different runtime scales.
Decide differently when it is time to commit
During exploration, ProTuner uses average outcomes. When its allowance for the current scheduling stage expires, it makes a permanent decision using the strongest completed outcome found.
The allowance can be expressed as an iteration limit or a timeout. At that point, the selected action becomes the next root of the search tree. Search then continues from the partial schedule produced by that action.
This is a crucial distinction. A branch with the best average sampled outcome is not necessarily the branch containing the best completed schedule discovered so far. The authors report that choosing the next root from the best cost works better than choosing it from the best average cost.
Their explanation is tied to finite search. Once a strong completed schedule exists, subsequent decisions can aim to improve on that known result. An average-based choice may favor a different branch whose typical sampled completion is attractive but whose best discovered executable is weaker.
The algorithm continues until the chosen next root is a terminal state. At that point the scheduling sequence is complete, and the retained finished schedule supplies the output.
Combine several search trees
ProTuner runs multiple MCTS instances on separate processor cores. The trees explore independently during the current stage and synchronize when selecting the next root.
Each returns its best completed schedule and a corresponding next-root proposal. The system compares these results, selects the winning proposal, and gives the same selected root to the trees for their next search interval.
This arrangement gives parallel workers a common commitment boundary without forcing their exploratory paths to match. It also makes the final decision depend on the strongest outcome discovered across the ensemble.
The final configuration combines 15 standard trees with one greedy tree. In a standard tree, completion after expansion proceeds through random actions. The greedy tree still uses the selection rule to reach an expansion point and introduces a random child there, but then uses the cost model to choose its completion greedily.
The distinction is deliberately localized. The greedy component contributes a quickly constructed candidate while the standard trees continue broader sampling. The authors’ experiments determine the mixture; they do not assume in advance that more greediness or more randomness is always preferable.
Add real measurements without measuring every simulation
The hybrid variant changes how the system chooses among the trees’ finalists. Rather than comparing only predicted costs, it compiles their completed schedules and measures the resulting programs.
The implementation uses forked child processes. Candidate applications are compiled through this measurement path, and the resulting benchmarks run serially. The authors choose serial execution to avoid candidates disturbing each other’s timing.
The winning measured schedule identifies the next root. Search still relies heavily on the cost model inside the trees, so this is not exhaustive measurement-based tuning. Direct execution enters when the algorithm is about to commit to a shared next decision.
The compilation wrapper also matters. The authors use Halide’s RunGen mechanism for a single scheduled function. When that wrapper cannot produce a usable application for particular benchmarks, they use application-specific wrappers from the Halide repository.
ResNet50 requires special treatment because the available measurement arrangement cannot independently run its simultaneously scheduled functions through a single forked child. Its reported MCTS result therefore uses cost-model guidance without the hybrid measurement procedure.
Experiments and results
Workloads, machine, and comparisons
The evaluation uses 16 applications drawn from the earlier beam-search work and available through Halide. They span matrix multiplication, blur operations, convolutions, interpolation, and a full ResNet50 implementation. The inclusion of ResNet50 connects the workload collection with the residual-network architecture cited through Deep Residual Learning for Image Recognition.
ProTuner is implemented in C++ on top of Halide. The experiments run on an AWS m5. The 8xlarge instance provides 128 GB of RAM and 100 GB of SSD storage, with 16 physical cores and an Intel Xeon Platinum 8259CL processor.
The authors note that instances sold under the same designation can contain different processors. They therefore keep their measurements on the same instance. They also use the same time of day, conduct runs during local nighttime, and disable hyperthreading to reduce variation.
The MCTS ensemble contains 16 trees. For the direct beam-search comparison, the authors also run 16 beam searches concurrently. Their baseline uses the released Halide implementation and artifacts associated with the earlier work, with beam size 32 and five passes.
Additional comparisons include greedy search with beam size 1, Halide’s default scheduler, and random search. Random search does not consult the predictor: it searches for ten minutes and retains the executable with the best measured runtime.
The other algorithms use three seeds, and the reported result is the strongest schedule found for each algorithm. This makes the experiment an assessment of selected schedule quality across repeated searches. It should not be read as a report of the average quality of an arbitrary single run.
Predicted cost and actual runtime answer different questions
The paper separates two principal outcome measures. One is the smallest predicted cost discovered. The other is the shortest measured execution time.
For the cost comparison, each result is normalized to the best cost found by the compared algorithms on that benchmark. The ResNet50 cost is left out because its stages are scheduled separately with costs on different scales before being combined.
Every MCTS configuration improves the geometric mean of predicted costs over beam, greedy, and random search. This establishes that MCTS is effective at searching the objective represented by the predictor. It does not establish that every lower-cost candidate is a faster executable.
The configuration mcts_Cp10_30s obtains lower predicted costs than beam search on every benchmark in that comparison. Other configurations have exceptions. For mcts_30s, the predicted cost on iir_blur is 4.5% worse than beam search.
For mcts_10s, the exceptions are nl_means and iir_blur, where costs are 8.9% and 1.1% worse. The more exploratory mcts_sqrt2_30s also has exceptions on those applications, with costs 5.2% and 2.4% worse.
The hybrid variants are particularly informative. Their geometric mean of predicted cost is the weakest among the MCTS configurations, yet their execution performance is strongest overall. The schedules selected through measurement do not simply maximize the predictor’s preferences.
The authors describe the cost results as evidence of what would happen with a perfectly accurate predictor. That interpretation is conditional. The measured-runtime results show why the condition cannot be taken for granted in the actual system.
Execution speed improves across the tested configurations
The runtime comparison normalizes each application’s result to the fastest executable found by the compared methods. In geometric mean, all MCTS configurations outperform beam search, with advantages reported as 1.06×-1.36×.
The largest application-level improvement discussed in this comparison occurs on interpolate. Depending on the MCTS configuration, the gain over beam search is 1.8×-3.25×.
The hybrid configurations achieve the strongest geometric-mean execution performance even though they do not achieve the best predicted costs. This is the main empirical support for placing real measurements at the root-selection boundary.
The shorter hybrid setting, mcts_cost+real_1s, performs better than mcts_cost+real_30s. The authors connect this result to reduced overoptimization of the cost model. A shorter search interval reaches the measurement boundary sooner, limiting how long candidate selection can pursue errors in the predictor.
They highlight conv_layer as a clear example. It is the smallest benchmark in their collection. Both hybrid configurations beat the other MCTS variants there, but the shorter hybrid search is stronger.
The paper also finds similar geometric-mean performance among mcts_10s, mcts_30s, and mcts_sqrt2_30s. The shorter setting outperforms mcts_Cp10_30s on that aggregate runtime measure. The best configuration for searching predicted cost is therefore not automatically the best configuration for producing fast executables.
Tuning itself has a substantial cost
The paper measures total automatic scheduling time, including compilation of the search code, search, and compilation and benchmarking of the resulting applications. The following comparison concerns the cost-model-only configurations.
Average total auto-scheduling time across the benchmark suite
The shortest search interval has the lowest average tuning time.
The numbers
| System or setting | seconds |
|---|---|
| mcts_1s (this paper) | 31 |
| mcts_10s | 155 |
| mcts_30s | 422 |
These are costs of obtaining a schedule, rather than execution times of the optimized program. A faster tuner is useful when a program must be optimized quickly, but final schedule quality remains a separate outcome.
The dominant expense depends on application size. For small cases such as conv_layer and mat_mul, compilation and benchmarking account for much of the total. Larger cases spend more time in search.
Profiling reveals an implementation bottleneck that is easy to overlook. Generating child schedules consumes 88% of search time, while cost evaluation consumes 7.5%. During a standard random completion, only a single randomly selected child is needed, but the implementation generates the other children as well.
The authors identify a potential 8× search-time improvement from avoiding this waste. They present this as future potential, not a measured acceleration achieved by the implemented system.
Adding real measurement makes tuning more expensive. The reported average scheduling times are 23 minutes for mcts_cost+real_1s and 35 minutes for mcts_cost+real_30s. With the longer interval, most benchmarks take approximately 3× as long to schedule when direct execution is included.
Much of that additional time is spent compiling and benchmarking the candidate finalists. Serial measurement is intentional because reliable timing matters to the decision. The result illustrates a practical tension: the checks that make selection more trustworthy can dominate the time needed to obtain that selection.
A shared time allowance changes the comparison
The authors also compare autotuning procedures under a common allowance of 15 minutes per application. This includes search, compilation, and benchmark execution.
Each algorithm restarts with another seed while time remains, and its strongest discovered schedule supplies the final result. The experiment therefore asks what schedule quality can be obtained by the deadline, rather than what a single fixed search invocation produces.
The shorter MCTS settings are attractive here because they permit more repeated exploration and measurement. The paper compares mcts_1s with mcts_0.5s, whose root-selection interval is shorter still.
Geometric-mean execution speedup over beam search within the shared tuning budget
The shorter MCTS interval gives the stronger aggregate result.
The numbers
| System or setting | speedup × |
|---|---|
| mcts_1s | 1.29 |
| mcts_0.5s (this paper) | 1.35 |
The individual maximum improvement is up to 3× for mcts_1s and up to 3.43× for mcts_0.5s. These maxima describe particular application results, while the chart reports the geometric mean across the workload collection.
The fixed-budget experiment is important because unrestricted comparisons can hide different tuning expenses. Here, the stronger MCTS result is obtained within the same declared allowance as beam search.
The paper’s headline numbers are not entirely uniform. Its conclusion emphasizes up to 3.25×, while the fixed-budget section reports up to 3.43×. The contributions list also states up to 3.5× without supplying a separate matching explanation in the detailed results. The clearest reading is to retain the explicitly described experimental conditions rather than treat every headline as the same measurement.
What the ablations show
Better training data does not remove the partial-schedule problem
Before developing ProTuner, the authors test whether modifying predictor training can repair the beam-search weakness. Their first diagnostic trains on completed schedules from the benchmark programs that will subsequently be tuned.
This gives the predictor direct exposure to the application family used in the search. Some benchmarks improve, while others deteriorate. Overall performance remains similar.
The result weakens the explanation that beam search fails mainly because the predictor has never encountered these programs. Application-specific training does not remove the difficulty of scoring an unfinished schedule.
The other diagnostic trains a predictor to estimate the eventual cost associated with a partial schedule. This also fails to produce a convincing solution. The authors explain that a partial schedule has several possible continuations, so its eventual cost is not uniquely determined.
These comparisons do not prove that no predictor could ever evaluate partial schedules effectively. They show that the tested training changes do not solve the problem and motivate a search procedure that evaluates completed continuations instead.
Average outcomes are useful during search
The authors try guiding the search using the best cost found below a node rather than its average cost. That choice produces an unstable selection landscape.
A branch that happens to discover a strong completion early receives disproportionate attention. Other branches may be underexplored because they have not yet had the same opportunity to reveal a good result.
This is an important qualification to the apparent appeal of best-first behavior. The optimizer ultimately wants a strong individual schedule, but using the strongest individual discovery as its exploration statistic can make it prematurely greedy.
The authors therefore retain averages for deciding what to investigate. This does not discard exceptional results; those remain stored separately for the commitment stage.
Best outcomes are useful when choosing the next root
At the point of commitment, the preferred statistic reverses. The authors report a 25% advantage from choosing the next root through the best discovered cost rather than the best average cost.
The explanation is operational. The system already possesses a completed candidate with that cost. Choosing its associated branch preserves the possibility represented by a known strong artifact.
An average is evidence about sampled outcomes, but it is not itself an executable schedule. Under limited search, a branch with a favorable mean can still fail to improve on the strongest completed schedule already available elsewhere.
Together, these comparisons support a division of labor between statistics. They do not show that averages or best values are universally superior. Their value depends on the decision being made.
Adding greediness is sensitive to where it enters
The authors test a simulation policy that sometimes chooses the apparently best next action rather than sampling randomly. This mixed policy does not improve over random simulation.
They also test a binary reward scheme. A subsequent root receives 1 when it improves on its parent’s cost and 0 otherwise. The intended benefits are a normalized scale and pressure to keep improving over earlier discoveries.
That formulation performs 9% worse. The experiment shows that simplifying rewards can change search behavior in an unhelpful way, even when the transformation has an intuitive justification.
The successful use of greediness is more structured: combine standard trees with a tree that completes its simulations greedily. The ensemble preserves distinct search roles instead of blending every completion into the same compromise policy.
The best ensemble mixture depends on the application
The mixture experiment uses four applications and keeps the total number of trees at 16. It varies how many trees use standard random completion and how many use greedy completion.
Bilateral_grid and nl_means benefit from including greedy search. Iir_blur and max_filter benefit more from standard MCTS behavior. The final mixture of 15 standard trees and one greedy tree gives the strongest overall balance in this comparison.
The authors also examine which type of tree supplies the selected decisions. Adding greedy trees does not substantially increase their decision contribution on nl_means. On bilateral_grid, more greedy trees can increase that contribution slightly without improving performance, because they often discover similar best states.
On the applications that favor standard trees, increasing the greedy component can make performance worse. This analysis shows why contribution counts and final quality should both be examined. Winning more local selections is not automatically evidence that a search role improves the overall result.
Stronger exploration and longer search are not universally better
The alternative UCB formulas change how much attention goes to less-visited branches. Their outcomes vary by benchmark and by whether predicted cost or measured execution time is considered.
The more exploratory configurations can be strong at minimizing cost-model output. Yet the execution-time comparison does not identify the most exploratory setting as uniformly best.
Likewise, extending the search interval can provide more opportunities to optimize the predicted objective while increasing the chance of exploiting prediction error. The shorter hybrid configuration’s stronger runtime results are evidence of that tension.
These are controlled configuration comparisons instead of a complete causal decomposition. Several algorithmic choices interact, and the application collection is finite. The most defensible conclusion is that exploration strength, completion policy, and measurement frequency should be evaluated together against actual execution performance.
Limitations
Limits the authors explicitly identify
The cost model remains imperfect. ProTuner changes when it is queried and can supplement it with measurement, but it does not make predicted runtime identical to actual runtime.
The authors explicitly observe overoptimization of the predictor. Longer search can find schedules that look increasingly attractive to the model without producing correspondingly faster execution. This limits the assumption that additional search time is always beneficial.
Configuration also matters. Different applications favor different balances of greedy and random behavior. The authors suggest adapting Cₚ to the program because cost scales differ, and they consider reducing exploration deeper in the tree. Those adaptations are future work rather than demonstrated components.
The implementation wastes time during random completion by enumerating child schedules that are not used. The proposed improvement in generation efficiency has not been implemented in the reported results. The estimated opportunity must therefore remain separate from observed performance.
The search space itself is restricted. The authors plan to admit vector sizes beyond the native vector width and to relax the requirement that multicore parallelism appear at the outermost loop level. Accordingly, an optimal result within the implemented search space would not establish optimality among every functionally equivalent implementation.
Hardware coverage is also limited. The experiments use the stated CPU instance, and the authors identify additional hardware targets as future work. The paper’s motivation includes diverse architectures, but its measurements do not establish performance across that diversity.
Real execution measurements have practical coverage limits. The standard wrapper fails for some applications, requiring custom alternatives. ResNet50 cannot use the same hybrid measurement arrangement and is reported through cost-model-only MCTS.
Limits visible in the experimental design
The strongest theoretical statements concern sufficient exploration, whereas the experiments use finite budgets. A convergence argument does not show that a particular timeout discovers the globally fastest schedule.
There are also distinct objectives. An MCTS procedure guided entirely by predicted costs searches for what the predictor considers good. Even exhaustive success on that objective would not prove minimum real execution time when the predictor can be wrong.
The evaluation contains a useful range of applications, but it remains a specific workload suite. It does not establish that the same mixture of trees or timeout settings will work equally well for every program, language, or compiler representation.
Reporting the best schedule across three seeds is appropriate for a tuning procedure that can repeat searches. It does not describe the variability a user should expect from one run. The paper does not accompany the headline performance comparisons with uncertainty intervals or a detailed account of the full distribution across seeds.
The geometric mean summarizes performance across applications, while the per-application exceptions show that improvements are not uniform. A favorable aggregate should not be turned into a claim that every MCTS configuration beats beam search on every individual case.
The final performance metric is runtime. The experiments do not establish improvements in memory consumption, energy use, or other possible implementation objectives. Nor do they demonstrate that the scheduling method improves the semantic accuracy of an application; the task is to organize an existing computation more efficiently.
What transfers beyond compilation remains a hypothesis
The paper offers a persuasive structural argument about partial artifacts and completed outcomes. Applying it elsewhere still requires a well-defined completion procedure, a useful terminal objective, and legal actions.
In language analysis or reasoning, reaching a terminal representation does not automatically mean that its meaning is correct. A completed but mistaken interpretation could receive a favorable internal score. The value of completion-based search therefore depends on how final candidates are checked.
The proposed Mova connections inherit that requirement. ProTuner supplies evidence about scheduling search, not experimental evidence that MCTS improves dependency analysis, dictionary construction, or native task understanding. Such transfers would need their own controlled comparisons and limits.
What came after
No documented later study is available here to establish how subsequent researchers extended or evaluated ProTuner. It would therefore be premature to assign it a specific chain of successful successors. The paper does, however, lay out several clear research directions, and those directions help distinguish the contribution it demonstrates from the work it leaves open.
One proposed direction replaces some simulations with a learned value function. Instead of repeatedly completing a schedule to discover the consequence of an action, a predictor could estimate the advantage of that action directly. This could reduce search expense, but it would also bring prediction quality back into the intermediate decision process that motivates ProTuner’s criticism of beam search. The proposal would need to show that its value estimates are useful for the decisions actually made.
Another direction uses deep reinforcement learning to solve the scheduling MDP. The authors suggest that a policy capable of generalizing could avoid searching from the beginning for every program. This is a proposed transfer from the cited compiler-optimization literature, not a capability demonstrated by ProTuner.
The paper also calls for cost models that represent target hardware and program features more accurately. Its experiments show why this matters: search can discover weaknesses in its predictor, and measurement can reverse the ranking suggested by estimated cost. Improving the predictor and improving the search are therefore complementary possibilities.
A more immediate engineering direction is efficient random-child generation. The profiling results indicate that candidate enumeration, rather than prediction alone, dominates the implemented search. Removing unnecessary construction could make the same search policy more practical without changing its basic decision logic.
The authors additionally propose broader scheduling spaces, adaptive exploration settings, and experiments on more hardware. Each addresses a different boundary: what implementations can be represented, how exploration is allocated, and where the resulting schedules remain effective.
ProTuner’s demonstrated contribution is narrower and more concrete than these possibilities. In the tested Halide setting, completing sampled schedules before evaluating them provides a useful alternative to repeatedly ranking unfinished programs. Its experiments also show why a successful optimizer needs more than an effective tree policy: it must account for prediction error, measurement expense, candidate-generation overhead, and the budget within which a usable result must be found.
Cite
Cite as Ameer Haj-Ali, Hasan Genc, Qijing Huang, William S. Moses, John Wawrzynek, Krste Asanović and Ion Gabriel Stoica. 2020. ProTuner: Tuning Programs with Monte Carlo Tree Search. arXiv (Cornell University).
@misc{hajali2020protuner,
title = {{ProTuner: Tuning Programs with Monte Carlo Tree Search}},
author = {Ameer Haj-Ali, Hasan Genc, Qijing Huang, William S. Moses, John Wawrzynek, Krste Asanović and Ion Gabriel Stoica},
year = {2020},
doi = {10.48550/arxiv.2005.13685},
eprint = {2005.13685},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.2005.13685}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/ali-2020-protuner-tuning-programs-monte-carlo/