The Spectrum Dispatch News

technology

How Hacker News ranks stories: scoring, penalties and controversy

A 2013 analysis details the formula behind Hacker News rankings including time decay, vote weighting, automatic and controversy penalties.

How Hacker News ranks stories: scoring, penalties and controversy

The article explains that Hacker News scores each submission using three factors: the number of upvotes, the elapsed time since submission, and various penalty multipliers. Because the time factor has a higher exponent than the vote factor—referred to as gravity—an article’s raw score will eventually fall to zero, preventing any story from staying on the front page indefinitely. Rankings are not recomputed on every page load; instead, a story is re‑ranked only when it receives a new upvote, moving it to its appropriate position while leaving the rest of the list unchanged. To counter the possibility of a stalled story remaining high, the system selects one of the top 50 stories every 30 seconds at random and re‑ranks it, and pages may be cached for up to 90 seconds. A visualisation of raw scores (excluding penalties) for the top 60 articles on a typical day shows that scores rise quickly after submission and then decline gradually over many hours. The steepest part of the curve reflects both the voting pattern—many upvotes arrive in the first hour or two—and the scoring formula, which gives a constant vote rate a rapid peak followed by a slow descent. The article notes that the story with the highest raw score is not always the one displayed at position #1 because penalties can shift rankings. Examples cited include “Getting website registration completely wrong,” which lost the top spot after a controversy penalty, and “Apple Maps,” which fell from #1 shortly after reaching it. Other stories such as “Why you should never use MongoDB” and “Severing ties with the NSA” were heavily penalised despite high vote totals, while “$4.1m goes missing” was penalised near the end of the day even though it would have lost the top spot to another story automatically. Automatic penalties are applied based on title keywords and domain names. Any submission containing the string “NSA” in its title receives a penalty factor of 0.4. A range of popular domains—including arstechnica.com, businessinsider.com, github.com, imgur.com, medium.com, quora.com, reddit.com, stackexchange.com, theguardian.com, theverge.com, youtube.com and others—are observed to incur automatic penalties between 0.25 and 0.8, a measure intended to offset the tendency of prolific submissions from high‑traffic sites. The controversy penalty targets posts that attract many comments relative to upvotes. When a story has more comments than upvotes and at least 40 comments, it is scaled by (votes/comments)²; the author suspects the exponent may actually be 3 based on observed data. This penalty can be sudden and severe: an article that was ranked #5 fell to #22 the moment it passed 40 comments, and another story disappeared from the top 60 entirely at the same threshold. The impact of a penalty factor can be expressed in vote‑equivalent terms: a factor of 0.4 makes each vote count as only 0.3 votes, causing the article’s rank to drop 66 % faster than normal, while a factor of 0.1 reduces each vote to 0.05 votes, accelerating the decline 3.6‑fold. To gather the data, the author crawled the /news and /news2 pages once per minute, staying under the site’s two‑pages‑per‑minute guideline. The HTML was parsed with Beautiful Soup, processed with Python scripts, and visualised using matplotlib. By computing raw scores for the top ten stories at a given moment—for example, 2.802 for “Pyret: A new programming language from the creators of Racket” and 1.407 for “The Big Data Brain Drain: Why Science is in Trouble”—and comparing them to actual positions, the analysis inferred penalty factors for stories that appeared lower than their scores predicted.

How Hacker News ranks stories: scoring, penalties and controversy

Key facts

Sources

← All posts