Skip to content

Local model - Change embeddings vectors size #352

@leoai-81

Description

@leoai-81

When attempting to index documents with a higher-dimensional embedding model (e.g., Qwen3-Embedding-4B-GGUF), the MCP server fails to insert vectors into the SQLite vector store because the database was created with a fixed dimension of 1536.

Error example:

⚠️ Job dcab1388-4ae3-4f1e-bf2d-e507145fefb1 error on document :
Failed to add documents to store caused by SqliteError: Dimension mismatch for inserted vector for the "embedding" column.
Expected 1536 dimensions but received 2560.

SQLite schema shows:

CREATE VIRTUAL TABLE documents_vec USING vec0(
  library_id INTEGER NOT NULL,
  version_id INTEGER NOT NULL,
  embedding FLOAT[1536]
)

Steps to Reproduce

Configure config.yaml with a high-dimensional embedding model (e.g., Qwen3-Embedding-4B-GGUF) and corresponding vectorDimension: 2560.

Start the MCP server.

Attempt to index or refresh documents.

Observe DimensionError / SqliteError.

Expected Behavior

The server should either:

Support reinitializing or upgrading the database to match the new embedding dimension, or

Provide a clear warning that the database must be rebuilt when changing embedding models.

Actual Behavior

The server crashes or fails to add documents due to dimension mismatch.

Existing SQLite virtual table documents_vec is fixed at [1536] and cannot store higher-dimensional vectors.

Suggested Fix / Notes

Either allow dynamic vector dimension upgrade in the SQLite store or clearly document that changing embedding models requires deleting/reinitializing the database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions