SlideShare a Scribd company logo
1 of 31
RELXSearchSummIt2018RELXSearchSummIt2018
Learning to Rank
Sujit Pal, Elsevier Labs
September 25-27, 2018
What it is, how it’s done, and what it can do for you
RELXSearchSummIt2018
Outline
• History
• Problem setup
• Learning to Rank Algorithms
• Practical Considerations
• LTR Case Studies (Solr, Elasticsearch, DIY)
• Wrap Up
Learning to Rank - what it is, how it's done, and what it can do for you 2
RELXSearchSummIt2018
History
• 1992: Idea of LTR (or Machine Learned Ranking) first proposed
• 2003: Altavista (later acquired by Yahoo!) using LTR in its engine
• 2005: Microsoft invents RankNet, deploys in Bing
• 2008: In contrast, Google’s engine hand tuned, relies on up ~200 signals
• 2009: Yandex invents and deploys MatrixNet in its engine
• 2016: Google says RankBrain is #3 signal to its search engine
• 2016: Bloomberg contributes LTR plugin to Solr
• 2017: Open Source Connections contributes LTR plugin in Elasticsearch
Learning to Rank - what it is, how it's done, and what it can do for you 3
RELXSearchSummIt2018
Problem Setup
Learning to Rank - what it is, how it's done, and what it can do for you 4
RELXSearchSummIt2018
LTR Pipeline
Learning to Rank - what it is, how it's done, and what it can do for you 5
Image Credit: https://towardsdatascience.com/when-to-use-a-machine-learned-vs-score-based-search-ranker-aa8762cd9aa9
• Training: Build LTR
model using training
data (query, document,
label) triples
• Label is rank
• Inference: Use model to
predict label ŷ = h(x)
from unseen (query,
document) pairs
RELXSearchSummIt2018
Difference between search and LTR
• Search engines
• Use text based relevance – TF-IDF, BM25, etc.
• Unsupervised, backed by statistical models.
• LTR
• Can support different (application specific) notions of relevance. For example:
• Recommendations – depends on price, geolocation or user ratings.
• Question Answering – best text match might not return best answer, right set of features
may be hard to articulate explicitly.
• Supervised technique, needs labeled data to train.
• Just a re-ranker, search layer must return results to re-rank.
Learning to Rank - what it is, how it's done, and what it can do for you 6
RELXSearchSummIt2018
Difference between ML and LTR
• ML solves a prediction problem (classification or regression) for a
single instance at a time.
• LTR solves a ranking problem for a list of items – objective is to find an
optimal ordering of items.
Learning to Rank - what it is, how it's done, and what it can do for you 7
RELXSearchSummIt2018
Reasons to consider LTR
• Too many parameters to tune manually without overfitting to
particular query set.
• Ranking requirements not being met with traditional text based
search tools (including use of metadata fields).
• Availability of enough (implicit or explicit) good training data to train
LTR model.
Learning to Rank - what it is, how it's done, and what it can do for you 8
RELXSearchSummIt2018
Learning to Rank Algorithms
Learning to Rank - what it is, how it's done, and what it can do for you 9
RELXSearchSummIt2018
Traditional Ranking Models
• Vector Space Models
• Boolean – predicts if document relevant to query or not
• TF-IDF – rank documents by cosine similarity between document and query
• Probabilistic Models
• BM25 – rank documents by log odds of relevance to query
• LMIR – probability of document’s LM generating terms in query
• Importance based Models
• HITS – rank documents by hubness/authority (inlinks/outlinks).
• PageRank – rank document by probability of random surfer arriving on page
• Impact Factor – rank documents by number of citations
Learning to Rank - what it is, how it's done, and what it can do for you 10
RELXSearchSummIt2018
Evaluation Metrics
• Mean Average Precision (MAP
@k)
• Mean Reciprocal Rank (MRR)
Learning to Rank - what it is, how it's done, and what it can do for you 11
• Normalized Discounted
Cumulative Gain (NDCG @k)
• Rank Correlation
RELXSearchSummIt2018
High Level Taxonomy of LTR Algorithms
• Pointwise – documents ranked by relevance of each (query,
document) pair
• Pairwise – documents ranked by considering priority between pairs of
(query, document) pairs
• Listwise – documents ranked by considering the entire relevance
ordering of all (query, Documents) tuples per query
Learning to Rank - what it is, how it's done, and what it can do for you 12
RELXSearchSummIt2018
Pointwise Approach
• Input: (query, document) pair (q, d)
• Output: score indicating rank on result list
• Model: 𝒇(q, d) → score
• Regression problem (in case of numeric scores) or Classification
problem (in case of relevant/irrelevant, or multi-level classes like
Perfect/Excellent/Good/Fair/Bad)
• Ordinal regression: include ordinal relationship between labels.
• Examples: SLR (Staged Logistic Regression), Pranking
Learning to Rank - what it is, how it's done, and what it can do for you 13
RELXSearchSummIt2018
Pairwise Approach
• Input: triples of (query, document pairs) (q, dA, dB)
• Output: one of [-1, 1]
• Model: 𝒇(q, dA, dB) → [-1, 1]
• Classification problem, learn binary classifier to predict [-1, 1] for a
given pair of (query, document pair) triples
• Goal is to minimize average number of inversions in ranking
• Examples: RankNet, RankSVM, LambdaMART
Learning to Rank - what it is, how it's done, and what it can do for you 14
RELXSearchSummIt2018
Listwise Approach
• Input: (query, Documents {d1, d2, …, dN})
• Output: desired ranked list of documents 𝕯
• Model: 𝒇(q, {d1, d2, …, dN}) → 𝕯
• Classification problem, with indirect loss functions such as
RankCosine or KL Divergence, or smoothing IR measures (since not
directly differentiable) and applying Gradient Descent
• Examples: AdaRank, ListNET, RankCosine, SVMMap
Learning to Rank - what it is, how it's done, and what it can do for you 15
RELXSearchSummIt2018
Commonly used Algorithms
• Linear Model
• Predicted rank is linear combination of input features
• RankNet
• Neural network based
• Good for binary (relevant/irrelevant) labels
• Weight matrix transforms input features into rank probabilities
• LambdaMART
• Tree (forest) based
• Good for multi-class labels
• Feature splits with thresholds
Learning to Rank - what it is, how it's done, and what it can do for you 16
RELXSearchSummIt2018
Practical Considerations
Learning to Rank - what it is, how it's done, and what it can do for you 17
RELXSearchSummIt2018
Acquiring labels
• Implicit
• Intrinsic features (words, phrases)
• Document metadata
• User Clicks
• Time spent on document
• Purchases (if applicable)
• Cheap to build but noisy
• Explicit
• Human expert rates relevancy of each document against query
• Cleaner but expensive to build
Learning to Rank - what it is, how it's done, and what it can do for you 18
RELXSearchSummIt2018
Feature Selection
• Document Features
• Document Length
• URL Length
• Publication Date
• Number of outlinks
• PageRank
• Query Features
• Number of words
• PER or ORG in query
Learning to Rank - what it is, how it's done, and what it can do for you 19
• Query-Document Features
• TF-IDF, BM25 similarity
• Frequency of query in anchor
text
• Document contains query words
in title
• User Dependent Features
• Star ratings
• Age, gender
• Device
RELXSearchSummIt2018
Unbalanced Datasets
• If dataset is unbalanced, i.e., classes are not represented
approximately equally, then use under- or oversampling to balance.
• Consider using something like SMOTE for oversampling instead of
naïve oversampling by duplication.
• Make sure no data leakage in case of oversampling.
Learning to Rank - what it is, how it's done, and what it can do for you 20
RELXSearchSummIt2018
LTR used as re-ranker
• LTR models are usually more
computationally expensive than
search engines.
• Search engine used to pull out
matched documents
• Top-N of these documents are fed into
the LTR model and top-n of those are
replaced with the output of the
model, for N >> n (typically 50-100x).
Learning to Rank - what it is, how it's done, and what it can do for you 21
Index
Query
Matched
(10k)
Scored
(10k)
Top 1000
retrieved
Re-ranked
Top 10
Ranking
Model
Image Credit: https://lucidworks.com/2016/08/17/learning-to-rank-solr/
RELXSearchSummIt2018
LTR Algorithm Implementations
• RankLib (Java) – from Lemur Project (UMass, CMU), provides
Coordinate Ascent, Random Forest (pointwise), MART, RankNet,
RankBoost (pairwise), LambdaMART (pair/listwise), AdaRank and
ListNet (listwise)
• SVMRank (C++) – from Cornell, provides SVMRank (pairwise)
• XGBoost (Python/C++) – LambdaRank (pairwise)
• PyLTR (Python) – LambdaMART (pairwise)
• Michael Alcorn (Python) – RankNet and LambdaMART (pairwise)
Learning to Rank - what it is, how it's done, and what it can do for you 22
RELXSearchSummIt2018
LETOR Data Format
2 qid:1 1:3 2:3 3:0 4:0 5:3 6:1 7:1 8:0 9:0 10:1 11:156... # 11
2 qid:1 1:3 2:0 3:3 4:0 5:3 6:1 7:0 8:1 9:0 10:1 11:406... # 23
0 qid:1 1:3 2:0 3:2 4:0 5:3 6:1 7:0 8:0.666667 9:0 10:1 ... # 44
2 qid:1 1:3 2:0 3:3 4:0 5:3 6:1 7:0 8:1 9:0 10:1 11:287 ... # 57
1 qid:1 1:3 2:0 3:3 4:0 5:3 6:1 7:0 8:1 9:0 10:1 11:2009 ... # 89
Learning to Rank - what it is, how it's done, and what it can do for you 23
label
Query ID
Features: query, document, query/document, other
(sparse or dense format)
Comments (ex: docID)
RELXSearchSummIt2018
Case Studies
Learning to Rank - what it is, how it's done, and what it can do for you 24
RELXSearchSummIt2018
Preprocessing Data
• We use The Movie Database (TMDB) from Kaggle.
• 45k movies, 20 genres, 31k unique keywords
• We extract following fields: (docID, title, description, popularity,
release date, running time, rating (0-10), keywords, genres)
• Categorical labels 1-5 created from rating
• Objective is to build LTR model that learns the ordering implied by
rating and re-rank top 10 results using this model
• Features chosen: (query-title and query-description similarity using
TF-IDF and BM25, document recency, original score, and boolean 0/1
for each genre)
Learning to Rank - what it is, how it's done, and what it can do for you 25
RELXSearchSummIt2018
LTR with Solr
• Prepare Solr for LTR (add snippet to solrconfig.xml) and start with
solr.ltr.enabled=True
• Load data
• Define LTR features to be used to Solr
• Define dummy linear model to use Solr to extract features (rq) for some
queries to LETOR format
• Train RankLib LambdaMART model using extracted features
• Upload trained model definition to Solr
• Run Solr re-rank query (rq) using trained LTR model
• See notebooks – 02-solr/01 .. 04
Learning to Rank - what it is, how it's done, and what it can do for you 26
RELXSearchSummIt2018
LTR with Elasticsearch
• Install LTR plugin and load data
• Initialize feature store
• Define features – load feature templates into Elasticsearch
• Extract features (sltr) to LETOR format
• Train RankLib model (also supported natively XGBoost, SVMRank).
• Upload trained LTR model to Elasticsearch
• Run re-rank query (rescore) using trained LTR model
• See notebooks – 03-elasticsearch/01 .. 04
Learning to Rank - what it is, how it's done, and what it can do for you 27
RELXSearchSummIt2018
DIY LTR – Index Agnostic
• Run queries, generate features from results to LETOR format
• Train RankLib (or other third party LTR) model
• Run re-rank query on trained model
• Merge output of re-rank with actual results from index
• See notebooks – 04-ranklib/02..04
• Pros: index agnostic; more freedom to add novel features
• Cons: less support from index
Learning to Rank - what it is, how it's done, and what it can do for you 28
RELXSearchSummIt2018
Wrapping Up
Learning to Rank - what it is, how it's done, and what it can do for you 29
RELXSearchSummIt2018
Resources
• Book – Learning to Rank for Information Retrieval, by Tie-Yan Liu.
• Paper – From RankNet to LambdaRank to LambdaMART: An
Overview, by Christopher J. C. Burges
• Tutorials
• Solr - https://github.com/airalcorn2/Solr-LTR
• Elasticsearch – Learning to Rank 101 by Pere Urbon-Bayes, ES-LTR Demo by
Doug Turnbull.
• Product Centric LTR Documentation
• Solr Learning To Rank Docs
• Elasticsearch Learning to Rank Docs
Learning to Rank - what it is, how it's done, and what it can do for you 30
RELXSearchSummIt2018
Thank you!
• Contact: sujit.pal@elsevier.com
Learning to Rank - what it is, how it's done, and what it can do for you 31

