Spot the bug in this LlamaIndex ingestion that mixes embed models silently across re-indexing
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Click any words you think contain an error. Click again to unmark.
Switching `Settings.embed_model` between build and re-index silently embeds new nodes with a different model than existing vectors, either a dim-mismatch error or silent cross-space corruption.
Imagine a closet where every shirt has a number written inside the collar showing its size in inches. You sort the shirts by that number. Months later, a friend helps you add new shirts, but they wrote the numbers in centimeters without telling anyone. The new shirts slip onto the rod next to the old ones. A shirt marked 30 might be tiny or huge depending on which ruler the writer used, but the rack treats every number the same. Now nothing on the rod is truly sorted, and when you reach for a small shirt you grab whatever lands near the number, not the size. The closet looks fine. The system silently lies. That is what happens when two different rulers measure the same shelf and nobody records which ruler made which mark.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Name the bug (mutable global + no persisted model record), describe the two failure modes (loud dim-mismatch vs silent cross-space pollution), explain why cross-model cosine is meaningless, and walk the defense in depth fix (pin embed model on the index, record sidecar metadata, use a dimension-enforcing store, CI test).
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Trusting that an index "remembers" which embed model built it. By default, LlamaIndex's `Settings.embed_model` is a global at call time, the index does not enforce consistency.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.