ct <- read.csv("ctsem-comparison.csv", stringsAsFactors = FALSE, na.strings = c("NA", "nan", "NaN"))
model_levels <- c("nl20", "d20", "nl10", "d10")
model_labels <- c(
"nl20 (20 nl, d=2,162)",
"d20 (20 lin, d=2,160)",
"nl10 (10 nl, d=582)",
"d10 (10 lin, d=580)"
)
ct$model_label <- factor(ct$model, levels = model_levels, labels = model_labels)
grad_long <- rbind(
data.frame(model_label = ct$model_label, engine = "BridgeStan -O3 (1t)", sec = ct$bridgestan_1t_grad_s),
data.frame(model_label = ct$model_label, engine = "juliaFit EKF (1t, julia_side.R)", sec = ct$julia_1t_grad_s),
data.frame(model_label = ct$model_label, engine = "WeftMC 8t sharded (Stan, exact)", sec = ct$weft_sharded_8t_grad_s),
data.frame(model_label = ct$model_label, engine = "juliaFit EKF (8t)", sec = ct$julia_8t_grad_s),
data.frame(model_label = ct$model_label, engine = "WeftMC 50-subj shard (Stan, 1t)", sec = ct$weft_shard50_grad_ms / 1000.0)
)
grad_long$engine <- factor(
grad_long$engine,
levels = c(
"BridgeStan -O3 (1t)",
"juliaFit EKF (1t, julia_side.R)",
"WeftMC 8t sharded (Stan, exact)",
"juliaFit EKF (8t)",
"WeftMC 50-subj shard (Stan, 1t)"
)
)
p_ct_grad <- ggplot(grad_long, aes(x = sec, y = model_label, color = engine, shape = engine)) +
geom_point(size = 3.0, position = position_dodge(width = 0.55)) +
scale_x_log10(
breaks = c(0.02, 0.1, 0.5, 2, 10),
labels = c("0.02s", "0.1s", "0.5s", "2s", "10s")
) +
scale_color_manual(values = c(
blog_colors$gold,
blog_colors$blue,
blog_colors$teal,
blog_colors$purple,
blog_colors$navy
)) +
guides(color = guide_legend(ncol = 2), shape = guide_legend(ncol = 2)) +
labs(
title = "Time per Gradient (Same Machine)",
subtitle = "juliaFit leads per-pass; 50-subj shards run in 21-289ms",
x = "Seconds per gradient (log scale)",
y = NULL,
color = NULL,
shape = NULL
) +
theme_blog(base_size = 10.1) +
theme(legend.position = "bottom")
vi_long <- rbind(
data.frame(model_label = ct$model_label, method = "WeftMC WAIVES 8ch (ctsm.stan)", sec = ct$panel_waives_s, ok = TRUE),
data.frame(model_label = ct$model_label, method = "WeftMC WAIVES 8ch (reparam)", sec = ct$reparam_waives_s, ok = TRUE),
data.frame(model_label = ct$model_label, method = "WeftMC SVRG-Stein (ctsm.stan)", sec = ct$svrg_stein_s, ok = TRUE),
data.frame(model_label = ct$model_label, method = "WeftMC SVRG-Stein (reparam)", sec = ct$reparam_svrg_s, ok = TRUE),
data.frame(model_label = ct$model_label, method = "juliaFit MAP only (8t, no cov)", sec = ct$julia_map_8t_s, ok = TRUE),
data.frame(model_label = ct$model_label, method = "juliaFit Full + Hessian (8t)", sec = ct$julia_full_8t_s, ok = ct$julia_full_ok == 1),
data.frame(model_label = ct$model_label, method = "CmdStan 2.40 PF (4t)", sec = ct$cmdstan_pf_s, ok = ct$cmdstan_pf_ok == 1),
data.frame(
model_label = factor("d10", levels = model_levels, labels = model_labels),
method = "WeftMC Full-Batch VI (4t)",
sec = 323.81,
ok = TRUE
)
)
vi_long$method <- factor(
vi_long$method,
levels = c(
"WeftMC WAIVES 8ch (ctsm.stan)",
"WeftMC WAIVES 8ch (reparam)",
"WeftMC SVRG-Stein (ctsm.stan)",
"WeftMC SVRG-Stein (reparam)",
"juliaFit MAP only (8t, no cov)",
"juliaFit Full + Hessian (8t)",
"CmdStan 2.40 PF (4t)",
"WeftMC Full-Batch VI (4t)"
)
)
p_ct_vi <- ggplot(vi_long, aes(x = sec, y = model_label, color = method, shape = ok)) +
geom_point(size = 2.9, position = position_dodge(width = 0.66)) +
scale_x_log10(
breaks = c(5, 15, 50, 150, 350),
labels = c("5s", "15s", "50s", "150s", "350s")
) +
scale_color_manual(values = c(
"WeftMC WAIVES 8ch (ctsm.stan)" = blog_colors$purple,
"WeftMC WAIVES 8ch (reparam)" = "#22863a",
"WeftMC SVRG-Stein (ctsm.stan)" = blog_colors$teal,
"WeftMC SVRG-Stein (reparam)" = "#e36209",
"juliaFit MAP only (8t, no cov)" = blog_colors$gold,
"juliaFit Full + Hessian (8t)" = blog_colors$navy,
"CmdStan 2.40 PF (4t)" = blog_colors$red,
"WeftMC Full-Batch VI (4t)" = blog_colors$blue
)) +
scale_shape_manual(
values = c(`TRUE` = 16, `FALSE` = 4),
labels = c(`TRUE` = "Completed", `FALSE` = "Timeout (>210s)")
) +
guides(color = guide_legend(ncol = 2), shape = guide_legend(ncol = 2)) +
labs(
title = "End-to-End Full Fit Time",
subtitle = "d x d Hessian slows juliaFit full fit as d = 580 -> 2,162",
x = "Total wall-clock seconds (log scale)",
y = NULL,
color = NULL,
shape = NULL
) +
theme_blog(base_size = 10.1) +
theme(
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
legend.position = "bottom",
legend.box = "vertical"
)
p_ct_grad | p_ct_vi