More Related Content

What's hot

Query Understanding at LinkedIn [Talk at Facebook]
Query Understanding at LinkedIn [Talk at Facebook]Query Understanding at LinkedIn [Talk at Facebook]
Query Understanding at LinkedIn [Talk at Facebook]
Abhimanyu Lad
 
W3C Tutorial on Semantic Web and Linked Data at WWW 2013
W3C Tutorial on Semantic Web and Linked Data at WWW 2013W3C Tutorial on Semantic Web and Linked Data at WWW 2013
W3C Tutorial on Semantic Web and Linked Data at WWW 2013
Fabien Gandon
 
Semantic Content Networks - Ranking Websites on Google with Semantic SEO
Semantic Content Networks - Ranking Websites on Google with Semantic SEOSemantic Content Networks - Ranking Websites on Google with Semantic SEO
Semantic Content Networks - Ranking Websites on Google with Semantic SEO
Koray Tugberk GUBUR
 
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEOSearch Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
Koray Tugberk GUBUR
 
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
Koray Tugberk GUBUR
 
Lexical Semantics, Semantic Similarity and Relevance for SEO
Lexical Semantics, Semantic Similarity and Relevance for SEOLexical Semantics, Semantic Similarity and Relevance for SEO
Lexical Semantics, Semantic Similarity and Relevance for SEO
Koray Tugberk GUBUR
 

