Scaling Model Evaluation at Pinterest with Ray (Part 4)
Pinterest fused model-evaluation metric computation into its Ray batch inference jobs, removing the separate Spark/Ray metrics job and the write-predictions-to-S3-then-reread handoff. The fusion relies on a metric contract (preprocess, compute partials per batch, reduce partials) that covers decomposable metrics like MAE, holistic metrics like ROC-AUC (approximated via per-threshold confusion matrices), and group-wise metrics like Precision@K. Group-wise metrics use Spark to pack complete segments into buckets so no segment spans a bucket. Overlapping CPU metric work with GPU inference via Ray's shared object store cut end-to-end evaluation time by 25–32% at 100 feature-importance experiments, with runtime scaling linearly in experiment count.
Related posts
- Beyond Two Towers: Launching the 3-Tower Engagement Co-Train Model (Part 2)
Pinterest Engineering hardMasterPinterest's ads lightweight ranking adds a third cross tower to its two-tower engagement model. The cross tower runs cross-attention between user sequences and candidate-derived query tokens, and a shared-bottom inter module jointly predicts CTR, gCTR30 and oCTR. Co-training keeps a fast two-tower head that scores all candidates, and the three-tower path rescores only a utility top-K subset. The three-tower predictions cut offline loss by about 30%. Serving optimizations brought P99 inference from over 200 ms to about 30 ms: caching Pin preprocessing in the Pin tower, BF16, late expansion of user features, and pre-layer normalization.
- Shopify's Playbook for Scaling Machine Learning
Shopify Engineering easyNoviceShopify's approach to scaling machine learning grew out of its first ML product, an order fraud detector that replaced a rule-based system with a high false-positive rate. Teams should pick a problem users care about, confirm the data is trustworthy and accessible, account for downstream dependencies such as fulfillment, and optimize for product outcomes rather than raw model scores. Shopify shipped a simple logistic regression model, built in Python, serialized to PMML, scheduled with Airflow and served in real time from Rails. To scale to hundreds of models, Shopify relies on input/output reconciliation, shadow backtesting, drift monitoring, platform-enforced best practices and automated model operations.
- Introducing Trackio: A Lightweight Experiment Tracking Library from Hugging Face
Hugging Face mediumAdeptTrackio is a free, open-source Python experiment tracking library that works as a drop-in replacement for wandb's init/log/finish API. It shows runs in a local Gradio dashboard and can sync to Hugging Face Spaces for sharing or iframe embedding. On Spaces, metrics go to an ephemeral SQLite database that is converted to Parquet and backed up to a Hugging Face Dataset every 5 minutes. It integrates with transformers Trainer and Accelerate, keeps its core under 1,000 lines, and is in beta without artifact management or complex visualizations.
- GEM Training: How Meta Doubled the Efficiency of Its LLM-Scale Ads Foundation Model
Meta Engineering hardMasterMeta doubled end-to-end training efficiency of GEM, its LLM-scale ads recommendation foundation model, to 20–25% MFU while scaling training FLOPs 4x in a year, by co-designing kernels, precision, parallelism, networking and memory. Compute efficiency came from custom recommendation kernels: Jagged Flash Attention (no padding, subtraction-based masking, split-dQ backward, TLX warp specialization), GDPA unifying non-softmax attention variants (up to 3.5x over FA4 on short K/V), and 64-token BlockAttention with fused RoPE, plus MXFP8 attention and MLP that avoid CTR/CVR quality regressions. Scaling efficiency came from topology-aware 5D parallelism (2D FSDP + expert parallelism for dense, fully sharded 2D model parallelism for sparse embeddings) with SM-free collectives. Framing E2E MFU as local MFU × scaling ratio turned a sprawling co-design effort into separable optimization levers.
- F3 Lightning: How Meta Accelerates Ads ML Features to Production at Scale
Meta Engineering mediumAdeptF3 Lightning decouples feature releases from shared execution in Meta's ads ML feature framework, so each of 20,000+ features is compiled, validated, deployed and rolled back independently instead of shipping as one all-or-nothing merged DAG. To recover the CPU efficiency lost when features stopped sharing computation, it uses content-derived stable node identifiers, a single startup-built execution plan flattened into an ordered list, one shared per-request memory buffer with a separate readiness vector, and dense integer slot indexing in place of hash lookups. Features reach production about 3.6x faster with no added compute cost. The broader lessons are to separate release boundaries from execution boundaries, to move request-invariant work to startup, and to treat memory layout and duplicate copies as costing as much CPU as redundant computation.