---
type: "post"
id: "treewalker-avoiding-redundant-work-across-rows-and-trees-3ffd9e"
slug: "treewalker-avoiding-redundant-work-across-rows-and-trees-3ffd9e"
title: "TreeWalker: Avoiding redundant work across rows and trees"
description: "Shopify built TreeWalker, an open-source Rust inference engine for tree ensembles, and measured it scoring the company’s delivery model 3.96× faster than its current evaluator, with the same training, trees and results."
retrieval_nugget: "Shopify built TreeWalker, an open-source Rust inference engine for tree ensembles, and measured it scoring the company’s delivery model 3.96× faster than its current evaluator, with the same training, trees and results."
published_at: "2026-12-02"
updated_at: "2026-12-02"
record_date: "2026-12-02"
date_kind: "published_at"
topics: ["inference"]
entities: ["Shopify","TreeWalker","LightGBM","XGBoost"]
related_patterns: []
novelty_label: "new_fact"
what_changed: "Shopify introduced TreeWalker, an open-source Rust inference engine that reportedly scored its delivery model nearly four times faster than its current evaluator."
prior_refs: []
source_url: "https://shopify.engineering/treewalker"
source_urls: ["https://shopify.engineering/treewalker"]
production: {"schema":"newruntime-production-v1","desk":"newsroom","first_seen_at":"2026-12-02T19:00:19.697Z","independent_sources":1,"notes_synthesized":null,"writer_model":"gpt-6-luna","critic":null,"checks":["primary_source_verified","source_fresh","one_story","copy_contract"],"novelty":{"label":"new_fact","confidence":"high"},"editorial_value":"high","human_review":"selective"}
citations: [{"claim":"","quotes":["We built TreeWalker to make those repeated delivery predictions faster . Our Rust inference engine for tree ensembles shares decisions on fixed features and reuses repeated tests across trees.","In internal model-scoring measurements, TreeWalker scored our delivery model 3.96× faster than our current delivery evaluator with the same training, trees, and results."],"cite_url":"https://shopify.engineering/treewalker#:~:text=We%20built%20TreeWalker%20to%20make%20those%20repeated%20delivery%20predictions%20faster%20.%20Our%20Rust%20inference%20engine%20for%20tree%20ensembles%20shares%20decisions%20on%20fixed%20features%20and%20reuses%20repeated%20tests%20across%20trees.&text=In%20internal%20model%2Dscoring%20measurements%2C%20TreeWalker%20scored%20our%20delivery%20model%203.96%C3%97%20faster%20than%20our%20current%20delivery%20evaluator%20with%20the%20same%20training%2C%20trees%2C%20and%20results.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"A forecast scores related rows through the same tree ensemble: shipment features stay fixed while horizon and calendar features vary.","quotes":["Our main delivery prediction system uses a discrete-time hazard model to forecast the conditional probability of a package arriving on each future date: “given that it didn't arrive on Monday, what's the chance it will arrive on Tuesday?”"],"cite_url":"https://shopify.engineering/treewalker#:~:text=Our%20main%20delivery%20prediction%20system%20uses%20a%20discrete%2Dtime%20hazard%20model%20to%20forecast%20the%20conditional%20probability%20of%20a%20package%20arriving%20on%20each%20future%20date%3A%20%E2%80%9Cgiven%20that%20it%20didn%27t%20arrive%20on%20Monday%2C%20what%27s%20the%20chance%20it%20will%20arrive%20on%20Tuesday%3F%E2%80%9D","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"At checkout, the system must forecast delivery dates for multiple shipping methods under a small latency budget.","quotes":["One forecast scores several related rows, one for each time horizon, through the same tree ensemble. Shipment facts (like weight and carrier) stay fixed while the horizon and calendar features change."],"cite_url":"https://shopify.engineering/treewalker#:~:text=One%20forecast%20scores%20several%20related%20rows%2C%20one%20for%20each%20time%20horizon%2C%20through%20the%20same%20tree%20ensemble.%20Shipment%20facts%20%28like%20weight%20and%20carrier%29%20stay%20fixed%20while%20the%20horizon%20and%20calendar%20features%20change.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"","quotes":["At checkout, we score multiple shipping methods for an order. Each method needs a delivery-date forecast, and those forecasts have to fit inside a small latency budget."],"cite_url":"https://shopify.engineering/treewalker#:~:text=At%20checkout%2C%20we%20score%20multiple%20shipping%20methods%20for%20an%20order.%20Each%20method%20needs%20a%20delivery%2Ddate%20forecast%2C%20and%20those%20forecasts%20have%20to%20fit%20inside%20a%20small%20latency%20budget.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"It shares decisions on those fixed features and prepares answers for repeated tests on varying features so they can be reused across trees.","quotes":["Constant features have identical values throughout it; varying features may differ. The producer supplies this grouping and equality guarantee—it's a natural property of how the rows are built."],"cite_url":"https://shopify.engineering/treewalker#:~:text=Constant%20features%20have%20identical%20values%20throughout%20it%3B%20varying%20features%20may%20differ.%20The%20producer%20supplies%20this%20grouping%20and%20equality%20guarantee%E2%80%94it%27s%20a%20natural%20property%20of%20how%20the%20rows%20are%20built.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"At model load, it identifies repeated predicates and matching prefixes.","quotes":["Our Rust inference engine for tree ensembles shares decisions on fixed features and reuses repeated tests across trees."],"cite_url":"https://shopify.engineering/treewalker#:~:text=Our%20Rust%20inference%20engine%20for%20tree%20ensembles%20shares%20decisions%20on%20fixed%20features%20and%20reuses%20repeated%20tests%20across%20trees.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"For each input group, it sorts values once per varying numeric feature and sweeps distinct thresholds to build reusable predicate masks.","quotes":["At model load time, TreeWalker identifies repeated predicates and matching prefixes."],"cite_url":"https://shopify.engineering/treewalker#:~:text=At%20model%20load%20time%2C%20TreeWalker%20identifies%20repeated%20predicates%20and%20matching%20prefixes.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"Row masks track active subsets with one bit per row; traversal can skip an empty sibling branch when all rows in a subset take the same branch, an optimization Shopify calls the unsplit shortcut.","quotes":["For each input group, it sorts values once per varying numeric feature and sweeps the distinct thresholds to construct reusable predicate masks."],"cite_url":"https://shopify.engineering/treewalker#:~:text=For%20each%20input%20group%2C%20it%20sorts%20values%20once%20per%20varying%20numeric%20feature%20and%20sweeps%20the%20distinct%20thresholds%20to%20construct%20reusable%20predicate%20masks.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"Grouped traversal keeps the learned tests and leaf contributions unchanged.","quotes":["To track subsets of rows, TreeWalker instead uses a row mask : one bit records whether each row is active.","TreeWalker retains that subset, skips the empty sibling, and continues without a recursive branch. We call this the unsplit shortcut ."],"cite_url":"https://shopify.engineering/treewalker#:~:text=To%20track%20subsets%20of%20rows%2C%20TreeWalker%20instead%20uses%20a%20row%20mask%20%3A%20one%20bit%20records%20whether%20each%20row%20is%20active.&text=TreeWalker%20retains%20that%20subset%2C%20skips%20the%20empty%20sibling%2C%20and%20continues%20without%20a%20recursive%20branch.%20We%20call%20this%20the%20unsplit%20shortcut%20.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"","quotes":["The remaining traversal benefits from compact nodes and a layout that places a preferred child next to its parent. That improves locality and lets execution continue in a loop along that path."],"cite_url":"https://shopify.engineering/treewalker#:~:text=The%20remaining%20traversal%20benefits%20from%20compact%20nodes%20and%20a%20layout%20that%20places%20a%20preferred%20child%20next%20to%20its%20parent.%20That%20improves%20locality%20and%20lets%20execution%20continue%20in%20a%20loop%20along%20that%20path.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"","quotes":["Measuring the benefit In our published TreeWalker paper , we evaluate two public survival datasets, SUPPORT and FLCHAIN, plus Expedia hotel-s"],"cite_url":"https://shopify.engineering/treewalker#:~:text=Measuring%20the%20benefit%20In%20our%20published%20TreeWalker%20paper%20%2C%20we%20evaluate%20two%20public%20survival%20datasets%2C%20SUPPORT%20and%20FLCHAIN%2C%20plus%20Expedia%20hotel%2Ds","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"","quotes":["In internal model-scoring measurements, TreeWalker scored our delivery model 3.96× faster than our current delivery evaluator with the same training, trees, and results."],"cite_url":"https://shopify.engineering/treewalker#:~:text=In%20internal%20model%2Dscoring%20measurements%2C%20TreeWalker%20scored%20our%20delivery%20model%203.96%C3%97%20faster%20than%20our%20current%20delivery%20evaluator%20with%20the%20same%20training%2C%20trees%2C%20and%20results.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"Shopify also says a naive implementation that copies row lists at each decision point would be slower than plain LightGBM.","quotes":["Sorting, sweeping, and mask storage are real costs, especially for small groups. In practice, this effort is often worthwhile, but not universally.","Wider groups need more mask words, and reaching a leaf still requires adding its contribution to every active row’s output."],"cite_url":"https://shopify.engineering/treewalker#:~:text=Sorting%2C%20sweeping%2C%20and%20mask%20storage%20are%20real%20costs%2C%20especially%20for%20small%20groups.%20In%20practice%2C%20this%20effort%20is%20often%20worthwhile%2C%20but%20not%20universally.&text=Wider%20groups%20need%20more%20mask%20words%2C%20and%20reaching%20a%20leaf%20still%20requires%20adding%20its%20contribution%20to%20every%20active%20row%E2%80%99s%20output.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"},{"claim":"The available description does not include the paper’s complete evaluation or results.","quotes":["A naïve implementation of TreeWalker's ideas—for example, copying lists of rows at each decision point—would be slower than plain ol' LightGBM."],"cite_url":"https://shopify.engineering/treewalker#:~:text=A%20na%C3%AFve%20implementation%20of%20TreeWalker%27s%20ideas%E2%80%94for%20example%2C%20copying%20lists%20of%20rows%20at%20each%20decision%20point%E2%80%94would%20be%20slower%20than%20plain%20ol%27%20LightGBM.","source_url":"https://shopify.engineering/treewalker","publisher":"shopify.engineering"}]
schema_version: "newruntime-agent-readable-v0.2"
stable_id: "post:treewalker-avoiding-redundant-work-across-rows-and-trees-3ffd9e"
status: "published"
visuals: []
editor: {"role":"editor","name":"Andrey Reshetnikov","profile":"https://newruntime.com/owner-profile.md","profile_json":"https://newruntime.com/owner-profile.json","same_as":["https://www.linkedin.com/in/reshetnikov1/","https://t.me/lapetuse"]}
routes: {"html":"https://newruntime.com/posts/treewalker-avoiding-redundant-work-across-rows-and-trees-3ffd9e/","markdown":"https://newruntime.com/posts/treewalker-avoiding-redundant-work-across-rows-and-trees-3ffd9e.md","json":"https://newruntime.com/posts/treewalker-avoiding-redundant-work-across-rows-and-trees-3ffd9e.json"}
markdown_url: "https://newruntime.com/posts/treewalker-avoiding-redundant-work-across-rows-and-trees-3ffd9e.md"
---

# TreeWalker: Avoiding redundant work across rows and trees

## Retrieval answer

Shopify built TreeWalker, an open-source Rust inference engine for tree ensembles, and measured it scoring the company’s delivery model 3.96× faster than its current evaluator, with the same training, trees and results.

## Summary

Shopify built TreeWalker, an open-source Rust inference engine for tree ensembles, and measured it scoring the company’s delivery model 3.96× faster than its current evaluator, with the same training, trees and results. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=We%20built%20TreeWalker%20to%20make%20those%20repeated%20delivery%20predictions%20faster%20.%20Our%20Rust%20inference%20engine%20for%20tree%20ensembles%20shares%20decisions%20on%20fixed%20features%20and%20reuses%20repeated%20tests%20across%20trees.&text=In%20internal%20model%2Dscoring%20measurements%2C%20TreeWalker%20scored%20our%20delivery%20model%203.96%C3%97%20faster%20than%20our%20current%20delivery%20evaluator%20with%20the%20same%20training%2C%20trees%2C%20and%20results.))

