The following draws heavily from this excellent StackOverflow post and from a conversation with ChatGPT.
A forward index maps from a primary entity (such as a document or unique identifier) to a set of associated data elements (such as terms, features, or attributes). Both items can be “primary” entities, as when a database primary index maps from a primary key to a record.
An inverted index maps from individual data elements (such as terms, features, or attributes) to a set of primary entities (such as a document or unique identifier).
Nomenclature warning: Inverted indices have many names. They are sometimes called “inverted file indices” or “file flat indices.” The term “file” here refers to an entity in the database, rather than files in a filesystem. They are also sometimes abbreviates as “IVF,” particularly in FAISS.
These terms mean different things in different contexts. Here are a few (very non-exhaustive) examples.
| Context | Forward | Inverted |
|---|---|---|
| Relational database | Mapping user ID to records | Mapping of hometown to user ID |
| Text search platforms | Mapping of document ID to document | Mapping of term to documents |
| Nearest-neighbor search (vector search) | ---- | Mapping of hash/quantization to vector |
| Book | Table of contents (chapter ID to page) | Index (terms from page to page) |
| DNS | Mapping from domain to IP | Mapping from IP to domain |