Personal Operating System
Jersey · GMTEst. 2026Get in touch →
Practitioner notes · AI applied to finance & operations

Jewel Nguyen

Deep read · July 11, 2026 · source published July 8, 2026

Building an AI from the ground up, one vector at a time

Source: “Vectors are all you need (Part A)” by @_raghavdixit_ · July 8, 2026
The piece builds a working AI from the ground up on one thesis: everything becomes a vector, and learning is nudging numbers until the machine stops being wrong. It walks the full chain in order — embedding, dot product, neural net, activation function, loss, gradient descent — and shows the actual equations symbol by symbol, at a beginner-builder level. It matters because it names the mechanism under tools most of us already run: 'semantic search is dot products' is the exact operation behind any vector search or RAG retrieval step. The strongest evidence is that each claim is grounded in a real equation you can check, not a metaphor left hanging.

Everything becomes a number

The first move is that a computer never reads a word; it only does arithmetic. So the first job is turning 'cat' into numbers: a vector — a list of maybe 768 numbers you can picture as an arrow from the origin out to a point.

The trick that makes it useful is that the numbers are chosen so similar meanings land as nearby arrows. 'Cat' and 'dog' point almost the same way while 'helicopter' points elsewhere. Meaning becomes geometry. Nobody hand-picks those numbers; they are learned from a simple pressure, that words showing up in similar sentences get pushed toward similar directions.

The 2013 word2vec demo made it concrete: king minus man plus woman lands nearest to queen, because the man-to-woman step is a consistent direction you can walk from anywhere. A finance reader already meets this idea as cosine similarity between two return series.

The dot product, the one operation under all of it

If meaning is direction, you need to ask how aligned two arrows are, and that is the dot product: multiply two number-lists position by position, then add up the result. One cheap multiply-and-add secretly measures agreement.

Aligned arrows give a big positive number, unrelated ones sit near zero, opposed ones go negative. That single number is a similarity score. The sentence worth keeping: semantic search is dot products. Every time a vector search pulls back a passage, it is comparing embedding arrows with this exact operation.

When people say GPUs matter for AI, this multiply-and-add run billions of times a second is mostly what the GPUs are doing.

The machine that reshapes space

Words-as-arrows need a machine to act on them, and that machine is a neural network built from one small formula, h = f(w·x + b). Here x is the input arrow, w is a set of weights scoring how much the input matches a pattern (the dot product again), b shifts the threshold up or down, and f is a small bend applied at the end.

Stack a row of these into a layer, feed one layer's output into the next, and you get an MLP (multilayer perceptron). Each layer stretches, rotates and folds the space until things that were hopelessly tangled, like sarcastic reviews mixed in with sincere ones, become cleanly separable.

The whole network's knowledge lives in those weight numbers and nowhere else. Depth is not magic; depth is folding space more times.

The one function choice that froze a field

The small bend f looks like a footnote and decided about a decade of progress. Without it, stacking layers is pointless: a stack of straight-line operations collapses into one straight line, so the bend — the activation function — is what makes the folding possible.

The old choice, the sigmoid, squashed every number into 0-to-1 on an S-curve, but the edges of that curve go flat, and flat means a near-zero slope. Since learning passes slopes backward through the layers and multiplies them along the way, ten flat layers multiply ten tiny numbers and the signal shrinks to nothing before it reaches the front. That is the vanishing gradient, and it wrote neural nets off as a dead end for two decades.

The fix, ReLU, is almost insulting: output zero for a negative input, pass a positive input through untouched, so the slope stays exactly 1. Any developer will recognise the lesson — the breakthrough was deleting the thing quietly killing you rather than adding cleverness.

What 'wrong' means, and why models sound sure when they are not

Before the machine can improve, 'wrong' has to become a single number, and for language models that number is cross-entropy: L = minus log P(correct next word). The model reads some text, outputs a probability for every word that could come next, and the loss takes the probability it gave the word that actually came next, takes its log, and flips the sign.

The log turns confident-and-wrong into catastrophe (probability 0.01 costs a loss of 4.6) while an honest hedge is punished gently. The deeper point should reassure anyone from a finance or statistics background: minimising this loss is identical to maximum likelihood, the century-old move of picking the parameters under which the observed data was most probable. GPT training is the most classical thing in statistics wearing new clothes.

It also explains why a model sounds confident when it is wrong: right and wrong answers come out of the same probability distribution wearing the same fluency.

Learning is rolling downhill

The finale is that learning means making the wrongness number go down. Picture the billions of weights as one location in a foggy landscape where altitude is the loss; you cannot see the valley, you can only feel which way is downhill and take a step.

'Which way is downhill' is the gradient, computed by backpropagation, which for all its reputation is the calculus chain rule with careful bookkeeping. The one line the modern world runs on is theta becomes theta minus eta times the gradient: nudge every weight a little against the uphill direction, where eta sets how big a step to take. Run that trillions of times over trillions of words and random numbers become GPT.

The cliffhanger: everything so far gives a word one fixed arrow, so 'river bank' and 'cash from the bank' share the same arrow. Language needs the arrow for 'bank' to bend with its neighbours, and the 2017 fix — every word asking every other word 'are you relevant to me right now', scored by the same dot product — is attention, the transformer Part B promises.

Vocabulary

If you're building — what to watch for

Reading it critically

Read the original → ← Back to the Reading Desk