sn22-sandbox-embed / README.md
mirianokradze's picture
Refresh the sandbox embed set
b033676 verified
|
Raw History Blame Contribute Delete
4.16 kB
metadata
license: cc-by-sa-4.0
language:
  - en
pretty_name: SN22 sandbox embed texts
size_categories:
  - 10K<n<100K
tags:
  - embeddings
  - bittensor
  - desearch
configs:
  - config_name: default
    data_files: data/*.parquet

SN22 sandbox embed texts

Texts and reference embeddings for testing a Desearch Subnet 22 embed miner locally, before it takes tasks on mainnet.

Run python -m sandbox embed in the subnet-22 repository. It downloads these files, queues the texts as embed tasks in a local task API, and runs a local validator that checks your miner's embeddings against the reference vectors here, the way mainnet validators check embed tasks. Point your miner at the local API and see each verdict, the texts that did not match and by how much, and how fast your GPU gets through a task. The guide has the steps.

Dataset details

Texts 14,226: 3,000 page texts and 11,226 passages
Pages 3,000 English Wikipedia articles, sampled at random
Characters 15.6 million
Reference model desearch-4b-v1: desearch/Desearch-Embedding-4B at revision 12e5c6910d49dd5534e8a77a6fa7d8a057bd534a
Reference vectors 2,560 dimensions, float32, L2-normalized
Files data/texts-NNNNN.parquet, rows grouped by page; manifest.json lists them
Source wikimedia/wikipedia, snapshot 20231101.en
License CC BY-SA 4.0

Columns

Column Type
text_id string the text's id within its page: <page_key>#page or <page_key>#p<n>
page_key string the page the text was taken from
url string the article's Wikipedia URL
content_sha1 string the version of the page the text was taken from
kind string page for a page's own text, passage for a passage of a long article
index int32 0 for the page text, 1, 2, … for its passages
text large string exactly what is embedded
reference binary the reference vector: 2,560 little-endian float32 values

The first seven columns are the columns of a mainnet embed task's input, so the sandbox serves these rows to miners unchanged.

How the texts were made

Each article becomes texts the same way a crawled page does on mainnet, with the same code:

  • Page text: the title, then the article's text, cut at 10,000 characters.
  • Passages: an article longer than 2,000 characters also gives up to 16 passages of 600 to 1,500 characters of consecutive paragraphs, split at its section headings, each starting with the article's title and the section's heading.

Random articles give the mix of short and long pages a real task has.

How the reference vectors were computed

The reference vectors come from the exact model in full precision: vLLM 0.31.0 with --runner pooling --dtype float32 --no-enable-chunked-prefill --max-num-batched-tokens 16384, attention kernels in float32 too (TRITON_F32_DEFAULT=ieee). Each text was sent as is, with no prompt, and cut at 2,048 tokens (truncate_prompt_tokens: 2048).

The model served as miners run it, in float16 with the documented command, matches these vectors with a cosine similarity of at least 0.99998 on a random sample of 500 texts. Mainnet's check asks for 0.999.

Loading

import numpy as np
from datasets import load_dataset

rows = load_dataset("desearch/sn22-sandbox-embed", split="train")
row = rows[0]
reference = np.frombuffer(row["reference"], dtype="<f4")  # shape (2560,)
print(row["text_id"], row["kind"], len(row["text"]), reference.shape)

Source and license

The texts are adapted from Wikipedia articles by Wikipedia contributors, through the wikimedia/wikipedia dataset (snapshot 20231101.en). Like Wikipedia, this dataset is licensed under CC BY-SA 4.0.