210 likes | 223 Views
Explore how to effectively annotate and query web entities using MapReduce for improved entity recognition and retrieval in large-scale data environments. Learn the key concepts of lemma mapping, entity disambiguation, and scalable entity catalog management.
E N D
Web-scale Entity Annotation Using MapReduce Shashank Gupta IIT Bombay VarunChandramouliNetapp India Soumen ChakrabartiIIT Bombay
Querying the Web of objects Target type Response entity • jaden smith debut movie • Jaden Christopher SyreSmith (born July 8, 1998) is an American child-actor, ... Smith made his major role debut in the 2006 film The Pursuit of Happynessas ... • His parents are the actors Will Smith and JadaPinkett-Smith, and singer Willow Smith is his younger sister. Smith made his acting debut in the 2006 film The Pursuit of Happyness… • What was Jaden Smith's first movie? pursuit of happynesswith his dad he was 6 years old. What is Jaden Smith favorite movie? Karate Kid,Men In Black… • In 2006 Jaden made his film debut in the Sony release The Pursuit of Happyness, playing his father's son. When Will was reading the script… Match these imdb.com/title/tt0454921/ Entity ID
What’s needed to support such queries? • Annotate token span in Web corpus as a mention of entity from large catalog • Index these annotations like regular tokens • E.g., imdb.com/title/tt0454921/ mentioned at token offsets 48…51 of doc ID … • Also encode that imdb.com/title/tt0454921/ isA type=movie • “Jaden smith debut movie” can be translated to “find docs containing snippets where jaden, smith, debut and a movie instance appear within 5 token window” • Merge postings across types, entities and regular tokens during query time • Aggregate over instantiations of the target type.
Definitions: Lemma, entity, spot, model • A lemma is any word or phrase known to refer to an entity • Lemma to entity map is many-to-many • A spot is an occurrence of a lemma embedded in a textual context • The mention in a spot can be disambiguated to one of several candidate entities • Involves machine learnt models that need to be in RAM during disambiguation Michael Basketball player Jordan Swimmer Country River Michael scored a goal in the last minute and lead team to the victory 4
The Bulgaria national football team is the national football team of Bulgaria and is controlled by the Bulgarian Football Union. Bulgaria's best World Cup performance was in the 1994 World Cup in USA, Spotter Dictionary The Bulgaria national football team is the national football team of Bulgaria and is controlled by the Bulgarian Football Union. Bulgaria's best World Cup performance was in the 1994 World Cup in USA, Spots FeatureExtractor Indexer Indexer Annotator Corpus CFVs Disambiguator ModelBuffer (DocId, TokenSpan, EntId, Confidence) Annotations CSAW v.1 5
Scaling up the entity catalog • Can never respond with entity that is not in catalog • Wikipedia: 2—4 M entities;Freebase: >40 M entities • Crisis: total lemma disambiguation model space • scales with number of entities • becomes larger than typical RAM • Wikipedia: 2.2 GB; Freebase: est. >30 GB • Cannot hold all lemma models in RAM and stream through Web corpus from disk, as in v.1 • Also need much RAM for buffering index runs, can’t afford to spend it all on lemma models
Talk outline • Need to scale entity catalog • Lemma models need too much RAM • Cheap tricks that didn’t work • Bin packing • Per-host caching of models from disk • Distributed memcache • Overhauling code into map-reduce framework • Skew problem • Mitigation via key splitting
Bin packing • Partition lemma models into minimum number of disjoint subsets • Each partition must fit in RAM • Make multiple passes over the corpus loading up a different partition each time • Delivered impractical performance • Work to convert a document into CFVs is repeated • Quite comparable to the disambiguation work itself.
Local model cache • Single pass over the corpus + load models on demand • Maintain a cache of models with suitable eviction policy to reduce disk accesses. • Delivered impractical performance • Inherent randomness of lemmas over the corpus lead to low cache hit rate. • Too high lemma spotting rate.
Models in distributed memcache Document Document Spotter Store 1 Spotter Spots Spots FeatureExtractor FeatureExtractor Store 2 CFVs CFVs Disambiguator Store 3 Disambiguator ModelBuffer Annotations Annotations Indexer Store N Indexer Index Index
Scatter CFVs to disambiguators specialized to subsets of lemmas Document Spotter Disambiguator 1 Indexer Annotations Index Spot FeatureExtractor Disambiguator 2 Indexer Annotations Index CFV SchedulingLogic Disambiguator 3 Indexer Annotations Index Disambiguator N Indexer Annotations Index 11
If CFVs sorted during shuffle, then need only one lemma model in RAM at a time Document Spotter Disambiguator 1 Indexer Annotations Index Spots FeatureExtractor Disambiguator 2 Indexer Annotations Index CFVs SchedulingLogic Disambiguator 3 Indexer Annotations Index Sort &Group Disambiguator N Indexer Annotations Index 12
Preliminary Measurements • Distribution of number of CFVs per lemma is highly skewed. • Distribution of work per lemma is highly skewed as well. How to schedule these jobs? 13
Greedy Scheduling: Performance Job Completion Time (Only CPU): 14hours 32mins 14
Document Spotter Reducer 1 Disambiguator 1 Indexer Annotations Index Mapper M Spots FeatureExtractor Reducer 2 Disambiguator 2 Indexer Annotations Index CFVs Mapper M Reducer 3 SchedulingLogic Disambiguator 3 Indexer Annotations Index Mapper M Sort &Group Reducer N Disambiguator N Indexer Annotations Index 15
Vanilla Hadoop • Rely on Hadoop’s default key packing strategy:- • Job Completion Time: 20hours 19min Is it possible to obtain better packing of jobs? 16
Talk outline • Need to scale entity catalog • Cheap tricks that didn’t work • Overhauling code into map-reduce framework • Skew problem (hot and cold lemmas) • SkewTune: negligible improvement • Mitigation via key splitting - replicate hot lemma models over multiple disambiguator hosts
Total disambiguationCPU work for lemma Work for hottest lemma Average work per CPU Within a factor of 11/P of optimal schedule Avg work afterpartitioning Reducedskew + Scheduling objective • Split work of lemma into partitions • Scheduling overhead per partition = c • How to select number of partitions for each lemma • Approx algo with guarantee; • All-or-One good in practice
Custom Partitioner: Performance Job Completion Time: 3hours 47mins 5.4x faster than standard Hadoop MR, and 5.2x faster than even Skewtune 19
Generalization • Can be used for any application in general • Sample data offline and obtain estimates of work. • Add application specific costs to the objective. • Optimize the objective to obtain optimal replication per key. • Schedule greedily. • Use partition function to implement the schedule.