Accelerate Tree-Model Inference
Company: Jump Trading
Role: Software Engineer
Category: Machine Learning
Difficulty: hard
Interview Round: Technical Screen
# Accelerate Tree-Model Inference
You must reduce inference latency and raise throughput for a deployed boosted-tree model without changing its predictions. Explain where time is spent in tree traversal and how model layout, batching, parallelism, compilation, quantization, and hardware-aware execution could improve performance. Describe how you would prove that an optimization is correct and worthwhile.
### Constraints & Assumptions
- The existing model is an ensemble of decision trees.
- Prediction equivalence must be measured under an explicitly chosen numerical tolerance.
- Both single-request latency and batched throughput matter.
- The answer must separate algorithmic changes from hardware or implementation changes.
### Clarifying Questions to Ask
- What are the tree count, depths, feature types, and current batch sizes?
- Is the bottleneck branch prediction, memory bandwidth, preprocessing, or thread scheduling?
- May the model representation change if predictions remain equivalent?
```hint Follow the memory
Tree nodes reached by one prediction are often scattered; layout can matter as much as arithmetic.
```
```hint Benchmark distributions
A speedup on one synthetic row may disappear for real depths, sparsity, and batches.
```
### What a Strong Answer Covers
- A profiling-first plan and a hypothesis for the dominant bottleneck.
- Concrete layout and execution optimizations tied to CPU or accelerator behavior.
- A benchmark matrix covering warm and cold latency, batch size, throughput, and tail latency.
- Prediction-diff, fallback, and rollout safeguards.
### Follow-up Questions
- When can branchless traversal outperform ordinary branching, and when can it do more work?
- How would you detect that preprocessing now dominates after speeding up the model itself?
Quick Answer: You must reduce inference latency and raise throughput for a deployed boosted-tree model without changing its predictions. Cover data and labels, leakage-safe features, baselines and model choice, offline evaluation, deployment constraints, monitoring, and drift.