Model reference · open weights

Giga-Retrieval

Available as managed deployment Embeddings ai-sage Embeddings 1 variants 586 dl/mo

Giga-Retrieval is an open-weight embedding model from ai-sage. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.

Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.

What it is

Released byai-sage
TypeEmbedding models
TaskEmbeddings
Parameters (lead)2.5B
Context4k tokens
Released2025-05-29
Popularity586 downloads / month
LicenceOpen weights

About

What Giga-Retrieval is

Giga-Retrieval-instruct

  • Base Decoder-only LLM: Pruned GigaChat-3b
  • Pooling Type: Latent-Attention
  • Embedding Dimension: 2048

Использование

Ниже приведен пример кодирования запросов и текстов.

Read the full model card

Requirements

pip install -q transformers==4.46.3 sentence-transformers==3.3.1 datasets langchain_community langchain_huggingface langchain_gigachat

Transformers

import os
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel

# Each query needs to be accompanied by an corresponding instruction describing the task.
task_name_to_instruct = {"example": "Given a question, retrieve passages that answer the question",}

query_prefix = task_name_to_instruct["example"] + "\nquestion: "
queries = [
    'are judo throws allowed in wrestling?',
    'how to become a radiology technician in michigan?'
]

# No instruction needed for retrieval passages
passage_prefix = ""
passages = [
    "Since you're reading this, you are probably someone from a judo background or someone who is just wondering how judo techniques can be applied under wrestling rules. So without further ado, let's get to the question. Are Judo throws allowed in wrestling? Yes, judo throws are allowed in freestyle and folkstyle wrestling. You only need to be careful to follow the slam rules when executing judo throws. In wrestling, a slam is lifting and returning an opponent to the mat with unnecessary force.",
    "Below are the basic steps to becoming a radiologic technologist in Michigan:Earn a high school diploma. As with most careers in health care, a high school education is the first step to finding entry-level employment. Taking classes in math and science, such as anatomy, biology, chemistry, physiology, and physics, can help prepare students for their college studies and future careers.Earn an associate degree. Entry-level radiologic positions typically require at least an Associate of Applied Science. Before enrolling in one of these degree programs, students should make sure it has been properly accredited by the Joint Review Committee on Education in Radiologic Technology (JRCERT).Get licensed or certified in the state of Michigan."
]

# load model with tokenizer
model = AutoModel.from_pretrained('ai-sage/Giga-Retrieval-instruct', trust_remote_code=True)

# get the embeddings
query_embeddings = model.encode(queries, instruction=query_prefix)
passage_embeddings = model.encode(passages, instruction=passage_prefix)

scores = (query_embeddings @ passage_embeddings.T) * 100
print(scores.tolist())

LangChain

import torch

from langchain_huggingface import HuggingFaceEmbeddings

# Load model
embeddings = HuggingFaceEmbeddings(
    model_name='ai-sage/Giga-Retrieval-instruct',
    encode_kwargs={},
    model_kwargs={
        'device': 'cuda', # or 'cpu'
        'trust_remote_code': True,
        'model_kwargs': {'torch_dtype': torch.bfloat16},
        'prompts': {'query': 'Given a question, retrieve passages that answer the question\nquestion: '}
    }
)

# Tokenizer
embeddings._client.tokenizer.tokenize("Hello world! I am GigaChat")

# Query embeddings
query_embeddings = embeddings.embed_query("Hello world!")
print(f"Your embeddings: {query_embeddings[0:20]}...")
print(f"Vector size: {len(query_embeddings)}")

# Document embeddings
documents = ["foo bar", "bar foo"]
documents_embeddings = embeddings.embed_documents(documents)
print(f"Vector size: {len(documents_embeddings)} x {len(documents_embeddings[0])}")

Инструктивность

Использование инструкций для улучшения качества эмбеддингов

Для достижения более точных результатов при работе с эмбеддингами, особенно в задачах поиска и извлечения информации (retrieval), рекомендуется добавлять инструкцию на естественном языке перед текстовым запросом (query). Это помогает модели лучше понять контекст и цель запроса, что положительно сказывается на качестве результатов. Важно отметить, что инструкцию нужно добавлять только перед запросом, а не перед документом.

Для retrieval-задач (например, поиск ответа в тексте) можно использовать инструкцию: 'Дан вопрос, необходимо найти абзац текста с ответом \nвопрос: {query}'.

Такой подход особенно эффективен для задач поиска и извлечения информации, таких как поиск релевантных документов или извлечение ответов из текста.

Примеры инструкций для retrieval-задач:

  • 'Дан вопрос, необходимо найти абзац текста с ответом \nвопрос: {query}'
  • 'Given the question, find a paragraph with the answer \nquestion: {query}'

Использование инструкций позволяет значительно улучшить качество поиска и релевантность результатов, что подтверждается тестами на бенчмарках, таких как RuBQ. Для симметричных задач добавление инструкции перед каждым запросом обеспечивает согласованность и повышает точность модели.

Поддерживаемые языки

Эта модель инициализирована pretrain моделью GigaChat и дополнительно обучена на смеси английских и русских данных. Однако, поскольку pretrain GigaChat'a делался в основном на русскоязычных данных, мы рекомендуем использовать эту модель только для русского языка.

FAQ

  1. Нужно ли добавлять инструкции к запросу?

Да, именно так модель обучалась, иначе вы увидите снижение качества. Определение задачи должно быть инструкцией в одном предложении, которая описывает задачу. Это способ настройки текстовых эмбеддингов для разных сценариев с помощью инструкций на естественном языке.

С другой стороны, добавлять инструкции на сторону документа не требуется.

  1. Почему мои воспроизведённые результаты немного отличаются от указанных в карточке модели?

Разные версии библиотек transformers и pytorch могут вызывать незначительные, но ненулевые различия в результатах.

Ограничения

Использование этой модели для входных данных, содержащих более 4096 токенов, невозможно.

From the published model card. Full card on the HuggingFace links in the sidebar.

Using it via the API

Call it like any OpenAI endpoint

Once AxForge deploys giga-retrieval for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (giga-retrieval below is illustrative; you get the exact model name on deployment.)

$ curl -sS https://api.axforge.ai/v1/embeddings \
  -H "Authorization: Bearer $AXFORGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"giga-retrieval","input":"text to embed"}'

Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.

© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms