aihwkit.simulator.configs.helpers module

Helper for generating presets.

aihwkit.simulator.configs.helpers.build_config(algorithm, device, io_parameters=<class 'aihwkit.simulator.parameters.io.IOParameters'>, up_parameters=<class 'aihwkit.simulator.parameters.training.UpdateParameters'>, n_devices=1, construction_seed=0, **kwargs)[source]

Generate a RPU configuration for analog training using a specific device model and a given training algoithm.

Parameters:
  • algorithm (str) –

    The type of the training algorithm. Valid choices are:

    ”sgd”: Random pulsed (naive) SGD on analog crossbars. See

    Gokmen & Vlasov, Front. Neurosci. 2016 for details.

    ”mp”, “mixed-precision”: Mixed-precision analog, where the

    gradient is computed in digital and only the forward abd backward pass is in analog. Uses MixedPrecisionCompound. See also Nandakumar et al. Front. in Neurosci. (2020) for details.

    ”tiki-taka”, “ttv1”, “tt”: Tiki-taka I algorithm. Uses

    TransferCompound. See Gokmen & Haensch, Front. Neurosci. 2020 for details.

    ”ttv2”: second version of the Tiki-taka algorithm

    (TTv2). Uses ChoppedTransferCompound with chopper probabilty set to 0. See Gokmen, Front. Artif. Intell. 2021 for details.

    ”chopped-ttv2”, “ttv3”, “c-ttv2”: Chopped version of TTv2

    algorithm. Uses ChoppedTransferCompound. See Rasch et al., ArXiv 2023 for details.

    ”agad”, “ttv4”: Analog gradient accumulation with dynamic

    reference computation. Uses StatsticalransferCompound. See Rasch et al., ArXiv 2023 for details.

  • device (Type[PulsedDevice] | PulsedDevice | Callable) – Device configuration of the analog devices. Can be the class or the actual device. All available device will have the same configuration.

  • io_parameters (Type[IOParameters] | IOParameters | Callable) – IOParameters class (or actual instance) that are used for forward / backward and transfer. Default is IOParameters.

  • up_parameters (Type[UpdateParameters] | UpdateParameters | Callable) – UpdateParameters class (or actual instance) that are used for update and transfer update. Default is UpdateParameters.

  • n_devices (int) –

    In case of SGD, how many device pairs are used in the unit cell.

    Note

    This option is only applied for algorithm="sgd" and ignored for all other algorithm choices.

  • construction_seed (int) – Seed of the construction

  • kwargs (Any) – Other RPUConfig fields to assign explicitely (e.g. mapping).

Returns:

RPU config according to the algorithm and device settings.

Raises:

ArgumentError – in case algorithm is not known

Return type:

UnitCellRPUConfig | SingleRPUConfig | DigitalRankUpdateRPUConfig