What's hot (20)

Learn to Rank search results
Learn to Rank search resultsLearn to Rank search results
Learn to Rank search results
 
How to Build a Semantic Search System
How to Build a Semantic Search SystemHow to Build a Semantic Search System
How to Build a Semantic Search System
 
Rated Ranking Evaluator (FOSDEM 2019)
Rated Ranking Evaluator (FOSDEM 2019)Rated Ranking Evaluator (FOSDEM 2019)
Rated Ranking Evaluator (FOSDEM 2019)
 
Query Understanding at LinkedIn [Talk at Facebook]
Query Understanding at LinkedIn [Talk at Facebook]Query Understanding at LinkedIn [Talk at Facebook]
Query Understanding at LinkedIn [Talk at Facebook]
 
W3C Tutorial on Semantic Web and Linked Data at WWW 2013
W3C Tutorial on Semantic Web and Linked Data at WWW 2013W3C Tutorial on Semantic Web and Linked Data at WWW 2013
W3C Tutorial on Semantic Web and Linked Data at WWW 2013
 
Thought Vectors and Knowledge Graphs in AI-powered Search
Thought Vectors and Knowledge Graphs in AI-powered SearchThought Vectors and Knowledge Graphs in AI-powered Search
Thought Vectors and Knowledge Graphs in AI-powered Search
 
