Benchmarks¶
The benchmarks compare forest-stream with grf (R, 2.6.1), ranger (R, 0.18.0), EconML (0.17.1), scikit-learn (1.9.1) and quantile-forest (1.5.0) on simulated data, from 10,000 to 10 million rows. Each model is fitted by the libraries that have it:
Model |
What is fitted |
Compared with |
|---|---|---|
Causal forest |
The effect of a treatment assigned by a coin whose odds depend on a feature, from five features; 2,000 trees |
grf, EconML ( |
Causal forest with a fixed effect |
The same, with groups of about 25 rows whose effects shift both the treatment and the outcome; 2,000 trees |
grf and EconML, given the data with each group’s means removed |
Instrumental forest |
The local effect of a treatment that an instrument moves; 2,000 trees |
grf, EconML ( |
Regression forest |
The conditional mean; 500 trees |
grf, ranger, scikit-learn |
Quantile forest |
The conditional 0.1, 0.5 and 0.9 quantiles; 500 trees |
grf, ranger, quantile-forest |
The data are simulated with a known answer: the true effect, mean or quantiles at every
row (the designs are in benchmarks/_data.py). Every library starts from a Parquet file of
the n rows. Each fit is followed by the out-of-bag estimates at every row, with their
variances where the library gives them, and the time is of the reading, the fit and those
estimates. The quantile forests are scored on a fixed set of 50,000 test rows instead, since
not every library gives out-of-bag quantiles. Each configuration runs in its own process
with each library’s own centering of the outcome and treatment and a minimum leaf size of 5
where the library has one. EconML’s forests are honest, with max_samples of 0.45, and its
nuisance models are forests of 100 trees with leaves of at least 5 rows; scikit-learn’s forest is
fitted with leaves of at least 5 rows. The memory is the process’s peak resident memory. A fit
that runs past 30 minutes is “over 30 minutes”, and a configuration that fails, runs out of
memory or runs past 30 minutes is not run at larger sizes. The time leaves out the one-time
compilation of forest-stream’s kernels (a few seconds the first time a process fits), which
a warm-up fit before the timing absorbs. The scripts are in the repository’s benchmarks/
folder.
Machine¶
An AWS EC2 c8id.4xlarge: an Intel Xeon 6975P-C with 16 hardware threads on 8 cores, 32 GiB of memory (each process limited to 96% of it), and a local NVMe disk for the data and the fits’ files. The software: Python 3.13.5 with forest-stream 0.1.0, hdfe-stream 0.13.3, stream-limits 0.3.0, Polars 2.2.0, NumPy 2.5.5 and numba 0.68.1; R 4.5.3 with grf 2.6.1 and ranger 0.18.0; EconML 0.17.1, scikit-learn 1.9.1 and quantile-forest 1.5.0. Measured on November 29, 2026. Each table cell gives the time and the peak memory in GB (10^9 bytes).
Causal forest¶
forest-stream, grf (causal_forest, which fits its own nuisance forests) and EconML’s CausalForestDML.
Rows |
forest-stream |
grf (R) |
EconML |
|---|---|---|---|
10,000 |
1.72 s, 0.4 GB |
5.46 s, 1.3 GB |
9.56 s, 1.2 GB |
100,000 |
13.0 s, 0.5 GB |
66.5 s, 11.4 GB |
96.1 s, 8.1 GB |
1,000,000 |
200 s, 2.0 GB |
out of memory |
out of memory |
10,000,000 |
over 30 minutes |
not run |
not run |
The root mean squared error of the estimates against the true effect, and in parentheses the share of rows whose 95% interval holds the truth:
Rows |
forest-stream |
grf (R) |
EconML |
|---|---|---|---|
10,000 |
0.090 (95.9%) |
0.091 (95.8%) |
0.124 (93.4%) |
100,000 |
0.077 (96.8%) |
0.075 (97.0%) |
0.107 (94.5%) |
1,000,000 |
0.062 (98.6%) |
– |
– |
Causal forest with a fixed effect¶
forest-stream takes the fixed effect in the formula (y ~ w | x1 + ... | fe) and removes it by backfitting. grf and EconML have no fixed effects, so they are given the outcome and the treatment with each group’s mean removed.
Rows |
forest-stream |
grf (R) |
EconML |
|---|---|---|---|
10,000 |
2.61 s, 0.4 GB |
6.47 s, 1.3 GB |
7.76 s, 1.1 GB |
100,000 |
17.6 s, 0.7 GB |
77.3 s, 11.3 GB |
86.2 s, 8.0 GB |
1,000,000 |
258 s, 2.2 GB |
out of memory |
out of memory |
10,000,000 |
over 30 minutes |
not run |
not run |
The root mean squared error of the estimates against the true effect, and in parentheses the share of rows whose 95% interval holds the truth:
Rows |
forest-stream |
grf (R, groups removed) |
EconML (groups removed) |
|---|---|---|---|
10,000 |
0.113 (91.2%) |
0.116 (91.7%) |
0.146 (89.5%) |
100,000 |
0.080 (96.4%) |
0.076 (97.5%) |
0.110 (95.5%) |
1,000,000 |
0.065 (98.4%) |
– |
– |
Instrumental forest¶
The local effect of the treatment for the rows the instrument moves. forest-stream and grf (instrumental_forest) are honest instrumental forests; EconML’s ForestDRIV is a doubly robust instrumental-variable forest, a different estimator for the same quantity.
Rows |
forest-stream |
grf (R) |
EconML (ForestDRIV) |
|---|---|---|---|
10,000 |
1.54 s, 0.3 GB |
7.51 s, 1.5 GB |
37.4 s, 1.5 GB |
100,000 |
14.7 s, 0.5 GB |
86.8 s, 13.1 GB |
510 s, 11.7 GB |
1,000,000 |
222 s, 1.9 GB |
out of memory |
over 30 minutes |
10,000,000 |
over 30 minutes |
not run |
not run |
The root mean squared error of the estimates against the true effect, and in parentheses the share of rows whose 95% interval holds the truth:
Rows |
forest-stream |
grf (R) |
EconML (ForestDRIV) |
|---|---|---|---|
10,000 |
0.353 (87.2%) |
0.347 (86.9%) |
1.110 (93.2%) |
100,000 |
0.262 (94.6%) |
0.260 (95.0%) |
0.894 (92.1%) |
1,000,000 |
0.247 (97.9%) |
– |
– |
Regression forest¶
forest-stream and grf grow honest forests; ranger and scikit-learn grow forests of trees that are not honest, and their estimates are out-of-bag. The error is of the estimates against the true conditional mean.
Rows |
forest-stream |
grf (R) |
ranger (R) |
scikit-learn |
|---|---|---|---|---|
10,000 |
0.43 s, 0.3 GB |
1.97 s, 0.7 GB |
1.73 s, 0.6 GB |
1.64 s, 0.3 GB |
100,000 |
3.37 s, 0.5 GB |
15.4 s, 4.6 GB |
17.2 s, 3.9 GB |
21.2 s, 1.1 GB |
1,000,000 |
48.6 s, 2.6 GB |
out of memory |
out of memory |
338 s, 8.1 GB |
10,000,000 |
over 30 minutes |
not run |
not run |
out of memory |
The root mean squared error of the estimates against the true mean, and in parentheses the share of rows whose 95% interval holds the truth:
Rows |
forest-stream |
grf (R) |
ranger (R) |
scikit-learn |
|---|---|---|---|---|
10,000 |
0.118 (97.1%) |
0.116 (97.8%) |
0.214 |
0.204 |
100,000 |
0.084 (99.3%) |
0.081 (99.5%) |
0.185 |
0.174 |
1,000,000 |
0.074 (99.7%) |
– |
– |
0.158 |
Quantile forest¶
The estimates at the 0.1, 0.5 and 0.9 levels, from fixed test rows. forest-stream and grf grow honest forests from the generalized random forest splitting rule; ranger and quantile-forest follow Meinshausen’s (2006) quantile regression forests.
Rows |
forest-stream |
grf (R) |
ranger (R) |
quantile-forest |
|---|---|---|---|---|
10,000 |
1.22 s, 2.3 GB |
2.25 s, 0.7 GB |
10.2 s, 1.5 GB |
4.17 s, 0.9 GB |
100,000 |
4.53 s, 2.4 GB |
11.2 s, 2.9 GB |
38.1 s, 5.2 GB |
37.7 s, 2.6 GB |
1,000,000 |
45.0 s, 3.2 GB |
135 s, 26.0 GB |
out of memory |
484 s, 23.7 GB |
10,000,000 |
1,172 s, 20.3 GB |
out of memory |
not run |
out of memory |
The root mean squared error of the estimates against the true quantiles, over the three levels (these forests give no intervals):
Rows |
forest-stream |
grf (R) |
ranger (R) |
quantile-forest |
|---|---|---|---|---|
10,000 |
0.139 |
0.138 |
0.183 |
0.179 |
100,000 |
0.095 |
0.091 |
0.148 |
0.139 |
1,000,000 |
0.073 |
0.068 |
– |
0.123 |
Threads¶
The time to fit 500 trees at 1 million rows (the median of three fits, without the out-of-bag estimates) as the number of threads grows, on the same machine, with the speed-up over one thread and the peak memory:
Threads |
Causal forest |
Causal forest with a fixed effect |
Regression forest |
|---|---|---|---|
1 |
369 s (1.0×), 0.6 GB |
572 s (1.0×), 0.8 GB |
217 s (1.0×), 0.5 GB |
2 |
186 s (2.0×), 0.6 GB |
320 s (1.8×), 0.9 GB |
111 s (2.0×), 0.6 GB |
4 |
96 s (3.9×), 0.8 GB |
167 s (3.4×), 1.1 GB |
59 s (3.7×), 0.9 GB |
8 |
51 s (7.3×), 1.3 GB |
89 s (6.4×), 1.3 GB |
34 s (6.3×), 1.4 GB |
16 |
36 s (10.2×), 1.7 GB |
64 s (9.0×), 1.9 GB |
39 s (5.6×), 2.6 GB |
The speed-up is close to the thread count up to the 8 cores. The second hardware thread of each core helps the causal forests by about 40 percent (16 threads against 8: 51 to 36 seconds for the causal forest, 89 to 64 with a fixed effect) and does not help the regression forest (34 seconds at 8 threads, 39 at 16). More threads hold more trees’ samples at once, so the memory grows with them (0.5 to 2.6 GB for the regression forest). Setting Polars’ own thread count to 16 with 8 numba threads made no difference (50 seconds either way).
What the results show¶
At 100,000 rows, forest-stream fits the causal, fixed-effect and instrumental forests 4 to 6 times faster than grf (13 against 66 seconds for the causal forest) and 5 to 35 times faster than EconML (15 seconds against 510 for the instrumental forest), in 0.5 to 0.7 GB where grf takes 11 to 13 GB and EconML 8 to 12 GB. The regression forest takes 3.4 seconds, against 15 for grf, 17 for ranger and 21 for scikit-learn.
At 1 million rows, forest-stream finished every model, in 45 to 258 seconds and 1.9 to 3.2 GB. grf and EconML ran out of memory on the causal and fixed-effect forests; grf ran out of memory on the instrumental forest, and EconML ran past 30 minutes; grf and ranger ran out of memory on the regression forest, and scikit-learn took 338 seconds and 8.1 GB against forest-stream’s 49 seconds and 2.6 GB. On the quantile forest grf finished, in 135 seconds and 26 GB against forest-stream’s 45 seconds and 3.2 GB, quantile-forest in 484 seconds and 24 GB, and ranger ran out of memory.
At 10 million rows only the quantile forest finished, and only forest-stream: 1,172 seconds and 20 GB of memory, with 41 GB of files on disk; grf and quantile-forest ran out of memory. The other forest-stream fits ran past 30 minutes (the time grows a little faster than the rows: 13 seconds for the causal forest at 100,000 rows, 200 at 1 million). The disk is the price of the small memory: at 1 million rows a fit’s files take 4 to 7.5 GB.
Accuracy is the same as grf’s. Where both ran, forest-stream’s error is within 8 percent of grf’s (0.077 against 0.075 for the causal forest at 100,000 rows, 0.073 against 0.068 for the quantiles at 1 million) and its coverage within 1.1 points of grf’s. EconML’s errors are 30 to 40 percent larger for the causal forests, and for the instrumental forest about three times as large; ranger’s and scikit-learn’s, whose forests are not honest, are about twice as large for the regression forest.
Intervals are conservative at large samples. With 2,000 trees the 95% intervals cover 98.6% of rows at 1 million rows (the causal forest), against 95.9% at 10,000. The variance estimate averages over groups of trees and errs on the high side when the sample is large and the trees few (Causal forests). With 8,000 trees at 1 million rows the coverage is 96.1% (the error 0.060 against 0.062, memory unchanged at 2.0 GB), and the fit takes 791 seconds against 200. The regression forest’s intervals, from 500 trees, are conservative in the same way, grf’s too.
The quantile forest’s memory is set by its prediction, not its fit. It is 2.3 GB at 10,000 rows, against 0.7 GB for grf, and about 3 GB through 1 million rows. The peak comes when the 50,000 test rows are predicted: each row pools the outcomes in its leaf of every tree, and forest-stream does this in blocks that take up to a quarter of the memory budget, which here is the machine’s. A smaller
max_memory_gblowers the peak and costs some prediction time (Quantile forests).
To reproduce the tables, run benchmarks/scale_benchmark.py and benchmarks/threads_benchmark.py; the figures are
drawn from benchmarks/results/scale.csv by benchmarks/plot_benchmarks.py.