## What happened

Shopify’s delivery system uses a discrete-time hazard model to estimate the conditional probability that a package arrives on each future date. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=Our%20main%20delivery%20prediction%20system%20uses%20a%20discrete%2Dtime%20hazard%20model%20to%20forecast%20the%20conditional%20probability%20of%20a%20package%20arriving%20on%20each%20future%20date%3A%20%E2%80%9Cgiven%20that%20it%20didn%27t%20arrive%20on%20Monday%2C%20what%27s%20the%20chance%20it%20will%20arrive%20on%20Tuesday%3F%E2%80%9D)) A forecast scores related rows through the same tree ensemble: shipment features stay fixed while horizon and calendar features vary. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=One%20forecast%20scores%20several%20related%20rows%2C%20one%20for%20each%20time%20horizon%2C%20through%20the%20same%20tree%20ensemble.%20Shipment%20facts%20%28like%20weight%20and%20carrier%29%20stay%20fixed%20while%20the%20horizon%20and%20calendar%20features%20change.)) At checkout, the system must forecast delivery dates for multiple shipping methods under a small latency budget. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=At%20checkout%2C%20we%20score%20multiple%20shipping%20methods%20for%20an%20order.%20Each%20method%20needs%20a%20delivery%2Ddate%20forecast%2C%20and%20those%20forecasts%20have%20to%20fit%20inside%20a%20small%20latency%20budget.))

