ReadingResearchRadarInvestment framework
Sign in / Sign up
← Back to reading
NewsTopic · TreeWalkerMaterial2 min readDisconfirmAI Editorial

TreeWalker: How Partial Evaluation Speeds Up Grouped Tree-Ensemble Inference

Shopify engineers describe TreeWalker, an open-source Rust engine that applies partial evaluation to tree-ensemble scoring: it resolves shared-feature decisions once per group of related rows using bit-vector masks, achieving 3.96× faster delivery-model evaluation in internal tests and up to 9.1× on public survival datasets at 128-row groups, while acknowledging that setup costs can outweigh savings in small or highly varied groups.

2026-12-02 22:22 GMT+8

When a tree ensemble scores multiple related rows—say, twelve candidate delivery dates for the same package—most of the decisions are identical across those rows. The carrier, weight, and destination do not change; only the horizon and calendar features vary. Yet conventional inference walks every tree independently for every row, repeating the same comparisons hundreds of times.

Shopify engineers Richard Newman and Durmus Karatay built TreeWalker to exploit this redundancy. Their open-source Rust engine applies partial evaluation to grouped tree-ensemble inference: it identifies features that are constant across a group of rows, resolves the matching tree decisions once, and reuses those results for every row in the group. For features that do vary, it precomputes predicate masks by sorting values once per feature and sweeping distinct thresholds, so that a question repeated across hundreds of trees reuses the same prepared answer.

The mechanism relies on a row mask—a bit vector recording which rows remain active at each node. When a split divides the group, TreeWalker intersects the active mask with the prepared predicate mask to select matching rows, and the remaining rows take the other branch. Original row positions stay intact, so each row retains its own running total. When all rows in a subset answer the same way at a node, TreeWalker skips the empty sibling and continues without a recursive call—an optimization the authors call the unsplit shortcut.

Sign in / Sign up
ReadingResearchRadarInvestment framework

In internal model-scoring measurements, TreeWalker scored Shopify's delivery prediction model 3.96× faster than their current evaluator, with identical training, trees, and results. On public survival datasets SUPPORT and FLCHAIN, grouped execution showed speedups of 7.7–9.1× at 104–128 rows compared to TreeWalker's own independent-row full walk. A second workload varying more inputs on UCI credit records showed speedups declining from 15.2× to 8.1× on Intel as perturbation dimensions increased from one to eight, and from 9.2× to 6.2× on Arm.

The authors are candid about limits. Across a broader 712-configuration campaign, grouped traversal lost to its own full walk in 33 Intel and 78 Arm configurations, concentrated in small groups where sorting, sweeping, and mask storage costs outweigh the savings. Compiled engines like lleaves and TL2cgen also win in some subsets. The technique helps when a workload naturally produces groups of related predictions—delivery dates for one shipment, search results for one query, or what-if variants that hold most features fixed. It does not change training, does not help when rows share no structure, and cannot eliminate the per-row output writes that remain necessary.

Sources

  • shopify.engineeringShopify↗
Topic

TreeWalker

TreeWalker is an open-source Rust inference engine developed by Shopify engineers Durmus Karatay and Richard Newman to a…

3 steps1 piecesUpdated 2026-12-03 17:31

How it got here

  1. 2026-12-02Shopify engineers published a blog post detailing TreeWalker, an open-source Rust engine for tree-ensemble inference that uses partial evaluation to speed up grouped scoring.shopify.engineering ↗
  2. 2026-10-01The arXiv preprint 'TreeWalker: Partial Evaluation for Grouped Tree-Ensemble Inference' was released, providing theoretical proofs and empirical validation against baselines like LightGBM and XGBoost.arxiv.org ↗
  3. 2026-10-01The official GitHub repository for TreeWalker was made public, containing the library source, benchmark harness, and experiment scripts.github.com ↗

What is still unsettled

  • How does TreeWalker's performance scale on different hardware architectures beyond the tested Intel and Arm platforms?
  • What are the specific latency budgets in production environments where the setup overhead might negate the benefits for smaller group sizes?
Read the full topic →
Continue researching →