There're two posts on Facebook's engineering blog that discuss this (they're from 2013 when they first started working on the feature):
https://www.facebook.com/notes/facebook-engineering/under-th...
https://www.facebook.com/notes/facebook-engineering/under-th...