Skip to content
Pastel LabsThe research arm of Pastel Cloud OÜ

filed under: in-browser search

One-bit photo search, checked in your browser

This page checks that photo search with one bit per number gives the same results in your browser as in our reference run. It also times each search.

The test set is 1,000 photos from Flickr8k, a public collection of Flickr photos with written captions. 100 of those captions are the search queries. Ahead of time, Google's EmbeddingGemma 2 model turned each photo and caption into a list of numbers that describes it, called an embedding. This page does not run the model. It downloads those prepared numbers and shrinks each one to a single bit: above or below the average photo, after a fixed random rotation. Then it finds matches by counting how many bits a caption and a photo share.

Every file comes from this site, and nothing is uploaded. Results stay in this tab until you press Copy results. The search runs on your device's processor. The optional scale-up test adds 10,000, 100,000 or 1 million generated photos to time bigger libraries. They are random numbers, not real photos, so they measure speed only, not search quality.

This page uses our published average photo for EmbeddingGemma 2, built from 18,232 COCO photos (Common Objects in Context, a public photo collection). It is on Hugging Face at pastel-labs/embeddinggemma-2-photo-anchor, commit cefb9e1. This site serves its own copy of the file, and the page checks it against the published checksum before searching.

Ready. Press Run.

Log

Words used on this page

Embedding
A list of numbers a model produces for a photo or a sentence. Similar things get similar lists. Here each list has 768 numbers, or 256 in the shortened version ("dims" in the tables).
One bit per number
Each number is stored as yes or no: is it above the average photo? 768 numbers fit in 96 bytes.
Rotation
A fixed mixing step applied before the bits are taken, so each bit carries a similar share of the information. It uses random seed 42, the same as the reference run.
Parity
Whether this browser returns exactly the same top 10 photos for every query as the reference run. Equal scores go to the photo with the lower number.
Bit distance (Hamming)
The number of bits that differ between a query and a photo. Fewer differences means a better match.
Re-ranking
Take the best 10, 20, 50 or 100 photos by bit distance, then reorder only those using the full numbers.
R@1, R@10, nDCG@10
Quality scores. R@1 is the share of queries whose correct photo comes first, R@10 the share where it is in the top 10. nDCG@10 is a 0 to 1 score that rewards the correct photo appearing higher.
Quality with more photos
The quality scores on this page come from the 1,000-photo test set. In a larger test with 10,000 photos from COCO, one bit per number alone falls to 0.954 of full-precision quality. Re-ranking the top 20 brings it back to 0.998. Storing 4 bits per number instead (384 bytes per photo) gives 0.997 with no re-ranking, so that is the storage mode we recommend for bigger libraries.
Source: Pastel Labs reference run on 10 October 2026, with 10,000 held-out COCO photos and 1,000 caption queries, EmbeddingGemma 2 half-precision vectors, and the photo average and 4-bit steps fitted on separate anchor photos.
JavaScript and WebAssembly
The two ways this page runs code. WebAssembly (wasm) is a compact low-level format that browsers run close to native speed. SIMD (single instruction, multiple data) lets it process 16 bytes in one step. SWAR (SIMD within a register) is a bit-counting trick for plain JavaScript.
Private file storage (OPFS)
The origin private file system: a browser storage area only this site can read. The page uses it to time reading full numbers for the finalists.
Cross-origin isolated
A browser mode this site turns on so timers are precise and memory can be measured.