Facemash
algorithm
Mark Zuckerberg
social media history
computer science

Facemash algorithm: how the Elo rating ranked photos

Codemia Knowledge Hub ·

Facemash ranked photos with a formula that resembles the Elo rating system used in chess: every photo has a rating, each vote is treated as a match between two photos, and the winner takes points from the loser, more of them when the result is an upset. Mark Zuckerberg built the site in 2003 as a Harvard sophomore, before Facebook existed. It showed two student photos side by side and asked users to vote on who was "hotter."

How the rating works

  1. Initialization: each photo starts with a median number of points, possibly 1400 to match a common Elo starting value.
  2. Comparison and voting: • Two photos appear side by side. • A user votes for the "hotter" one.
  3. Score adjustment: • Both photos' scores are adjusted after the vote. • If the higher-ranked photo wins, both scores change slightly. • If the lower-ranked photo wins, it gains more points and the other loses more.

A simplified form of the Elo calculation:

E_A=11+10(R_B−R_A)/400E\_A = \frac{1}{1 + 10^{(R\_B - R\_A) / 400}}

Where: • EAE_A is the expected score of photo A. • RAR_A and RBR_B are the current ratings of photos A and B.

The new ratings RA′R'_A and RB′R'_B are:

R′_A=R_A+K×(S_A−E_A)R'\_A = R\_A + K \times (S\_A - E\_A)

R′_B=R_B+K×(S_B−E_B)R'\_B = R\_B + K \times (S\_B - E\_B)

SAS_A and SBS_B are the actual scores (1 for a win, 0 for a loss, 0.5 for a tie), and KK is a constant that sets how much one result counts, often 32.

Worked example

Two photos, A and B: • Initial ratings: RA=1400R_A = 1400, RB=1400R_B = 1400 • The user votes for A.

Expected scores: • EA=0.5E_A = 0.5, EB=0.5E_B = 0.5

After A wins: • RA′=1400+32×(1−0.5)=1416R'_A = 1400 + 32 \times (1 - 0.5) = 1416 • RB′=1400+32×(0−0.5)=1384R'_B = 1400 + 32 \times (0 - 0.5) = 1384

A gains 16 points and B loses 16, reflecting the vote.

Technical strengths and ethical problems

  1. Simplicity: ranking algorithms like this are simple, versatile and efficient.
  2. Scalability: the approach keeps working as more photos are added.
  3. Ethics: ranking people by appearance raises serious concerns, and the site drew a strong backlash over privacy and the objectification of students.
  4. Engagement data: Facemash was an early example of using social data to drive engagement, a precursor to later social media algorithms.
  5. Privacy: it used photos without permission, which led to Harvard taking disciplinary action against Zuckerberg.

Key points

FeatureExplanation
Algorithm TypeComparison-based; resembles Elo rating system
Initial Rating1400 points for each photo (or standard initial rating)
Rating AdjustmentBased on user votes and expected results
Expected OutcomeCalculates likelihood of each photo being preferred
BenefitsSimple, scalable for numerous data points
Ethical ConcernsObjectification and privacy issues with unsanctioned photographs
LegacyEarly exploration in data-driven social interaction algorithms

Course
Intermediate
27 lessons
15 hours
DSA Fundamentals

Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.

View the course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms