Skip to main content
net10.0net8.0

Harrier-OSS-v1 embedding model integration for ElBruno.LocalEmbeddings β€” decoder-only transformer with last-token pooling and 94+ language support

Published
Oct 7, 2026
15d ago
Total Downloads
2.4K
2,368

Install

dotnet add package ElBruno.LocalEmbeddings.Harrier --version 1.6.4
ProductVersions
.NET
net10.0net8.0

README

ElBruno.LocalEmbeddings.Harrier

High-quality multilingual embeddings using Microsoft Harrier-OSS-v1 locally with ONNX Runtime.

Installation

dotnet add package ElBruno.LocalEmbeddings.Harrier

Quick Start

using ElBruno.LocalEmbeddings.Harrier;

// Create with default settings (downloads INT8 quantized model on first run)
await using var generator = await HarrierEmbeddingGenerator.CreateAsync();

// Generate embeddings
var embeddings = await generator.GenerateAsync(["Hello world!", "Hola mundo!"]);
Console.WriteLine($"Dimensions: {embeddings[0].Vector.Length}"); // 640

Model Details

  • Publisher: Microsoft (MIT license)
  • Architecture: Decoder-only (Gemma 3 based)
  • Parameters: 270M
  • Embedding dimensions: 640
  • Context window: 32,768 tokens
  • Languages: 94+
  • MTEB-v2 ranking: #1
  • Default variant: INT8 Quantized (~270 MB)

Features

  • πŸ¦… Top-ranked embedding model on MTEB-v2 β€” best semantic quality
  • 🌍 Multilingual support β€” 94+ languages
  • πŸ“¦ Multiple quantization variants β€” Choose between quality (FP32/FP16) and speed (INT8/Q4)
  • 🎯 Instruction-tuned β€” Specify task-specific prefixes for better results
  • πŸ“š Long context β€” Supports up to 32,768 tokens
  • ⚑ ONNX Runtime β€” Runs locally on CPU, zero external API calls
  • πŸ”’ Private by default β€” No data sent to external services

Configuration

var options = new HarrierEmbeddingsOptions
{
    // Model variant (FP32, FP16, Quantized, Q4)
    ModelVariant = HarrierModelVariant.Quantized,
    
    // Instruction prefix for task-specific embeddings
    InstructionPrefix = "Instruct: Retrieve semantically similar text\nQuery: ",
    
    // Token limit
    MaxSequenceLength = 8192,
    
    // Cache and download
    EnsureModelDownloaded = true,
    CacheDirectory = null  // Auto-detect per platform
};

await using var generator = await HarrierEmbeddingGenerator.CreateAsync(options);

Dependency Injection

using ElBruno.LocalEmbeddings.Harrier.Extensions;
using Microsoft.Extensions.AI;

services.AddHarrierEmbeddings(options =>
{
    options.ModelVariant = HarrierModelVariant.Q4;
});

// Resolve as IEmbeddingGenerator<string, Embedding<float>>
var generator = serviceProvider.GetRequiredService<IEmbeddingGenerator<string, Embedding<float>>>();

Learn More

πŸ“– Full Harrier Integration Guide β€” Instruction prefixes, configuration, troubleshooting, and migration from MiniLM.

🎬 HarrierConsoleApp Sample β€” Complete working example with 6 progressive scenarios.

License

MIT β€” See LICENSE

Changes from Previous Version

No structural changes between v1.6.3 and v1.6.4.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.