# Trenowanie sieci impulsowych gradientem zastępczym

EN: **Surrogate-gradient training of spiking networks** · id `surrogategrad` · aliases: surrogate gradients, surrogate gradient learning, gradient zastępczy, BPTT for SNN

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Sieci i modele generatywne](https://aiatlasgraph.com/t/neural.md) › [Alternatywne architektury sieci](https://aiatlasgraph.com/t/altarchs.md) › [Sieci impulsowe (SNN)](https://aiatlasgraph.com/t/snn.md) › Trenowanie sieci impulsowych gradientem zastępczym

## Description

- PL: Trenowanie SNN propagacją wsteczną w czasie, w którym nieróżniczkowalną funkcję progową zastępuje się w przejściu wstecz gładką pochodną zastępczą.
- EN: Training SNNs with backpropagation through time, replacing the non-differentiable threshold with a smooth surrogate derivative in the backward pass.

## In one sentence

- PL: Sposób uczenia sieci impulsowych zwykłą metodą poprawiania błędów, choć ich neurony działają skokowo: włączone albo wyłączone.
- EN: A way to train spiking networks with ordinary error correction, even though their neurons switch abruptly between on and off.

## Problem it solves

- PL: Sieci impulsowe trudno było wytrenować, bo nagły skok sygnału nie mówi, w którą stronę poprawić ustawienia.
- EN: Spiking networks were hard to train because an abrupt jump in the signal gives no hint which way to adjust the settings.

## What it does

- PL: Jak równia pochyła zamiast schodów: przy liczeniu poprawek udajemy, że skok jest łagodnym zboczem, więc wiadomo, gdzie jest „w dół”.
- EN: Like a ramp instead of stairs: when computing corrections we pretend the jump is a gentle slope, so “downhill” becomes visible.

## Everyday example

- PL: Badaczka trenuje na laptopie małą sieć impulsową rozpoznającą wypowiadane cyfry, zanim wgra ją do oszczędnego układu.
- EN: A researcher trains a small spiking network to recognise spoken digits on her laptop before loading it onto a low-power chip.

## This concerns you if you…

- PL: chcesz samodzielnie wytrenować sieć impulsową
- PL: przenosisz model na energooszczędny układ
- EN: want to train a spiking network yourself
- EN: are moving a model onto a low-power chip

## Keywords

backpropagation through time · SuperSpike · snnTorch · Norse · SpikingJelly · fast sigmoid surrogate · straight-through estimator

## How it works

- PL: W przejściu w przód neuron emituje binarny impuls (funkcja schodkowa). W przejściu wstecz pochodną schodka zastępuje gładka funkcja, np. szybka sigmoida, a sieć rozwija się w czasie jak RNN i trenuje przez BPTT. Pozwala to używać zwykłych bibliotek autograd.
- EN: In the forward pass the neuron emits a binary spike (a step function). In the backward pass the step's derivative is replaced by a smooth function such as a fast sigmoid, and the network is unrolled in time like an RNN and trained with BPTT. Standard autograd libraries then apply.

## Limits

- PL: Rozwijanie w czasie zużywa pamięć proporcjonalnie do liczby kroków. Wynik zależy od kształtu i skali funkcji zastępczej; gradient jest przybliżeniem, a trening wolniejszy niż w zwykłych sieciach.
- EN: Unrolling in time costs memory proportional to the number of steps. Results depend on the surrogate's shape and scale; the gradient is an approximation, and training is slower than for ordinary networks.

## Key terms

- PL: **surrogate gradient**: Gładka pochodna wstawiona w miejsce pochodnej skoku progowego.
- PL: **BPTT**: Propagacja wsteczna po sieci rozwiniętej krok po kroku w czasie.
- PL: **funkcja schodkowa (Heaviside)**: Zero poniżej progu, jeden powyżej.
- EN: **surrogate gradient**: A smooth derivative used in place of the threshold step's derivative.
- EN: **BPTT**: Backpropagation through a network unrolled step by step in time.
- EN: **Heaviside step**: Zero below the threshold, one above.

## Know first

- [Propagacja wsteczna (backpropagation) (Backpropagation)](https://aiatlasgraph.com/t/backprop.md)
- [Sieci rekurencyjne (RNN) (Recurrent neural networks (RNN))](https://aiatlasgraph.com/t/rnn.md)

## Sources

- [Surrogate Gradient Learning in Spiking Neural Networks](<https://arxiv.org/abs/1901.09948>) `neftci-surrogate-gradient-2019` · by Emre O. Neftci, Hesham Mostafa, Friedemann Zenke

---

AI Atlas revision 129 (2026-11-05) · HTML: https://aiatlasgraph.com/t/surrogategrad · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-11-05
