# Rank and noise

> What rank is, how Pearl builds rank-128 noise from a thin random matrix and a ±1 selector, how it is removed exactly, and why tickets watch every slab.

Source: https://pearlcodex.com/technical/math/rank-and-noise/ · Last updated: 2026-10-20 · Checked against Pearl's source code at v1.5.5

If Pearl’s puzzle were simply “multiply A by B”, a miner could do one multiplication and replay the answer forever. So before multiplying, the miner must add **noise**: random numbers that nobody can predict until the block and the matrices are fixed.

The noise has a peculiar shape. It’s random-looking, but it has low [rank](https://pearlcodex.com/glossary/#rank), which makes it cheap to create and, after multiplying, cheap to remove, so the useful answer survives. This page explains rank, the noise’s exact recipe, and the catch that low rank creates.

## Try it

Build a noise matrix from a thin random matrix and a ±1 selector. See how few numbers describe the whole thing.

_Interactive: Low-rank noise. Try it on the page: <https://pearlcodex.com/technical/math/rank-and-noise/>_

## What is rank?

The rank of a matrix is how many truly independent rows it has. If some rows are just combinations of others, they add no new information.

The simplest case is rank 1: a column times a row, an [outer product](https://pearlcodex.com/glossary/#outer-product). Every row is a multiple of the same row.

_A rank-1 matrix: 12 numbers, but fully described by 3 + 4 = 7. Each row is 1, 2 or 3 times the row (2, 0, −1, 1)._

A rank-r matrix is a sum of r such outer products. Equivalently, it’s a **thin** m × r matrix times a **wide** r × k matrix:

$$
E \;(m \times k) \;=\; E_L \;(m \times r) \;\cdot\; E_R \;(r \times k)
$$

_m·k numbers in the full matrix, but only r·(m + k) needed to describe it. Pearl uses r = 128._

## How does Pearl build its noise?

Two seeds, made by hashing the block template and the miner’s fingerprints of A and B (see [noise seeds](https://pearlcodex.com/technical/mining/noise-seeds/)), drive a BLAKE3 random number generator. From seed A it builds:

- **E\_AL**, a thin m × r matrix of random numbers in \[−32, 31] (6-bit).
- **E\_AR**, an r × k **selector**: each column has exactly one +1 and one −1, in two different rows f and s, and zeros elsewhere.

Their product is the noise added to A: E_A = E_AL · E_AR. Because each selector column picks one column and subtracts another, every column of the noise is a difference of two columns of E_AL. That’s why its entries land in \[−63, 63].

_The toy noise from Pearl’s worked example (r = 4, k = 16). The selector’s column 0 has +1 in row 0 and −1 in row 2, so column 0 of E_A is column 0 minus column 2 of E_AL. Toy numbers, from the research worked example._

The noise for B is built the same way from seed B, mirrored: E_B = E_BL · E_BR, with a k × r selector on the left (one +1 and one −1 per row) and a random r × n matrix on the right. Then the miner multiplies the noisy matrices:

$$
A' = A + E_A, \qquad B' = B + E_B, \qquad \text{work} = A' \cdot B'
$$

**Two details: the effective rank, and the cost of making noise**

**Effective rank.** Every column of a selector has one +1 and one −1, so its entries sum to zero. That makes the selector’s rows linearly dependent, and the noise’s rank is at most r − 1: at most 127 on mainnet. (The research inferred this from the construction; the toy noise, with r = 4, has rank 3.)

**Cost.** E_A has m·k entries but is described by m·r random numbers plus 2k selector positions. For m = 1,024, k = 8,192 and r = 128 that’s 147,456 numbers instead of 8,388,608. Generating and adding the noise takes time proportional to (m + n)·k, a small fraction of the m·n·k multiplication.

## Why does noise stop reuse?

Because nobody knows it in advance. The seeds depend on the previous block, the transaction root, the time, the mining settings, the fingerprints of A and B and, since block 99,000, the declared sizes m and n. Change any of these and the noise changes completely.

There’s a second, subtler job. Pearl’s security argument leans on a result from the paper behind the design: every r × r block of a random rank-r matrix looks perfectly uniform. So A′ = A + E_A looks random block by block, even if A is all zeros. Multiplying A′ by B′ should then be as hard as multiplying random matrices: no matrix the miner chooses can make the work easier.

## How is the noise removed?

Expand the noisy product. Since A′ = A + E_A and B′ = B + E_B:

$$
A' B' = A B + A \cdot E_B + E_A \cdot B'
$$

so the real product, the useful answer, is

$$
A B \;=\; A' B' \;-\; (A \cdot E_{BL}) \cdot E_{BR} \;-\; E_{AL} \cdot (E_{AR} \cdot B')
$$

Denoising

_Every correction goes through the thin r-wide matrices, never through a full k-wide product._

The bracketed products with the ±1 selectors (A·E_BL and E_AR·B′) are only additions and subtractions. The two remaining products have an inner size of r instead of k, costing about m·n·r each. So the extra work is about 2r/k of the main multiplication:

| Shared size k | Denoising overhead ≈ 2 × 128 / k |
| ------------- | -------------------------------- |
| 4,096         | 6.25%                            |
| 8,192         | 3.1%                             |
| 28,672        | 0.9%                             |

> **Scenario · made-up numbers: Denoising the toy, row 0**
>
> From Pearl’s toy example: row 0 of A′B′ is (80, 49, 42, 56). The two corrections are (−28, 16, −80, −44) and (91, −23, 44, 38). Subtracting both: 80 + 28 − 91 = 17, 49 − 16 + 23 = 56, 42 + 80 − 44 = 78, 56 + 44 − 38 = 62. That’s (17, 56, 78, 62), exactly row 0 of A·B computed directly.

The integer identity is exact. On the GPU, Pearl’s kernel applies the corrections in 16-bit floating point inside the same pass, then rescales and writes the layer’s output, so whether the GPU result is bit-for-bit exact is an open question (it doesn’t matter much for an AI model). More on the [useful output](https://pearlcodex.com/technical/mining/useful-output/) page.

## What’s the catch with low rank?

Cheap to remove means cheap to add. If a miner already knew A·B, it could compute the noisy product A′B′ = AB + A·E_B + E_A·B′ with only the cheap thin products, about m·n·r work instead of m·n·k. If the ticket depended only on the final product, one expensive multiplication could be recycled into endless cheap tickets.

So Pearl’s ticket doesn’t hash the final product. It records each tile’s running sums after **every** slab of r = 128 steps along k (see [matrix multiplication](https://pearlcodex.com/technical/math/matrix-multiplication/)). To fake those, a shortcut would need a fresh low-rank correction at every checkpoint, which costs as much as just doing the multiplication. The whitepaper sees no apparent speedup as long as k ≤ O(r²), which is why consensus requires k ≤ 4r².

> **Warning: An argued conjecture, not a theorem**
>
> That no shortcut exists is a conjecture with a careful argument behind it, not a mathematical proof. Two security-motivated changes have already shipped since launch: the rank penalty (block 96,251) and salted noise seeds (block 99,000).

## Why does rank need a penalty?

A ticket’s winning bar is scaled by the work it costs, and the rank of the noise divides that work: with a bigger r there are fewer checkpoints per tile. Pearl’s developers found that mining at a larger rank bought a proportionally easier bar for the same effort.

Since block 96,251, the rank must be at least 128, and the bar is scaled by 128/r:

| Noise rank r | Below 128 | 128    | 256 | 512 | 1,024 |
| ------------ | --------- | ------ | --- | --- | ----- |
| Winning bar  | rejected  | normal | ½   | ¼   | ⅛     |

The [rank penalty](https://pearlcodex.com/technical/mining/rank-penalty/) page has the full story.

**Code: building the noise in Pearl's prover**

From [`pearl_noise.rs`](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/zk-pow/src/circuit/pearl_noise.rs#L140-L153). Only the rows and columns a tile needs are computed; `matvec_sparse_perm` applies the ±1 selector without any multiplications:

`zk-pow/src/circuit/pearl_noise.rs`

```rust
// Generate the 4 matrices
let e_al = generate_uniform_random_matrix(&seed_a, &a_noise_seed, a_rows_indices, noise_rank);
let e_ar_transposed = generate_permutation_matrix(&seed_a, &a_noise_seed, k, noise_rank);
let e_bl = generate_permutation_matrix(&seed_b, &b_noise_seed, k, noise_rank);
let e_br_transposed = generate_uniform_random_matrix(&seed_b, &b_noise_seed, b_cols_indices, noise_rank);

// Compute only the needed rows of NOISE_A = E_AL * E_AR
let noise_a: Vec<Vec<i8>> = e_al.par_iter().map(|row| matvec_sparse_perm(&e_ar_transposed, row)).collect();
```

## In short

- A matrix’s rank is how many independent rows (or columns) it really has. A rank-r matrix can be written as a thin m × r matrix times a wide r × k one.
- Pearl’s noise for A is E_A = E_AL · E_AR: a random m × 128 matrix with entries in \[−32, 31] times a selector with one +1 and one −1 per column. Each noise column is one column of E_AL minus another.
- The noise comes from seeds no one can predict before committing to the block and the matrices, so an old product can’t be reused.
- Because the noise is low-rank, the exact product A·B can be recovered afterwards for about 2r/k extra work: roughly 3% at k = 8,192.
- Low rank cuts both ways, so Pearl hashes the running sums after every 128-wide slab. That no shortcut exists is an argued conjecture, not a proof.

## Read the code

- [The noise PRNG, the thin factors, the selectors and their product](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/zk-pow/src/circuit/pearl_noise.rs#L46-L153) `zk-pow/src/circuit/pearl_noise.rs:46-153`
- [The denoising formula on the GPU](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/miner/pearl-gemm/src/pearl_gemm/pearl_gemm_interface.py#L374-L384) `miner/pearl-gemm/src/pearl_gemm/pearl_gemm_interface.py:374-384`
- [The rank penalty](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/zk-pow/src/api/sanity_checks.rs#L161-L200) `zk-pow/src/api/sanity_checks.rs:161-200`
- [Where consensus applies the rank penalty](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/blockchain/validate.go#L549-L556) `node/blockchain/validate.go:549-556`

## Sources

### Pearl source

- [Pearl PR #275: the rank-penalty soft fork](https://github.com/pearl-research-labs/pearl/pull/275)

### Pearl docs

- [Pearl INT whitepaper, §4.2–4.4](https://pearlresearch.ai/research/int-whitepaper)

### Papers

- [Komargodski and Weinstein, proofs of useful work from matrix multiplication (arXiv 2504.09971), §6](https://arxiv.org/abs/2504.09971)

### Other

- [Rank (linear algebra), Wikipedia](https://en.wikipedia.org/wiki/Rank_\(linear_algebra\))
