RAG for Everyone

← Back to exercises

Chapter 13 Practice Bank75 min practice

Practice Bank: Local Retrieval Decisions

Use starter.py to decide when TF-IDF, SVD, neural embeddings, or hybrid search should be used.

Scenario 1: Error code lookup

Exact lexical retrieval is strong.

Scenario 2: Credential paraphrase

TF-IDF may miss vocabulary mismatch.

Scenario 3: Offline demo

Local methods avoid network and API keys.

Scenario 4: Sensitive HR corpus

Local processing reduces provider exposure.

Scenario 5: Product SKUs

Token preservation is critical.

Scenario 6: Legal clause numbers

Sparse signals protect exact references.

Scenario 7: Many common words

IDF helps reduce noise.

Scenario 8: Low SVD dimension

Compression may blur important distinctions.

Scenario 9: New corpus release

IDF and projection may need rebuild.

Scenario 10: Hybrid production search

Local lexical and neural retrieval can complement each other.

← ExercisesInterview Questions →