Integrating Spark and Solr-(Timothy Potter, Lucidworks)
Integrating Spark and Solr-(Timothy Potter, Lucidworks)Integrating Spark and Solr-(Timothy Potter, Lucidworks)
Integrating Spark and Solr-(Timothy Potter, Lucidworks)
 
Rated Ranking Evaluator (RRE) Hands-on Relevance Testing @Chorus
Rated Ranking Evaluator (RRE) Hands-on Relevance Testing @ChorusRated Ranking Evaluator (RRE) Hands-on Relevance Testing @Chorus
Rated Ranking Evaluator (RRE) Hands-on Relevance Testing @Chorus
 
Keyword Research and Topic Modeling in a Semantic Web
Keyword Research and Topic Modeling in a Semantic WebKeyword Research and Topic Modeling in a Semantic Web
Keyword Research and Topic Modeling in a Semantic Web
 
Evolution of Search
Evolution of SearchEvolution of Search
Evolution of Search
 
Search Quality Evaluation: a Developer Perspective
Search Quality Evaluation: a Developer PerspectiveSearch Quality Evaluation: a Developer Perspective
Search Quality Evaluation: a Developer Perspective
 
Semantic Content Networks - Ranking Websites on Google with Semantic SEO
Semantic Content Networks - Ranking Websites on Google with Semantic SEOSemantic Content Networks - Ranking Websites on Google with Semantic SEO
Semantic Content Networks - Ranking Websites on Google with Semantic SEO
 
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEOSearch Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
Search Query Processing: The Secret Life of Queries, Parsing, Rewriting & SEO
 
Anatomy of an eCommerce Search Engine by Mayur Datar
Anatomy of an eCommerce Search Engine by Mayur DatarAnatomy of an eCommerce Search Engine by Mayur Datar
Anatomy of an eCommerce Search Engine by Mayur Datar
 
Bill Slawski SEO and the New Search Results
Bill Slawski   SEO and the New Search ResultsBill Slawski   SEO and the New Search Results
Bill Slawski SEO and the New Search Results
 
Learning to rank
Learning to rankLearning to rank
Learning to rank
 
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
Semantic Search Engine: Semantic Search and Query Parsing with Phrases and En...
 
Rated Ranking Evaluator Enterprise: the next generation of free Search Qualit...
Rated Ranking Evaluator Enterprise: the next generation of free Search Qualit...Rated Ranking Evaluator Enterprise: the next generation of free Search Qualit...
Rated Ranking Evaluator Enterprise: the next generation of free Search Qualit...
 
Lexical Semantics, Semantic Similarity and Relevance for SEO
Lexical Semantics, Semantic Similarity and Relevance for SEOLexical Semantics, Semantic Similarity and Relevance for SEO
Lexical Semantics, Semantic Similarity and Relevance for SEO
 
Semantic search Bill Slawski DEEP SEA Con
Semantic search Bill Slawski DEEP SEA ConSemantic search Bill Slawski DEEP SEA Con
Semantic search Bill Slawski DEEP SEA Con
 

Similar to Search summit-2018-ltr-presentation

Relevancy and Search Quality Analysis - Search Technologies
Relevancy and Search Quality Analysis - Search TechnologiesRelevancy and Search Quality Analysis - Search Technologies
Relevancy and Search Quality Analysis - Search Technologies
enterprisesearchmeetup
 

Similar to Search summit-2018-ltr-presentation (20)

Relevancy and Search Quality Analysis - Search Technologies
Relevancy and Search Quality Analysis - Search TechnologiesRelevancy and Search Quality Analysis - Search Technologies
Relevancy and Search Quality Analysis - Search Technologies
 
Disrupting Data Discovery
Disrupting Data DiscoveryDisrupting Data Discovery
Disrupting Data Discovery
 
Data council sf amundsen presentation
Data council sf    amundsen presentationData council sf    amundsen presentation
Data council sf amundsen presentation
 
Search quality in practice
Search quality in practiceSearch quality in practice
Search quality in practice
 
Strata sf - Amundsen presentation
Strata sf - Amundsen presentationStrata sf - Amundsen presentation
Strata sf - Amundsen presentation
 
Semantic framework for web scraping.
Semantic framework for web scraping.Semantic framework for web scraping.
Semantic framework for web scraping.
 
LSESU a Taste of R Language Workshop
LSESU a Taste of R Language WorkshopLSESU a Taste of R Language Workshop
LSESU a Taste of R Language Workshop
 
Combining machine learning and search through learning to rank
Combining machine learning and search through learning to rankCombining machine learning and search through learning to rank
Combining machine learning and search through learning to rank
 
Dice.com Bay Area Search - Beyond Learning to Rank Talk
Dice.com Bay Area Search - Beyond Learning to Rank TalkDice.com Bay Area Search - Beyond Learning to Rank Talk
Dice.com Bay Area Search - Beyond Learning to Rank Talk
 
Case study of Rujhaan.com (A social news app )
Case study of Rujhaan.com (A social news app )Case study of Rujhaan.com (A social news app )
Case study of Rujhaan.com (A social news app )
 
BSSML17 - Deepnets
BSSML17 - DeepnetsBSSML17 - Deepnets
BSSML17 - Deepnets
 
Dynamic Search and Beyond
Dynamic Search and BeyondDynamic Search and Beyond
Dynamic Search and Beyond
 
