Wood Chen

Why Does memory-lancedb Stop Working After Switching Embedding Models?

0 comments73 views266 words

This post was translated from Chinese by AI. If anything reads oddly, the Chinese original is authoritative. 中文原文

Why Does memory-lancedb Stop Working After Switching Embedding Models?

While tinkering with OpenClaw's memory system recently, I hit a classic pitfall: once you switch embedding models, you can no longer use the old memory-lancedb database as-is.

The reason is straightforward.

A vector database stores not raw text, but vectors generated from that text by a particular embedding model. When the model changes, the vectors' dimensions and distribution often change too. If you keep using the old database, you might get worse retrieval—or outright errors.

Common symptoms include:

  • Memory retrieval suddenly becomes inaccurate
  • Query results start getting erratic
  • New data can no longer be written
  • The database still appears to be there, but is no longer very usable

Here's the core issue: the embedding model isn't just another configuration setting; it's a fundamental assumption behind the vector database.

So this isn't simply “changing a parameter.” It needs to be treated as a migration.

A safer approach comes down to a few things:

  • Don't reuse the old database by default when switching models
  • Either create a new database
  • Or clear it and rebuild the index
  • Ideally, record the current model name in the database metadata too
  • Check at startup that the model and database match

The lesson for me this time was simple:

Whenever the embedding model changes, assume the old vector database may have compatibility issues.

The biggest headache isn't when it fails immediately, but when it appears to keep working while the results get increasingly strange. That's the hardest kind of problem to debug.

Related posts

Comments 0