Skip to main content
OpenGround supports two embedding backends for generating vector representations of text: sentence-transformers and fastembed. Each has different characteristics that make them suitable for different use cases.

Backend Comparison

Fastembed (Default)

Pros:
  • Lightweight and fast
  • Smaller installation footprint
  • Efficient ONNX runtime
  • Good CPU performance
  • Optional GPU support via fastembed-gpu
Cons:
  • Limited model selection
  • Less mature ecosystem
  • GPU support requires specific CUDA setup
Best for: Production deployments, resource-constrained environments, CPU-only systems

Sentence-Transformers

Pros:
  • Extensive model library
  • Mature and well-tested
  • Better GPU compatibility
  • More flexible configuration options
  • Automatic GPU detection
Cons:
  • Larger installation size
  • More dependencies
  • Higher memory footprint
Best for: Research, experimentation, systems with GPUs, when you need specific models

Configuration

Set your backend in the configuration:

Installation

Fastembed (CPU)

Fastembed (GPU)

Sentence-Transformers

Switching Backends

When switching backends, you must re-index your documentation with the new backend. Embeddings from different backends are not compatible.
To switch backends:
  1. Update your configuration to specify the new backend
  2. Delete existing index (or use a new table name)
  3. Re-run indexing with the new backend

Implementation Details

From embeddings.py:207-234:

Fastembed Implementation

Fastembed uses the passage_embed method for document embeddings (embeddings.py:163-204):

Sentence-Transformers Implementation

Sentence-transformers uses normalized embeddings (embeddings.py:119-160):

Model Caching

Both backends use @lru_cache to avoid reloading models:

Backend-Specific Errors

Fastembed Not Installed

Solution: Install the appropriate fastembed package

Sentence-Transformers Not Installed

Solution: Install sentence-transformers backend

Performance Considerations

  • Batch Size: Both backends respect the batch_size configuration. Larger batches can improve throughput but require more memory
  • Progress Bars: Both show progress during embedding generation via tqdm
  • Memory: Sentence-transformers generally uses more memory than fastembed
  • Speed: Fastembed is typically faster on CPU; sentence-transformers may be faster on GPU with proper setup

Next Steps