Design Near-Duplicate Image Detection for Uploaded Photos

Last updated: November 29, 2026

Quick Overview

Design a service that checks every photo uploaded to Facebook and Instagram against a database of known images (for example previously removed violating content) and flags near duplicates, even after cropping, resizing, or recompression.

Meta
System Design
Software Engineer
Meta
November 29, 2026
Software Engineer
Phone Screen
System Design
Easy

0

0

0 solved


Design a service that checks every photo uploaded to Facebook and Instagram against a database of known images (for example previously removed violating content) and flags near duplicates, even after cropping, resizing, or recompression.

Meta open sourced perceptual hashing for this purpose, and integrity infrastructure is a common interview domain. The interviewer checks that you choose perceptual over cryptographic hashes and can design a fast Hamming-distance lookup at upload rate.

What the Interviewer Expects
  • Explain why cryptographic hashes fail for near duplicates
  • Use a perceptual hash and Hamming distance threshold
  • Design a scalable lookup for nearest hashes
  • Place the check in the upload path with a latency budget
  • Handle threshold tuning and false positives
Key Topics to Cover
Perceptual hashing
Hamming distance
Multi-index hashing
Integrity pipeline
Thresholds
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you search 1 billion 256-bit hashes for distance under 30 quickly?
  • What about a mirrored or heavily cropped image?
  • Should the check block the upload or run asynchronously?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: compute a fingerprint per uploaded photo; compare against a bank of known fingerprints; on match, take the action attached to that bank entry (block, send to review, label).

**Non-fun...

High-Level Design

On upload, the media service computes a perceptual hash (256 bits from a DCT of a downscaled grayscale image) and calls the match service. The match service returns the closest bank entries wi...


Submit Your Answer
Markdown supported