MLCrack

    EXPERIMENTATION & A/B TESTING Β· INTERVIEW QUESTION

    How do you approach hyperparameter tuning for large LLMs given the huge training cost?

    πŸ”΄ advanced Β· Advanced Experimentation

    Hint: Use proxy models, scaling laws, and known recipes rather than exhaustive search.

    Answer

    1. Scaling laws & prior research: Use Chinchilla/Kaplan scaling laws to determine:

    • Optimal model size for compute budget
    • Optimal data size
    • Good LR ranges

    Interview reasoning

    Strategies for Cost-Effective Tuning

    L(N,D)=Aβ‹…Nβˆ’Ξ±+Bβ‹…Dβˆ’Ξ²+L∞L(N, D) = A \cdot N^{-\alpha} + B \cdot D^{-\beta} + L_\infty

    2. Proxy models:

    Tune on 1B model β†’ Scale best config to 7B β†’ Fine-tune to 70B

    Many hyperparameters transfer across scales (LR schedule shape, warmup ratio).

    3. Known recipes:

    HyperparameterTypical Value
    OptimizerAdamW
    Learning rate1e-4 to 3e-4
    LR scheduleCosine with warmup
    Warmup steps1-2% of total
    Weight decay0.1
    Batch sizeLarge (millions of tokens)
    Gradient clipping1.0

    4. Limited search on critical params:

    • LR and batch size matter most
    • Try 3-5 LR values on proxy model
    • Watch validation perplexity

    5. Early stopping signals:

    • If loss diverges, reduce LR and restart
    • Monitor gradient norms for instability

    For $1M+ training runs, you typically do minimal tuning and rely on proven recipes from published work.

    LLM experiment results depend on data, prompts, model versions, decoding and compute budget. Preserve run manifests and artifacts; compare candidates on untouched task evaluations with cost and safety constraints. Expensive tuning should use staged smaller-budget evidence and repeated seeds or prompts where variation affects the conclusion.

    Worked example. Use smaller pilots to eliminate poor configurations, then confirm finalists at the intended budget on independent task data. A setting that wins at a one-hour pilot may lose after full convergence; use scaling evidence before extrapolating its ranking.

    Validation

    Recreate selected runs, verify comparable evaluation inputs and budget accounting, and check sensitivity to stochastic generation. Test resumed versus uninterrupted runs with the saved optimizer, scheduler and data-position state. Retain failed trials and selection criteria so the winning run can be reviewed in the context of the complete search.

    Common pitfalls

    A tracking dashboard does not prevent test-set overfitting. Identical seeds do not reproduce mutable APIs or overwritten datasets.