Example

The same cosine means two different things in two spaces

Run the geometry benchmark over three seeded spaces and see random-pair cosine at 0.00 in one and 0.49 in another, with a nominal 256 dimensions hiding an effective rank of 6.

A cosine of 0.4 is a number. What it means depends on the space it was measured in, and the chapter’s claim is that you cannot read a cosine without the geometry of the space it came from. The benchmark here makes that concrete with three seeded spaces that differ in nothing but their shape.

Run it

git clone https://github.com/ernanhughes/relate.git
cd relate
git checkout 1de8c95b3995791042d6eb1c150c64c7cdb3492f
python -m venv venv
venv/Scripts/pip install -e ".[dev]"
venv/Scripts/python benchmarks/geometry/run.py --check

--check is the important flag: it verifies the run reproduces the frozen artifacts byte-for-byte instead of overwriting them. Python 3.10 or later, NumPy only, no model download, no network.

Expected outcome

MATCH

One word, and it is the check. The artifacts it compared are the evidence.

The three spaces are the point. In the isotropic space, random pairs are uncorrelated:

{
  "cosine_mean": -0.0033759323657816327,
  "cosine_std": 0.40932798571988355,
  "dimensions": 256,
  "effective_rank": 5.966531569392288,
  "n_vectors": 1200
}

That is the low-rank space. The same nominal 256 dimensions carry an effective rank of about 6, and the intrinsic dimension estimate agrees:

  "intrinsic_dimension": {
    "estimate": 5.308337876918646,
    "method": "twonn",
    "n_samples": 1200
  },

And the invariants are checked separately, because a claim about geometry is only worth what its invariances are worth:

{
  "rotation": {
    "cosine_mean_drift": 4.336808689942018e-19,
    "effective_rank_ratio": 0.9999999999999991
  },
  "scaling": {
    "cosine_mean_base": -0.00018315746815487767,
    "cosine_mean_scaled": -0.0001831574681548776,
    "norm_ratio": 2.5
  },
  "translation": {
    "cosine_mean_base": 0.48793422936830466,
    "cosine_mean_shifted": 0.9999204053800972
  }
}

Rotation drifts by 4e-19, which is float noise. Scaling leaves cosine alone and moves the norm by exactly the factor. Translation moves cosine from 0.49 to 0.9999, which is the whole argument: an offset that means nothing semantically changes every similarity you compute.

Two numbers for the same 256 dimensions

The two numbers a reader should take from this run are random-pair cosine and effective rank. The first says how much of a similarity score is structure you did not put there. The second says how many dimensions the space is actually using. The evidence map in the repository records the headline the book quotes:

Headline: random-pair cosine 0.00 vs 0.49 across spaces; nominal 256 → effective rank 6.0 / TwoNN 5.3; rotation drift < 1e-9.

Mechanism and limitations

Documented: the three seeded spaces, the invariant checks and the frozen artifacts are in benchmarks/geometry/; the mapping from this benchmark to the book’s chapters is in evidence/BOOK-EVIDENCE-MAP.md in the same repository, which records the status of each result as MIRROR, HISTORIC or EXTERNAL.

Observed: the run above. The artifacts reproduce byte-for-byte. The low-rank space reports 256 nominal dimensions, an effective rank of 5.97 and a TwoNN intrinsic dimension of 5.31, and the translation invariant moved random-pair cosine from 0.488 to 0.9999.

Not shown. The spaces are synthetic and seeded, so this is a mirror, not the book’s measured encoder results: the evidence map labels this family MIRROR and notes that TwoNN is estimator-dependent by construction. No semantic claim is made about any space; geometry diagnoses geometry. The rotation drift of 4e-19 is a float-precision observation, and it says nothing about numerical stability on real hardware with real data. Nothing here shows that knowing the geometry helps anyone retrieve anything.

Canonical source and the evidence map .

Understand this example

Copy this prompt into your AI tool. No code runs here.

Apply this example

Copy this prompt into your AI tool. No code runs here.