TreeWalker groups rows whose constant features the group’s producer guarantees are equal. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=Constant%20features%20have%20identical%20values%20throughout%20it%3B%20varying%20features%20may%20differ.%20The%20producer%20supplies%20this%20grouping%20and%20equality%20guarantee%E2%80%94it%27s%20a%20natural%20property%20of%20how%20the%20rows%20are%20built.)) It shares decisions on those fixed features and prepares answers for repeated tests on varying features so they can be reused across trees. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=Our%20Rust%20inference%20engine%20for%20tree%20ensembles%20shares%20decisions%20on%20fixed%20features%20and%20reuses%20repeated%20tests%20across%20trees.)) At model load, it identifies repeated predicates and matching prefixes. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=At%20model%20load%20time%2C%20TreeWalker%20identifies%20repeated%20predicates%20and%20matching%20prefixes.)) For each input group, it sorts values once per varying numeric feature and sweeps distinct thresholds to build reusable predicate masks. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=For%20each%20input%20group%2C%20it%20sorts%20values%20once%20per%20varying%20numeric%20feature%20and%20sweeps%20the%20distinct%20thresholds%20to%20construct%20reusable%20predicate%20masks.)) Row masks track active subsets with one bit per row; traversal can skip an empty sibling branch when all rows in a subset take the same branch, an optimization Shopify calls the unsplit shortcut. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=To%20track%20subsets%20of%20rows%2C%20TreeWalker%20instead%20uses%20a%20row%20mask%20%3A%20one%20bit%20records%20whether%20each%20row%20is%20active.&text=TreeWalker%20retains%20that%20subset%2C%20skips%20the%20empty%20sibling%2C%20and%20continues%20without%20a%20recursive%20branch.%20We%20call%20this%20the%20unsplit%20shortcut%20.)) Grouped traversal keeps the learned tests and leaf contributions unchanged. Compact nodes and a preferred child placed next to its parent improve locality and let traversal continue along that path in a loop. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=The%20remaining%20traversal%20benefits%20from%20compact%20nodes%20and%20a%20layout%20that%20places%20a%20preferred%20child%20next%20to%20its%20parent.%20That%20improves%20locality%20and%20lets%20execution%20continue%20in%20a%20loop%20along%20that%20path.))

