---
title: "Ribbon filter: Practically smaller than Bloom and Xor"
description: "Ribbon filters are a static (immutable) alternative to Bloom filters that save roughly a third of memory, with space overhead as low as 1 percent above the information-theoretic bound versus Bloom's roughly 50 percent, while keeping O(1) queries."
url: "https://swe.quest/articles/ribbon-filter-practically-smaller-than-bloom-and-xor-22be170304982d25"
canonical: "https://engineering.fb.com/2021/07/09/data-infrastructure/ribbon-filter/"
source: "Meta Engineering"
published: "2021-07-09"
difficulty: "hard"
kind: "Research"
reading_minutes: 3
tags: ["data-structures","algorithms","storage-engines"]
---

# Ribbon filter: Practically smaller than Bloom and Xor

A post on [Meta Engineering](https://swe.quest/sources/meta.md), published 2021-07-09, 3 min read, Research. Original: [https://engineering.fb.com/2021/07/09/data-infrastructure/ribbon-filter/](https://engineering.fb.com/2021/07/09/data-infrastructure/ribbon-filter/)

## Summary

Ribbon filters are a static (immutable) alternative to Bloom filters that save roughly a third of memory, with space overhead as low as 1 percent above the information-theoretic bound versus Bloom's roughly 50 percent, while keeping O(1) queries. They are built by solving a GF(2) linear system over hashed keys using a near-band "ribbon" coefficient matrix from Dietzfelbinger and Walzer. A new on-the-fly Gaussian elimination solver (Rapid Incremental Boolean Banding ON the fly) works much like insertion into a linear-probed hash table, doing row reductions in registers. Like Bloom filters, Ribbon offers near-continuous configurability with no bit-alignment hazards, and Meta expects it to save several percent of RAM in major storage systems at a small CPU cost.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Data structures](https://swe.quest/tags/data-structures.md) (Architecture & design)
- [Algorithms](https://swe.quest/tags/algorithms.md) (Architecture & design)
- [Storage engines](https://swe.quest/tags/storage-engines.md) (Data & databases)

## Prerequisites

- Bloom filters
- Gaussian elimination
- hashing basics

## Keywords

Ribbon filter, Bloom filter, Xor filter, GF(2), Gaussian elimination

## Related posts

- [Space efficient machine learning feature stores using probabilistic data structures - a benchmark](https://swe.quest/articles/space-efficient-machine-learning-feature-stores-using-probabilistic-data-be147985e009951b.md): Zalando Engineering · 2021-10-04 · Medium · 9 min read · ML platforms, Data structures, Recommendations & ranking, Machine learning
  A Bloom-filter-backed in-process feature store matched a conventional key-value feature store's click-prediction accuracy (AUC ≈0.7997 vs ≈0.80) using about 3% of the memory (470MB vs 15GB).
- [Don’t stop early: Case-folding source code at memory speed](https://swe.quest/articles/don-t-stop-early-case-folding-source-code-at-memory-speed-d9a0d3aa3df1f3f4.md): GitHub Engineering · 2026-07-31 · Hard · 18 min read · Performance engineering, Rust, Search, Algorithms, Data structures
  GitHub's Blackbird code search case-folds every byte of 480TB of source, and the fastest ASCII path came from removing the early exit at the first non-ASCII byte.
- [Approximate nearest neighbor search with DiskANN in libSQL](https://swe.quest/articles/approximate-nearest-neighbor-search-with-diskann-in-libsql-f704916b9c7db474.md): Turso · 2024-07-26 · Medium · 7 min read · Vector search, SQLite, Storage engines, Algorithms
  libSQL implements approximate nearest neighbor search using LM-DiskANN, a low-memory variant of DiskANN.
- [Engineering stories behind the Medium Daily Digest Algorithm: Part 2](https://swe.quest/articles/engineering-stories-behind-the-medium-daily-digest-algorithm-part-2-d64641974e16e6ff.md): Medium Engineering · 2025-08-28 · Medium · 17 min read · Recommendations & ranking, Data structures, Cost optimization, Databases
  Medium replaced the Bloom filters behind its recommendation filters (muted writers, already-read, presented 3+ times) with per-user DynamoDB queries against the source-of-truth tables, cutting filtering cost roughly 10x and simplifying maintenance.
- [The space complexity of vector indexes in LibSQL](https://swe.quest/articles/the-space-complexity-of-vector-indexes-in-libsql-c0acaa3c84f4d05b.md): Turso · 2024-10-03 · Medium · 5 min read · Vector search, SQLite, Mobile, RAG & retrieval
  LibSQL's built-in vector index uses LM-DiskANN, a disk-oriented graph ANN algorithm that stores neighbor graphs in shadow tables.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
