How trends come to life on Twitter is fascinating

Here is a fascinating insight from the Twitter engineers on how your searches on Twitter become trending topics

So an event happens, people instantly come to Twitter to search for the event, and we need to teach our systems what these queries mean as quickly as we can — because in just a few hours, the search spike will be gone.


How do we do this? We’ve built a real-time human computation engine to help us identify search queries as soon as they're trending, send these queries to real humans to be judged, and then incorporate the human annotations into our back-end models.



Before we delve into the details, here's an overview of how the system works.

  1. First, we monitor for which search queries are currently popular.Behind the scenes: we run a Storm topology that tracks statistics on search queries.For example, the query [Big Bird] may suddenly see a spike in searches from the US.

  2. As soon as we discover a new popular search query, we send it to our human evaluators, who are asked a variety of questions about the query.Behind the scenes: when the Storm topology detects that a query has reached sufficient popularity, it connects to a Thrift API that dispatches the query to Amazon's Mechanical Turk service, and then polls Mechanical Turk for a response.For example: as soon as we notice "Big Bird" spiking, we may ask judges on Mechanical Turk to categorize the query, or provide other information (e.g., whether there are likely to be interesting pictures of the query, or whether the query is about a person or an event) that helps us serve relevant Tweets and ads.

  3. Finally, after a response from an evaluator is received, we push the information to our backend systems, so that the next time a user searches for a query, our machine learning models will make use of the additional information. For example, suppose our evaluators tell us that [Big Bird] is related to politics; the next time someone performs this search, we know to surface ads by @barackobama or @mittromney, not ads about Dora the Explorer.

After much research and testing Twitter have decided to work with a hybrid human/mechanical system to ensure topics are elevated in real time. For the news to break on Twitter they have to be fast. The only way to do that judgement is with humans, forums, chatrooms and internal discussions.

Behind the scenes every tweet is being monitored, every search is being analysed so your timeline is rich, real time and relevant.