micrograd: C++ vs Python

A tiny neural network learns to separate two classes of points. The C++ engine trains it and the plot shows the decision boundary as it learns. The benchmark runs the same training in pure Python.

Loading limits from the server…

Decision boundary

class +1 class −1 prediction −1 · 0 · +1

Click the plot to add a point of the selected class; Shift-click adds the other class.

Not trained yet: press Train and the background will show what the network predicts.

Data

Click adds class
CSV import / export

Example: project/data/moons_sample.csv in the repo (60 points).

Training settings

Neurons per hidden layer, comma separated (e.g. 8,8). The output layer (1 neuron) is added for you.

Per data point. Re-initialize picks new random starting weights and trains again; relu sometimes starts “dead” (a flat output) and never learns.

Loss

The loss curve appears after you press Train.

Benchmark: C++ vs Python

Runs the same training (same data, starting weights, epochs and learning rate) in both implementations, a few times each, one after the other.

No benchmark yet. Press Benchmark to time C++ and Python on the current data and settings.

Times are measured on the machine running the server, not on your device.