ArticleslgStudy

mathematics

SimHash

SimHash is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand SimHash rather than just read about it. In short: In computer science, SimHash is a technique for quickly estimating how similar two sets are. The algorithm is used by the Google Crawler to find near duplicate pages.

Key takeaways

  • SimHash belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect SimHash to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of SimHash from memory before moving on to harder problems.

Reference excerpt

In computer science, SimHash is a technique for quickly estimating how similar two sets are. The algorithm is used by the Google Crawler to find near duplicate pages. It was created by Moses Charikar. In 2021 Google announced its intent to also use the algorithm in their newly created FLoC (Federated Learning of Cohorts) system.

Implementation A hash function maps arbitrary data onto outputs of a fixed size. Hashing the same data produces the same result each time; a different hash output implies a distinct input. This, along with their fixed size, makes hashes useful for the comparison of large data. However, small differences in input data can yield significantly different hashes. Hash comparison is a binary signal (different or not), rather than a continuous similarity measure. In contrast, SimHash creates hashes that produce similar hashes for similar input data, measured as the bitwise hamming distance between values. This means that not only do SimHashes indicate whether two inputs are different or not, but also their degree of difference, unlike other hashing functions. The function operates by first breaking input data into a set of features. Each feature in the set is then hashed. The overall hash is defined by, for each bit within the input hashes, subtracting the count of hashes where the bit is not set (0) from the count of hashes where the bit is set (1). For indices of the hash where the difference is positive, the bit is set. For indices with a greater number of bits not set, the bit at that index in the final hash is not set. In other words, each bit of the SimHash of a datum is set if, for each hash of the set of features in that datum, the sum of bits at that index is greater than the sum of the bitwise NOT of bits at that index.

Use cases As a result, two pieces of data with similar feature sets will have hashes that differ less than data where the sets of features diverge further. Additionally, "if the SimHash bitwise hamming distance of two phrases is low then their Jaccard coefficient is high." This allows for efficiencies including more efficient sorting (by comparing objects' SimHashes, rather than the entire object) and faster discovery of similar objects by sorting a list and comparing adjacent objects rather than the O(n^2) computation of each comparison in the list.

Evaluation and benchmarks A large scale evaluation has been conducted by Google in 2006 to compare the performance of Minhash and Simhash algorithms. In 2007 Google reported using Simhash for duplicate detection for web crawling and using Minhash and LSH for Google News personalization.

See also MinHash w-shingling Count–min sketch Locality-sensitive hashing

References

External links Simhash Princeton Paper Simhash explained Comparison of MinHash vs. Simhash

Worked examples

Example 1 — a first encounter with SimHash

Start with the simplest possible case. Write down what SimHash claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to SimHash before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about SimHash ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of SimHash

In research
SimHash appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses SimHash in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
SimHash is common in secondary-school and first-year university syllabi. It links to neighbouring topics Clustering criteria, Hash functions, Hashing, so understanding it makes those chapters shorter.
In everyday life
Look for SimHash outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study SimHash in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what SimHash means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain SimHash out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is SimHash in simple terms?

In computer science, SimHash is a technique for quickly estimating how similar two sets are. The algorithm is used by the Google Crawler to find near duplicate pages.

Why does SimHash matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study SimHash?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on SimHash.

Tags

  • Clustering criteria
  • Hash functions
  • Hashing
  • Probabilistic data structures

Keep exploring