Reflected intelligence evolving self-learning data systems
Reflected intelligence  evolving self-learning data systemsReflected intelligence  evolving self-learning data systems
Reflected intelligence evolving self-learning data systems
 
Dataiku at SF DataMining Meetup - Kaggle Yandex Challenge
Dataiku at SF DataMining Meetup - Kaggle Yandex ChallengeDataiku at SF DataMining Meetup - Kaggle Yandex Challenge
Dataiku at SF DataMining Meetup - Kaggle Yandex Challenge
 
20181123 dn2018 graph_analytics_k_patenge
20181123 dn2018 graph_analytics_k_patenge20181123 dn2018 graph_analytics_k_patenge
20181123 dn2018 graph_analytics_k_patenge
 
Evolving the Optimal Relevancy Ranking Model at Dice.com
Evolving the Optimal Relevancy Ranking Model at Dice.comEvolving the Optimal Relevancy Ranking Model at Dice.com
Evolving the Optimal Relevancy Ranking Model at Dice.com
 
Azure Databricks for Data Scientists
Azure Databricks for Data ScientistsAzure Databricks for Data Scientists
Azure Databricks for Data Scientists
 
ML Meetup #27 - Data Infrasctructure and Data Access in Nubank
ML Meetup #27 - Data Infrasctructure and Data Access in NubankML Meetup #27 - Data Infrasctructure and Data Access in Nubank
ML Meetup #27 - Data Infrasctructure and Data Access in Nubank
 
Enhancing Enterprise Search with Machine Learning - Simon Hughes, Dice.com
Enhancing Enterprise Search with Machine Learning - Simon Hughes, Dice.comEnhancing Enterprise Search with Machine Learning - Simon Hughes, Dice.com
Enhancing Enterprise Search with Machine Learning - Simon Hughes, Dice.com
 
Knowledge Graph for Machine Learning and Data Science
Knowledge Graph for Machine Learning and Data ScienceKnowledge Graph for Machine Learning and Data Science
Knowledge Graph for Machine Learning and Data Science
 

More from Sujit Pal

Building Learning to Rank (LTR) search reranking models using Large Language ...
Building Learning to Rank (LTR) search reranking models using Large Language ...Building Learning to Rank (LTR) search reranking models using Large Language ...
Building Learning to Rank (LTR) search reranking models using Large Language ...
Sujit Pal
 
Using Graph and Transformer Embeddings for Vector Based Retrieval
Using Graph and Transformer Embeddings for Vector Based RetrievalUsing Graph and Transformer Embeddings for Vector Based Retrieval
Using Graph and Transformer Embeddings for Vector Based Retrieval
Sujit Pal
 
Question Answering as Search - the Anserini Pipeline and Other Stories
Question Answering as Search - the Anserini Pipeline and Other StoriesQuestion Answering as Search - the Anserini Pipeline and Other Stories
Question Answering as Search - the Anserini Pipeline and Other Stories
Sujit Pal
 
Building Named Entity Recognition Models Efficiently using NERDS
Building Named Entity Recognition Models Efficiently using NERDSBuilding Named Entity Recognition Models Efficiently using NERDS
Building Named Entity Recognition Models Efficiently using NERDS
Sujit Pal
 

More from Sujit Pal (20)

Supporting Concept Search using a Clinical Healthcare Knowledge Graph
Supporting Concept Search using a Clinical Healthcare Knowledge GraphSupporting Concept Search using a Clinical Healthcare Knowledge Graph
Supporting Concept Search using a Clinical Healthcare Knowledge Graph
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Building Learning to Rank (LTR) search reranking models using Large Language ...
Building Learning to Rank (LTR) search reranking models using Large Language ...Building Learning to Rank (LTR) search reranking models using Large Language ...
Building Learning to Rank (LTR) search reranking models using Large Language ...
 
Cheap Trick for Question Answering
Cheap Trick for Question AnsweringCheap Trick for Question Answering
Cheap Trick for Question Answering
 
Searching Across Images and Test
Searching Across Images and TestSearching Across Images and Test
Searching Across Images and Test
 
Learning a Joint Embedding Representation for Image Search using Self-supervi...
Learning a Joint Embedding Representation for Image Search using Self-supervi...Learning a Joint Embedding Representation for Image Search using Self-supervi...
Learning a Joint Embedding Representation for Image Search using Self-supervi...
 
The power of community: training a Transformer Language Model on a shoestring
The power of community: training a Transformer Language Model on a shoestringThe power of community: training a Transformer Language Model on a shoestring
The power of community: training a Transformer Language Model on a shoestring
 
Backprop Visualization
Backprop VisualizationBackprop Visualization
Backprop Visualization
 
Accelerating NLP with Dask and Saturn Cloud
Accelerating NLP with Dask and Saturn CloudAccelerating NLP with Dask and Saturn Cloud
Accelerating NLP with Dask and Saturn Cloud
 
Accelerating NLP with Dask on Saturn Cloud: A case study with CORD-19
Accelerating NLP with Dask on Saturn Cloud: A case study with CORD-19Accelerating NLP with Dask on Saturn Cloud: A case study with CORD-19
Accelerating NLP with Dask on Saturn Cloud: A case study with CORD-19
 
Leslie Smith's Papers discussion for DL Journal Club
Leslie Smith's Papers discussion for DL Journal ClubLeslie Smith's Papers discussion for DL Journal Club
Leslie Smith's Papers discussion for DL Journal Club
 
Using Graph and Transformer Embeddings for Vector Based Retrieval
Using Graph and Transformer Embeddings for Vector Based RetrievalUsing Graph and Transformer Embeddings for Vector Based Retrieval
Using Graph and Transformer Embeddings for Vector Based Retrieval
 
Transformer Mods for Document Length Inputs
Transformer Mods for Document Length InputsTransformer Mods for Document Length Inputs
Transformer Mods for Document Length Inputs
 
Question Answering as Search - the Anserini Pipeline and Other Stories
Question Answering as Search - the Anserini Pipeline and Other StoriesQuestion Answering as Search - the Anserini Pipeline and Other Stories
Question Answering as Search - the Anserini Pipeline and Other Stories
 
Building Named Entity Recognition Models Efficiently using NERDS
Building Named Entity Recognition Models Efficiently using NERDSBuilding Named Entity Recognition Models Efficiently using NERDS
Building Named Entity Recognition Models Efficiently using NERDS
 
Graph Techniques for Natural Language Processing
Graph Techniques for Natural Language ProcessingGraph Techniques for Natural Language Processing
Graph Techniques for Natural Language Processing
 
Search summit-2018-content-engineering-slides
Search summit-2018-content-engineering-slidesSearch summit-2018-content-engineering-slides
Search summit-2018-content-engineering-slides
 
SoDA v2 - Named Entity Recognition from streaming text
SoDA v2 - Named Entity Recognition from streaming textSoDA v2 - Named Entity Recognition from streaming text
SoDA v2 - Named Entity Recognition from streaming text
 
Evolving a Medical Image Similarity Search
Evolving a Medical Image Similarity SearchEvolving a Medical Image Similarity Search
Evolving a Medical Image Similarity Search
 
Embed, Encode, Attend, Predict – applying the 4 step NLP recipe for text clas...
Embed, Encode, Attend, Predict – applying the 4 step NLP recipe for text clas...Embed, Encode, Attend, Predict – applying the 4 step NLP recipe for text clas...
Embed, Encode, Attend, Predict – applying the 4 step NLP recipe for text clas...
 

