Skip to content

auto_math_trust_regions_and_optimization_5

github-actions[bot] edited this page Nov 14, 2025 · 1 revision

Snippet from Math-Trust-Regions-and-Optimization.md

def stochastic_trust_step(g_noisy, B, Delta, ema_alpha=0.2):
    """Trust region with noisy gradients."""
    # Smooth gradient over mini-batch
    g_smooth = np.mean(g_noisy_batch, axis=0)
    
    # Standard trust step
    p, rho, Delta_new = trust_step(g_smooth, B, Delta, eta1=0.05)
    
    # EMA smoothing of rho
    rho_ema = ema_alpha * rho + (1 - ema_alpha) * rho_ema_prev
    
    return p, rho_ema, Delta_new

Clone this wiki locally