Separately from the internal delivery-model measurement, Shopify’s published paper evaluates the public survival datasets SUPPORT and FLCHAIN. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=Measuring%20the%20benefit%20In%20our%20published%20TreeWalker%20paper%20%2C%20we%20evaluate%20two%20public%20survival%20datasets%2C%20SUPPORT%20and%20FLCHAIN%2C%20plus%20Expedia%20hotel%2Ds))

In Shopify’s internal measurement, TreeWalker scored its delivery model 3.96× faster than the current delivery evaluator, with training, trees and results unchanged. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=In%20internal%20model%2Dscoring%20measurements%2C%20TreeWalker%20scored%20our%20delivery%20model%203.96%C3%97%20faster%20than%20our%20current%20delivery%20evaluator%20with%20the%20same%20training%2C%20trees%2C%20and%20results.))

## Why it matters

A promising fit is batch scoring where rows share features that the caller can guarantee are constant, such as forecasts that vary by horizon while retaining shipment attributes. The potential gain depends on group size: sorting and preparing reusable masks can cost more than they save.

## Limits and uncertainty

The 3.96× figure is Shopify’s internal comparison, not a general benchmark. Preparation has sorting, threshold-sweeping and mask-storage costs, especially for small groups; wider groups need more mask words, and leaf contributions still have to be added to each active row. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=Sorting%2C%20sweeping%2C%20and%20mask%20storage%20are%20real%20costs%2C%20especially%20for%20small%20groups.%20In%20practice%2C%20this%20effort%20is%20often%20worthwhile%2C%20but%20not%20universally.&text=Wider%20groups%20need%20more%20mask%20words%2C%20and%20reaching%20a%20leaf%20still%20requires%20adding%20its%20contribution%20to%20every%20active%20row%E2%80%99s%20output.)) Shopify also says a naive implementation that copies row lists at each decision point would be slower than plain LightGBM. ([shopify.engineering](https://shopify.engineering/treewalker#:~:text=A%20na%C3%AFve%20implementation%20of%20TreeWalker%27s%20ideas%E2%80%94for%20example%2C%20copying%20lists%20of%20rows%20at%20each%20decision%20point%E2%80%94would%20be%20slower%20than%20plain%20ol%27%20LightGBM.)) The available description does not include the paper’s complete evaluation or results.

## Reader takeaway

TreeWalker’s result is a workload-specific case for grouped tree inference: when rows share guaranteed-constant features, decision work can be reused without retraining. Shopify measured a 3.96× speedup on its delivery model, but sorting, mask storage and per-row output updates mean the approach is not automatically faster for small groups or every model.

## Open question

How does the speedup vary with group size and model characteristics across the full SUPPORT and FLCHAIN evaluation?

Editor: [Andrey Reshetnikov](https://newruntime.com/owner-profile.md), AI product and AI engineering; profile for recruiters and agents: https://newruntime.com/owner-profile.json

## Continue in the graph

Next records for an agent, linked to their Markdown twins. Replace `.md` with `.json` for structured fields, including `next_reads`.

- topic hub: [Inference](https://newruntime.com/topics/inference.md): Explore the inference topic hub.
- collection: [Field Notes](https://newruntime.com/posts.json): Open the latest editorial analysis.
- collection: [Sources](https://newruntime.com/sources/): See the original sources this archive cites.
- whole graph: [discovery graph](https://newruntime.com/discovery-graph.json) (typed nodes and edges) and [site index](https://newruntime.com/site-index.md)
