06 / 13

Chapter 06 · Beginner guide

Matrix math, the work AI runs on

Rows times columns, billions of times a second

Strip away the buzzwords, and a modern AI model is mostly a long list of grids full of numbers, multiplied together over and over.

Pearl’s mining uses exactly that kind of multiplication. To see why that’s a clever idea, and where its limits are, start with the grids.

What is a matrix?

A matrix is a grid of numbers arranged in rows and columns, like a small spreadsheet with no labels.

A photo is a matrix, if you write down each pixel’s brightness. So is a table of prices, with one row per shop and one column per product. And so is most of what an AI model has learned: its knowledge is stored as huge matrices of numbers called weights.

How do you multiply two matrices?

Here’s the rule, which is simpler than it sounds. To get one cell of the answer, take one row of the first matrix and one column of the second. Multiply them pair by pair, then add the results.

That operation is called a dot product. Let’s do a small one by hand.

(1234)×(5678)=(19224350)\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \times \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix} = \begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix}
A 2 × 2 example
  1. Pick a row and a column

    For the top-left cell, take the first row, (1, 2), and the first column, (5, 7).

  2. Multiply the pairs

    1 × 5 = 5, and 2 × 7 = 14.

  3. Add them up

    5 + 14 = 19. That’s the top-left cell.

  4. Repeat for every cell

    Top-right uses row (1, 2) and column (6, 8): 6 + 16 = 22. The bottom row works the same way, giving 43 and 50.

Each “multiply, then add to the running total” step is one multiply-accumulate. Remember that word: it’s the unit Pearl uses to count mining work.

Hover over the cells below to see which row and column make each one.

Matrix multiplication

Each cell of C is one row of A times one column of B

B

A

C = A·B

Hover or focus any cell of C, or press Step, to see which row and column make it.

Multiply-accumulates 27/ 27 n³ = 3 × 3 × 3

Toy sizes Real jobs are thousands of rows wide. A Pearl GPU does exactly this, with at least 1,024 terms per cell and entries from −64 to 64, and every term is one multiply-accumulate.

Runs in your browser · nothing is sent src/lib/miner.ts · matMul

Why is it so much work?

Because the steps multiply quickly. For two 3 × 3 matrices, each of the 9 answer cells needs 3 multiply-accumulates: 27 in total.

For two 1,000 × 1,000 matrices, there are a million answer cells, each needing 1,000 steps. That’s a billion multiply-accumulates for one multiplication. AI models do multiplications like that constantly.

Make a guess

To multiply two 4 × 4 matrices, how many multiply-accumulate steps do you need?

Think of your answer first, then check it.

Answer 64.

The answer has 4 × 4 = 16 cells, and each cell is a dot product of 4 pairs, so 16 × 4 = 64. In general, an n × n multiplication takes n × n × n steps, which is why the work grows so fast.

Why do AI models need it?

When a chatbot reads your question, it turns the words into numbers and passes them through dozens of layers. Each layer multiplies the incoming numbers by its weight matrix.

Running a trained model like this is called inference, and for large models most of its time goes into matrix multiplication. That’s why the demand for this one kind of math has exploded.

Why are GPUs so good at it?

A GPU was built to draw video game graphics, which also means doing the same simple math on huge numbers of pixels at once. It has thousands of small cores working in parallel.

Matrix multiplication suits that perfectly, because no cell of the answer depends on any other. Hand each cell to a different core and they all work at once. Modern GPUs go further, with tensor cores: circuits that multiply a small block of a matrix in a single step.

Smaller numbers go faster still. Pearl’s mining uses whole numbers in the range [−64, 64], which fit the GPU’s fast 8-bit integer mode. Squeezing an AI model’s numbers into a small range like that is called quantization.

What is Pearl’s big idea?

Bitcoin’s mining burns a vast amount of computing on guesses that protect the network and do nothing else.

Pearl asks: what if the protective work were also work people actually want done? Matrix multiplication is the natural choice, because so much of AI is made of it. Pearl calls this proof of useful work.

In Pearl’s official miner, mining happens inside a real AI model. The miner plugs into a popular serving program called vLLM and runs language models published for it. When the model handles a big enough batch, at least 1,024 tokens (word pieces) at once, its multiplications double as mining. The extra cost on top of the model’s normal work is reported to be a few percent.

Does Pearl check that the work is useful?

No, and it’s worth being clear about this.

Pearl’s rules check that the multiplication was done honestly. They can’t check what the numbers mean, so a matrix full of random numbers counts exactly the same as a real AI layer. Pearl’s own reference CPU miner multiplies random matrices.

There’s one more problem to solve. If the puzzle were simply “multiply these matrices”, a miner could do it once and reuse the answer forever. The next page shows how Pearl stops that, and how a miner proves its work to everyone else.

Beginner guide

Suggested

Up and down arrows move through the results, Enter opens one, Escape closes. Anywhere on the site, slash or Command K opens this search, and the square brackets [ and ] go to the previous and next page.