aihwkit.inference.noise.custom module

Phenomenological noise model for inference.

class aihwkit.inference.noise.custom.StateIndependentNoiseModel(g_converter=None, g_max=None, prog_coeff=None, prog_noise_scale=1.0, drift_nu_mean=0.1, drift_nu_std=0.05, drift_scale=1.0, t_0=20.0, read_noise_scale=1.0, t_read=2.5e-07)[source]

Bases: BaseNoiseModel

Standard noise model that has a non-conductance dependent drift and

multiplicative read (1/f) noise.

Programming noise is state-independent by default, however, it can be made conductance dependent, since the expected programming noise strength is modeled with a second-order polynomial in general.

Programming noise is thus given by:

\[\sigma_text{programming noise}=\gamma\,\left(c_0 + c_1 \frac{g_T}{g_\text{max}} + + c_2 \frac{g_T^2}{g_\text{max}^2}\right)\]

where \(\gamma\) is a additional convenience scale and \(g_T\) is the target conductance established from the given g_converter from the weight matrix. The default programming noise is constant (state independent): \(c_0=0.2\mu\mathrm{S}\) and other coefficient set to \(0.0\).

Drift is for each device is computed as

\[g_\text{drift}(t) = g_\text{prog}(t / t_0) ^{- \nu}\]

with the drift coefficient determined at the beginning for each device with

\[\nu= \zeta\, |\nu_\text{mean} + \nu_\text{std}\xi|_+\]

where \(\xi\) is a Gaussian random number and \(|\cdot|_+\) rectifies negative value to zero. \(\zeta\) is an additional drift scale.

Read noise is given by

\[\sigma_\text{read} = \rho \frac{g_\text{drift}(t)}{g_\text{max}} \sqrt{\log\left(\frac{t + t_\text{read}}{2 t_\text{read}}\right)}\]

This \(\sigma_\text{read}\) is then used to add Gaussian noise of this magnitude to the drifted conductance. The read noise scale \(\rho\) can be used to scale the read noise.

Args:
g_converter: instantiated class of the conductance converter

(defaults to single pair)

g_max: In \(\mu S\), the maximal conductance, ie the value

the absolute max of the weights will be mapped to.

prog_coeff: programming polynomial coefficients \(c_i\) in

\(\mu S\). Default is constant \(c_0=0.2\) and other coefficient set to 0.0.

prog_noise_scale: scale :math:gamma: for the programming noise

drift_nu_mean: mean \(\nu_\text{mean}\) of power-law drift

coefficient (\(\nu\)) (before drift_scale \(\zeta\) is applied).

drift_nu_std: device-to-device variability

\(\nu_\text{std}\) of the power-law drift coefficient (before drift_scale is applied)

drift_scale: additional scale \(\zeta\) applied to all

drawn drift coefficients

t_0: parameter of the drift (first reading time), see above.

Note:

The t_inference is relative to this time t0 e.g. t_inference counts from the completion of the programming of a device.

read_noise_scale: scale \(\rho\) for scaling the read and

accumulated noise \(1/f\).

t_read: parameter of the \(1/f\) noise (in seconds)

Parameters:
  • g_converter (BaseConductanceConverter | None) –

  • g_max (float | None) –

  • prog_coeff (List[float] | None) –

  • prog_noise_scale (float) –

  • drift_nu_mean (float) –

  • drift_nu_std (float) –

  • drift_scale (float) –

  • t_0 (float) –

  • read_noise_scale (float) –

  • t_read (float) –

apply_drift_noise_to_conductance(g_prog, drift_noise_param, t_inference)[source]

Apply the noise and drift up to the assumed inference time point.

Parameters:
  • g_prog (Tensor) –

  • drift_noise_param (Tensor) –

  • t_inference (float) –

Return type:

Tensor

apply_programming_noise_to_conductance(g_target)[source]

Apply programming noise to a target conductance Tensor.

Programming noise with additive Gaussian noise with conductance dependency of the variance given by a 2-degree polynomial.

Parameters:

g_target (Tensor) –

Return type:

Tensor

generate_drift_coefficients(g_target)[source]

Return drift coefficients nu.

Parameters:

g_target (Tensor) –

Return type:

Tensor