LLM Learning Hub

workspace/llm-course/home

Perceptron

A perceptron is the simplest neural network — a single neuron that computes a weighted sum of inputs, adds a bias, and applies a step function. It is a linear binary classifier.

What is Perceptron?

A perceptron is the simplest neural network — a single neuron that computes a weighted sum of inputs, adds a bias, and applies a step function. It is a linear binary classifier.

A perceptron is the simplest neural network — a single neuron that computes a weighted sum of inputs, adds a bias, and applies a step function. It is a linear binary classifier.

Where is it used?

Perceptrons are the building blocks of all neural networks. Modern LLMs use the same weighted-sum-plus-activation pattern, just with millions of neurons stacked in layers.

How to build it

In PyTorch, create a single `nn.Linear` layer with one output, apply a sigmoid or threshold. Train it on 2D data with gradient descent using `torch.optim.SGD`.