> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memvid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Models

> Manage local caches for embeddings, reranking, CLIP, NER, and enrichment

Memvid uses local models for semantic search (embeddings), reranking, visual search (CLIP), Logic‑Mesh entity extraction (NER), and local enrichment workflows. Models are cached under `MEMVID_MODELS_DIR` (default `~/.memvid/models`).

Some models are installed explicitly via `memvid models install`, while embedding/reranker models are auto-downloaded on first use (unless offline).

***

## Quick Start

```bash theme={null}
# See what's available / installed (no downloads)
memvid models list

# Install optional CLIP + NER models
memvid models install --clip mobileclip-s2
memvid models install --ner distilbert-ner

# Install optional local LLM for enrichment (GGUF)
memvid models install phi-3.5-mini
```

***

## Model Types

| Type             | How it’s fetched                 | Used by                                                            |
| ---------------- | -------------------------------- | ------------------------------------------------------------------ |
| **Embedding**    | Auto-download on first use       | `put --embedding`, `find --mode sem/auto`, `ask --mode sem/hybrid` |
| **Reranker**     | Auto-download on first use       | Hybrid `ask`/`find` (disable with `--no-rerank`)                   |
| **CLIP**         | `memvid models install --clip …` | `put --clip`, `find --mode clip`                                   |
| **NER**          | `memvid models install --ner …`  | `put --logic-mesh`, `follow …`                                     |
| **LLM (Enrich)** | `memvid models install …`        | `enrich`, `put --contextual --contextual-model local`              |
| **Whisper**      | Auto-download on first use       | `put --transcribe`                                                 |

***

## Embedding Models (Text Vectors)

Select the default embedding model with the global `-m/--embedding-model` flag. It can appear before or after the subcommand:

```bash theme={null}
memvid put knowledge.mv2 --input docs/ --embedding -m bge-small
memvid -m openai-small put knowledge.mv2 --input docs/ --embedding
```

### Common choices

| Model          | Dimensions | Notes                           |
| -------------- | ---------- | ------------------------------- |
| `bge-small`    | 384        | Default local model (fastembed) |
| `bge-base`     | 768        | Higher quality local model      |
| `nomic`        | 768        | High accuracy local model       |
| `gte-large`    | 1024       | Best local semantic depth       |
| `openai-small` | 1536       | `OPENAI_API_KEY` required       |
| `openai-large` | 3072       | `OPENAI_API_KEY` required       |
| `openai`       | 3072       | Alias for `openai-large`        |
| `openai-ada`   | 1536       | Legacy OpenAI model             |

### External embedding APIs

```bash theme={null}
export OPENAI_API_KEY=sk-...
memvid put knowledge.mv2 --input docs/ --embedding -m openai-small
```

<Info>
  `ask`/`find` auto-detect the correct embedding runtime from the `.mv2` when vectors are present. Use `--query-embedding-model` (or global `-m`) only when you need an explicit override.
</Info>

***

## Reranking (Hybrid Precision)

`memvid ask` may use a cross-encoder reranker (auto-downloaded on first use). Disable it in gated/offline environments:

```bash theme={null}
memvid ask knowledge.mv2 --question "…" --no-rerank
```

***

## CLIP Models (Visual Search)

Install a CLIP model:

```bash theme={null}
memvid models install --clip mobileclip-s2
memvid models install --clip mobileclip-s2-fp16
memvid models install --clip siglip-base
```

Use it during ingestion and search:

```bash theme={null}
memvid put photos.mv2 --input ./images --clip
memvid find photos.mv2 --query "sunset over ocean" --mode clip
```

***

## NER Model (Logic‑Mesh)

Install NER:

```bash theme={null}
memvid models install --ner distilbert-ner
```

Enable Logic‑Mesh during ingestion:

```bash theme={null}
memvid put graph.mv2 --input docs/ --logic-mesh
memvid follow graph.mv2 traverse --start "Microsoft" --hops 2
```

***

## Enrichment LLM Models

These are local GGUF models used by enrichment workflows (not by `memvid ask`):

```bash theme={null}
memvid models install phi-3.5-mini
memvid models install phi-3.5-mini-q8
```

<Info>
  For `memvid ask`, choose a synthesis model with `--use-model` (e.g. `--use-model openai`, `--use-model gemini-2.0-flash`, or `--use-model "ollama:qwen2.5:1.5b"`). See [Local Models with Ollama](/concepts/local-models).
</Info>

***

## List / Verify / Remove

```bash theme={null}
# Filter model list
memvid models list --model-type embedding
memvid models list --model-type clip --json

# Verify installed enrichment LLM models (phi-3.5-*)
memvid models verify
memvid models verify phi-3.5-mini

# Remove an enrichment LLM model
memvid models remove phi-3.5-mini --yes
```

***

## Offline Mode

Set `MEMVID_OFFLINE=1` to prevent downloads. In offline mode:

* `memvid models install …` fails (it can’t download).
* Embedding/reranker auto-download is blocked; run a semantic command once while online to populate caches.

***

## Environment Variables

| Variable            | Purpose                                            |
| ------------------- | -------------------------------------------------- |
| `MEMVID_MODELS_DIR` | Model cache directory (default `~/.memvid/models`) |
| `MEMVID_OFFLINE`    | Skip downloads/network (`1` to enable)             |
| `MEMVID_CLIP_MODEL` | Default local CLIP model (e.g. `mobileclip-s2`)    |
| `OPENAI_API_KEY`    | OpenAI embeddings / CLIP / LLM providers           |
| `GEMINI_API_KEY`    | Gemini providers                                   |
| `ANTHROPIC_API_KEY` | Claude providers                                   |
| `COHERE_API_KEY`    | Cohere embeddings                                  |
| `VOYAGE_API_KEY`    | Voyage embeddings                                  |