Recently uploaded

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Search summit-2018-ltr-presentation

  • 1. RELXSearchSummIt2018RELXSearchSummIt2018 Learning to Rank Sujit Pal, Elsevier Labs September 25-27, 2018 What it is, how it’s done, and what it can do for you
  • 2. RELXSearchSummIt2018 Outline • History • Problem setup • Learning to Rank Algorithms • Practical Considerations • LTR Case Studies (Solr, Elasticsearch, DIY) • Wrap Up Learning to Rank - what it is, how it's done, and what it can do for you 2
  • 3. RELXSearchSummIt2018 History • 1992: Idea of LTR (or Machine Learned Ranking) first proposed • 2003: Altavista (later acquired by Yahoo!) using LTR in its engine • 2005: Microsoft invents RankNet, deploys in Bing • 2008: In contrast, Google’s engine hand tuned, relies on up ~200 signals • 2009: Yandex invents and deploys MatrixNet in its engine • 2016: Google says RankBrain is #3 signal to its search engine • 2016: Bloomberg contributes LTR plugin to Solr • 2017: Open Source Connections contributes LTR plugin in Elasticsearch Learning to Rank - what it is, how it's done, and what it can do for you 3
  • 4. RELXSearchSummIt2018 Problem Setup Learning to Rank - what it is, how it's done, and what it can do for you 4
  • 5. RELXSearchSummIt2018 LTR Pipeline Learning to Rank - what it is, how it's done, and what it can do for you 5 Image Credit: https://towardsdatascience.com/when-to-use-a-machine-learned-vs-score-based-search-ranker-aa8762cd9aa9 • Training: Build LTR model using training data (query, document, label) triples • Label is rank • Inference: Use model to predict label ŷ = h(x) from unseen (query, document) pairs
  • 6. RELXSearchSummIt2018 Difference between search and LTR • Search engines • Use text based relevance – TF-IDF, BM25, etc. • Unsupervised, backed by statistical models. • LTR • Can support different (application specific) notions of relevance. For example: • Recommendations – depends on price, geolocation or user ratings. • Question Answering – best text match might not return best answer, right set of features may be hard to articulate explicitly. • Supervised technique, needs labeled data to train. • Just a re-ranker, search layer must return results to re-rank. Learning to Rank - what it is, how it's done, and what it can do for you 6
  • 7. RELXSearchSummIt2018 Difference between ML and LTR • ML solves a prediction problem (classification or regression) for a single instance at a time. • LTR solves a ranking problem for a list of items – objective is to find an optimal ordering of items. Learning to Rank - what it is, how it's done, and what it can do for you 7
  • 8. RELXSearchSummIt2018 Reasons to consider LTR • Too many parameters to tune manually without overfitting to particular query set. • Ranking requirements not being met with traditional text based search tools (including use of metadata fields). • Availability of enough (implicit or explicit) good training data to train LTR model. Learning to Rank - what it is, how it's done, and what it can do for you 8
  • 9. RELXSearchSummIt2018 Learning to Rank Algorithms Learning to Rank - what it is, how it's done, and what it can do for you 9
  • 10. RELXSearchSummIt2018 Traditional Ranking Models • Vector Space Models • Boolean – predicts if document relevant to query or not • TF-IDF – rank documents by cosine similarity between document and query • Probabilistic Models • BM25 – rank documents by log odds of relevance to query • LMIR – probability of document’s LM generating terms in query • Importance based Models • HITS – rank documents by hubness/authority (inlinks/outlinks). • PageRank – rank document by probability of random surfer arriving on page • Impact Factor – rank documents by number of citations Learning to Rank - what it is, how it's done, and what it can do for you 10
  • 11. RELXSearchSummIt2018 Evaluation Metrics • Mean Average Precision (MAP @k) • Mean Reciprocal Rank (MRR) Learning to Rank - what it is, how it's done, and what it can do for you 11 • Normalized Discounted Cumulative Gain (NDCG @k) • Rank Correlation
  • 12. RELXSearchSummIt2018 High Level Taxonomy of LTR Algorithms • Pointwise – documents ranked by relevance of each (query, document) pair • Pairwise – documents ranked by considering priority between pairs of (query, document) pairs • Listwise – documents ranked by considering the entire relevance ordering of all (query, Documents) tuples per query Learning to Rank - what it is, how it's done, and what it can do for you 12
  • 13. RELXSearchSummIt2018 Pointwise Approach • Input: (query, document) pair (q, d) • Output: score indicating rank on result list • Model: 𝒇(q, d) → score • Regression problem (in case of numeric scores) or Classification problem (in case of relevant/irrelevant, or multi-level classes like Perfect/Excellent/Good/Fair/Bad) • Ordinal regression: include ordinal relationship between labels. • Examples: SLR (Staged Logistic Regression), Pranking Learning to Rank - what it is, how it's done, and what it can do for you 13
  • 14. RELXSearchSummIt2018 Pairwise Approach • Input: triples of (query, document pairs) (q, dA, dB) • Output: one of [-1, 1] • Model: 𝒇(q, dA, dB) → [-1, 1] • Classification problem, learn binary classifier to predict [-1, 1] for a given pair of (query, document pair) triples • Goal is to minimize average number of inversions in ranking • Examples: RankNet, RankSVM, LambdaMART Learning to Rank - what it is, how it's done, and what it can do for you 14
  • 15. RELXSearchSummIt2018 Listwise Approach • Input: (query, Documents {d1, d2, …, dN}) • Output: desired ranked list of documents 𝕯 • Model: 𝒇(q, {d1, d2, …, dN}) → 𝕯 • Classification problem, with indirect loss functions such as RankCosine or KL Divergence, or smoothing IR measures (since not directly differentiable) and applying Gradient Descent • Examples: AdaRank, ListNET, RankCosine, SVMMap Learning to Rank - what it is, how it's done, and what it can do for you 15
  • 16. RELXSearchSummIt2018 Commonly used Algorithms • Linear Model • Predicted rank is linear combination of input features • RankNet • Neural network based • Good for binary (relevant/irrelevant) labels • Weight matrix transforms input features into rank probabilities • LambdaMART • Tree (forest) based • Good for multi-class labels • Feature splits with thresholds Learning to Rank - what it is, how it's done, and what it can do for you 16
  • 17. RELXSearchSummIt2018 Practical Considerations Learning to Rank - what it is, how it's done, and what it can do for you 17
  • 18. RELXSearchSummIt2018 Acquiring labels • Implicit • Intrinsic features (words, phrases) • Document metadata • User Clicks • Time spent on document • Purchases (if applicable) • Cheap to build but noisy • Explicit • Human expert rates relevancy of each document against query • Cleaner but expensive to build Learning to Rank - what it is, how it's done, and what it can do for you 18
  • 19. RELXSearchSummIt2018 Feature Selection • Document Features • Document Length • URL Length • Publication Date • Number of outlinks • PageRank • Query Features • Number of words • PER or ORG in query Learning to Rank - what it is, how it's done, and what it can do for you 19 • Query-Document Features • TF-IDF, BM25 similarity • Frequency of query in anchor text • Document contains query words in title • User Dependent Features • Star ratings • Age, gender • Device
  • 20. RELXSearchSummIt2018 Unbalanced Datasets • If dataset is unbalanced, i.e., classes are not represented approximately equally, then use under- or oversampling to balance. • Consider using something like SMOTE for oversampling instead of naïve oversampling by duplication. • Make sure no data leakage in case of oversampling. Learning to Rank - what it is, how it's done, and what it can do for you 20
  • 21. RELXSearchSummIt2018 LTR used as re-ranker • LTR models are usually more computationally expensive than search engines. • Search engine used to pull out matched documents • Top-N of these documents are fed into the LTR model and top-n of those are replaced with the output of the model, for N >> n (typically 50-100x). Learning to Rank - what it is, how it's done, and what it can do for you 21 Index Query Matched (10k) Scored (10k) Top 1000 retrieved Re-ranked Top 10 Ranking Model Image Credit: https://lucidworks.com/2016/08/17/learning-to-rank-solr/
  • 22. RELXSearchSummIt2018 LTR Algorithm Implementations • RankLib (Java) – from Lemur Project (UMass, CMU), provides Coordinate Ascent, Random Forest (pointwise), MART, RankNet, RankBoost (pairwise), LambdaMART (pair/listwise), AdaRank and ListNet (listwise) • SVMRank (C++) – from Cornell, provides SVMRank (pairwise) • XGBoost (Python/C++) – LambdaRank (pairwise) • PyLTR (Python) – LambdaMART (pairwise) • Michael Alcorn (Python) – RankNet and LambdaMART (pairwise) Learning to Rank - what it is, how it's done, and what it can do for you 22
  • 23. RELXSearchSummIt2018 LETOR Data Format 2 qid:1 1:3 2:3 3:0 4:0 5:3 6:1 7:1 8:0 9:0 10:1 11:156... # 11 2 qid:1 1:3 2:0 3:3 4:0 5:3 6:1 7:0 8:1 9:0 10:1 11:406... # 23 0 qid:1 1:3 2:0 3:2 4:0 5:3 6:1 7:0 8:0.666667 9:0 10:1 ... # 44 2 qid:1 1:3 2:0 3:3 4:0 5:3 6:1 7:0 8:1 9:0 10:1 11:287 ... # 57 1 qid:1 1:3 2:0 3:3 4:0 5:3 6:1 7:0 8:1 9:0 10:1 11:2009 ... # 89 Learning to Rank - what it is, how it's done, and what it can do for you 23 label Query ID Features: query, document, query/document, other (sparse or dense format) Comments (ex: docID)
  • 24. RELXSearchSummIt2018 Case Studies Learning to Rank - what it is, how it's done, and what it can do for you 24
  • 25. RELXSearchSummIt2018 Preprocessing Data • We use The Movie Database (TMDB) from Kaggle. • 45k movies, 20 genres, 31k unique keywords • We extract following fields: (docID, title, description, popularity, release date, running time, rating (0-10), keywords, genres) • Categorical labels 1-5 created from rating • Objective is to build LTR model that learns the ordering implied by rating and re-rank top 10 results using this model • Features chosen: (query-title and query-description similarity using TF-IDF and BM25, document recency, original score, and boolean 0/1 for each genre) Learning to Rank - what it is, how it's done, and what it can do for you 25
  • 26. RELXSearchSummIt2018 LTR with Solr • Prepare Solr for LTR (add snippet to solrconfig.xml) and start with solr.ltr.enabled=True • Load data • Define LTR features to be used to Solr • Define dummy linear model to use Solr to extract features (rq) for some queries to LETOR format • Train RankLib LambdaMART model using extracted features • Upload trained model definition to Solr • Run Solr re-rank query (rq) using trained LTR model • See notebooks – 02-solr/01 .. 04 Learning to Rank - what it is, how it's done, and what it can do for you 26
  • 27. RELXSearchSummIt2018 LTR with Elasticsearch • Install LTR plugin and load data • Initialize feature store • Define features – load feature templates into Elasticsearch • Extract features (sltr) to LETOR format • Train RankLib model (also supported natively XGBoost, SVMRank). • Upload trained LTR model to Elasticsearch • Run re-rank query (rescore) using trained LTR model • See notebooks – 03-elasticsearch/01 .. 04 Learning to Rank - what it is, how it's done, and what it can do for you 27
  • 28. RELXSearchSummIt2018 DIY LTR – Index Agnostic • Run queries, generate features from results to LETOR format • Train RankLib (or other third party LTR) model • Run re-rank query on trained model • Merge output of re-rank with actual results from index • See notebooks – 04-ranklib/02..04 • Pros: index agnostic; more freedom to add novel features • Cons: less support from index Learning to Rank - what it is, how it's done, and what it can do for you 28
  • 29. RELXSearchSummIt2018 Wrapping Up Learning to Rank - what it is, how it's done, and what it can do for you 29
  • 30. RELXSearchSummIt2018 Resources • Book – Learning to Rank for Information Retrieval, by Tie-Yan Liu. • Paper – From RankNet to LambdaRank to LambdaMART: An Overview, by Christopher J. C. Burges • Tutorials • Solr - https://github.com/airalcorn2/Solr-LTR • Elasticsearch – Learning to Rank 101 by Pere Urbon-Bayes, ES-LTR Demo by Doug Turnbull. • Product Centric LTR Documentation • Solr Learning To Rank Docs • Elasticsearch Learning to Rank Docs Learning to Rank - what it is, how it's done, and what it can do for you 30
  • 31. RELXSearchSummIt2018 Thank you! • Contact: sujit.pal@elsevier.com Learning to Rank - what it is, how it's done, and what it can do for you 31

Editor's Notes

  1. Most of the key work done between 2008 – 2011, competitions sponsored by MS, Yahoo and Yandex. Bloomberg LTR meetup – Michael Nillson, Erick Erickson. OSC LTR – at Haystack earlier this year.
  2. All cases you need judgement list (ie relevant vs irrelevant). For MRR you need first good result so notion of position; for DCG you need graded results and for NDCG and Rank Correlation we also need ideal ordering.
  3. SMOTE – take a minority class and pick one of its k-nearest neighbors, create synthetic data based on a mix between the original and the neighbor.