Stanford CS 276 - Lecture 4: Index Construction

Unformatted text preview:

Introduction to Information Retrieval Introduction to Information Retrieval CS276 Information Retrieval and Web Search Pandu Nayak and Prabhakar Raghavan Lecture 4 Index Construction Introduction to Information Retrieval Introduction to Information Retrieval Dictionary data structures Tolerant retrieval a hu n z hy m Plan Last lecture Wildcards Spell correction Soundex This time Index construction m mo on mace madden among amortize abandon among Introduction to Information Retrieval Introduction to Information Retrieval Ch 4 Index construction How do we construct an index What strategies can we use with limited main memory Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 1 Hardware basics Many design decisions in information retrieval are based on the characteristics of hardware We begin by reviewing hardware basics Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 1 Hardware basics Access to data in memory is much faster than access to data on disk Disk seeks No data is transferred from disk while the disk head is being positioned Therefore Transferring one large chunk of data from disk to memory is faster than transferring many small chunks Disk I O is block based Reading and writing of entire blocks as opposed to smaller chunks Block sizes 8KB to 256 KB Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 1 Hardware basics Servers used in IR systems now typically have several GB of main memory sometimes tens of GB Available disk space is several 2 3 orders of magnitude larger Fault tolerance is very expensive It s much cheaper to use many regular machines rather than one fault tolerant machine Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 1 Hardware assumptions for this lecture symbol statistic s b p value 5 ms 5 x 10 3 s 0 02 s 2 x 10 8 s average seek time transfer time per byte processor s clock rate low level operation 0 01 s 10 8 s 109 s 1 e g compare swap a word size of main memory size of disk space several GB 1 TB or more Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 2 RCV1 Our collection for this lecture Shakespeare s collected works definitely aren t large enough for demonstrating many of the points in this course The collection we ll use isn t really large enough either but it s publicly available and is at least a more plausible example As an example for applying scalable index construction algorithms we will use the Reuters RCV1 collection This is one year of Reuters newswire part of 1995 and 1996 Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 2 A Reuters RCV1 document Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 2 Reuters RCV1 statistics symbol statistic N documents L avg tokens per doc M terms word types avg bytes per token incl spaces punct value 800 000 200 400 000 6 4 5 avg bytes per token without spaces punct avg bytes per term non positional postings 100 000 000 4 5 bytes per word token vs 7 5 bytes per word type why 7 5 Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 2 Recall IIR 1 index construction Documents are parsed to extract words and these are saved with the Document ID Doc 1 Doc 2 I did enact Julius Caesar I was killed i the Capitol Brutus killed me So let it be with Caesar The noble Brutus hath told you Caesar was ambitious Term I did enact julius caesar I was killed i the capitol brutus killed me so let it be with caesar the noble brutus hath told you caesar was ambitious Doc 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Introduction to Information Retrieval Introduction to Information Retrieval Key step After all documents have been parsed the inverted file is sorted by terms We focus on this sort step We have 100M items to sort Sec 4 2 Term ambitious be brutus brutus capitol caesar caesar caesar did enact hath I I i it julius killed killed let me noble so the the told you was was with Doc 2 2 1 2 1 1 2 2 1 1 1 1 1 1 2 1 1 1 2 1 2 2 1 2 2 2 1 2 2 Term I did enact julius caesar I was killed i the capitol brutus killed me so let it be with caesar the noble brutus hath told you caesar was ambitious Doc 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 2 Scaling index construction In memory index construction does not scale Can t stuff entire collection into memory sort then write How can we construct an index for very large back collections Taking into account the hardware constraints we just learned about Memory disk speed etc Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 2 Sort based index construction As we build the index we parse docs one at a time While building the index we cannot easily exploit compression tricks you can but much more complex The final postings for any term are incomplete until the end At 12 bytes per non positional postings entry term doc freq demands a lot of space for large collections T 100 000 000 in the case of RCV1 So we can do this in memory in 2009 but typical collections are much larger E g the New York Times provides an index of 150 years of newswire Thus We need to store intermediate results on disk Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 2 Sort using disk as memory Can we use the same index construction algorithm for larger collections but by using disk instead of memory No Sorting T 100 000 000 records on disk is too slow too many disk seeks We need an external sorting algorithm Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 2 Bottleneck Parse and build postings entries one doc at a time Now sort postings entries by term then by doc within each term Doing this with random disk seeks would be too slow must sort T 100M records If every comparison took 2 disk seeks and N items could be sorted with N log2N comparisons how long would this take Introduction to Information Retrieval Introduction to Information Retrieval Sec 4 2 BSBI Blocked sort based Indexing Sorting with fewer disk seeks 12 byte 4 4 4 records term doc freq These are generated as we parse docs Must now sort 100M such 12 byte records by term Define a Block 10M such records Can easily fit a couple into memory Will have 10 such blocks to start with Basic idea of algorithm


View Full Document

Stanford CS 276 - Lecture 4: Index Construction

Documents in this Course
Load more
Download Lecture 4: Index Construction
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 4: Index Construction and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 4: Index Construction 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?