Skip to main content

CTRL-GT-ORDER-1

Status:In progress
Tags:ControllerGlobal Throttle
Last modified:

Purpose

CTRL-GT-ORDER-1 treats αt\alpha_t as a first-order dynamic state. It smooths the instantaneous jumps of CTRL-GT-ORDER-0. The firmware uses the same division-free inequality search as GT-0, replacing the division-based margin with an attractor toward the largest feasible candidate.

Definition​

The controller searches the candidate table to find the largest α\alpha satisfying the stability constraint:

α2⋅η2⋅∥ΔG∥2  ≤  χ2⋅(∥Δθ∥2+ε2)\alpha^2 \cdot \eta^2 \cdot \|\Delta G\|^2 \;\leq\; \chi^2 \cdot \bigl(\|\Delta\theta\|^2 + \varepsilon^2\bigr)

Denote this value αtfeasible\alpha^{\text{feasible}}_t. The first-order update toward it:

αt+1=αt+kα(αtfeasible−αt).\boxed{ \alpha_{t+1} = \alpha_t + k_\alpha \left( \alpha^{\text{feasible}}_t - \alpha_t \right). }

Then clamp:

αt+1←clip⁡(αt+1,αmin⁡,αmax⁡).\alpha_{t+1} \leftarrow \operatorname{clip}(\alpha_{t+1},\alpha_{\min},\alpha_{\max}).

This replaces the continuous margin mt=χ−ηαtCm_t = \chi - \eta\alpha_t C with the gap αtfeasible−αt\alpha^{\text{feasible}}_t - \alpha_t, avoiding the division in C=∥ΔG∥/(∥Δθ∥+ε)C = \|\Delta G\| / (\|\Delta\theta\| + \varepsilon).

Inputs​

InputMeaning
Δθtraw\Delta\theta_t^{\mathrm{raw}}raw optimizer update
η\etabase learning rate
∥Δθ∥2\|\Delta\theta\|^2squared parameter delta
∥ΔG∥2\|\Delta G\|^2squared gradient delta
χ\chitarget stability margin
kαk_\alphacontroller adaptation gain
ε\varepsilonnumerical guard

Outputs​

OutputMeaning
αt\alpha_tglobal throttle scalar
ηteff\eta_t^{\mathrm{eff}}effective learning rate
Δθtctrl\Delta\theta_t^{\mathrm{ctrl}}globally scaled update

State​

StateMeaning
αt\alpha_tcontroller gain state

Expected Behavior​

This controller reacts more smoothly than GT-0, at the cost of slower response to sudden spikes. The attractor toward αfeasible\alpha^{\text{feasible}} acts as a first-order low-pass on the GT-0 decision, with kαk_\alpha controlling the time constant.

hls4ml Implementation​

Kernel: nnet::global_throttle_order1_law<CONFIG_T>(raw_update_norm_sq, dgrad_norm_sq, alpha, ..., reset_numerator).

Shares the raw_update_sensor_order0 (Phase 1) with GT-0. The law uses raw optimizer update geometry, not actual/throttled parameter movement. For SGD, raw_update_norm_sq already includes the learning rate because the raw update is -eta * gradient. Maintains a static alpha_state variable. On reset_numerator = true, alpha_state reinitializes to 1.

Law (division-free, on squared norms):

αfeasible=max⁡{αcand ∣ α2η2∥ΔG∥2≤χ2(∥Δθraw∥2+ε2)}α←clip⁡(α+kα(αfeasible−α),  αmin⁡,  αmax⁡)\alpha_{\text{feasible}} = \max\{\alpha_{\text{cand}} \,|\, \alpha^2 \eta^2 \|\Delta G\|^2 \leq \chi^2 (\|\Delta\theta_{\text{raw}}\|^2 + \varepsilon^2)\} \qquad \alpha \leftarrow \operatorname{clip}\bigl(\alpha + k_\alpha(\alpha_{\text{feasible}} - \alpha),\; \alpha_{\min},\; \alpha_{\max}\bigr)

Config field controller_k_alpha (default 0.1, key KAlpha in YAML).

The candidate table does not use zero as a normal candidate. If no candidate satisfies the inequality, the law uses the nonzero minimum candidate and logs controller_feasible = 0.

Trace logging provides raw, controlled, and actual update squared norms, ||ΔG||², the squared stability terms, α_feasible, α_state, α_code, α_min, and feasibility.

Implementation Status​

Implemented in hls4ml-trainable (HLS4ML-022, inprogress). The original division-based GT-1 law was replaced with the division-free inequality-search approach, matching GT-0's fix. HLS4ML-039 replaced actual-update denominator geometry with raw-update control geometry to avoid alpha self-locking.