Views
No views yet
general: the default route, suitable for general-purpose multilingual retrieval.coding: specialized for code-related retrieval, including programming concepts, APIs, and technical documentation.reasoning: specialized for tasks that require deeper semantic understanding, multi-step inference, and complex query matching.general, coding, and reasoning. GeeVec-Embeddings-1.0 achieves SOTA performance on the MMTEB(Multilingual, v2) retrieval task, with an nDCG@10 score of 79.94 (as of 2026/04/02). API usage documentation: https://www.geevec.com/documentation. & https://geeknow.geevec.com/embedding_model/geevec-embeddings-1.0-lite.general (default), coding, reasoninggit clone https://github.com/FlagOpen/FlagEmbedding.git
cd FlagEmbedding
pip install -e .1from FlagEmbedding import FlagAutoModel
2
3model_path = "geevec-ai/geevec-embeddings-1.0-lite"
4
5model = FlagAutoModel.from_finetuned(
6 model_path,
7 model_class="decoder-only-pseudo_moe",
8 query_instruction_for_retrieval="Given a question, retrieve passages that answer the question.",
9 query_instruction_format="Instruct: {}\nQuery: {}",
10 domain_for_pseudo_moe="general", # general / coding / reasoning
11 use_bf16=True,
12 use_fp16=False,
13 trust_remote_code=True,
14 devices="cuda:0", # if you do not have a GPU, set this to "cpu"
15)
16
17queries = [
18 "how much protein should a female eat",
19 "summit define",
20]
21documents = [
22 "As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day.",
23 "Definition of summit for English Language Learners: the highest point of a mountain; the highest level; a meeting between leaders.",
24]
25
26query_embeddings = model.encode_queries(queries)
27document_embeddings = model.encode_corpus(documents)
28
29similarity = query_embeddings @ document_embeddings.T
30print(similarity)1from sentence_transformers import SentenceTransformer
2import torch
3
4model_path = "geevec-ai/geevec-embeddings-1.0-lite"
5
6# Load with trust_remote_code=True because the model defines custom modules.
7model = SentenceTransformer(
8 model_path,
9 model_kwargs={"torch_dtype": torch.bfloat16},
10 trust_remote_code=True,
11)
12
13queries = [
14 "How can I optimize a Python function that has nested loops?",
15 "What is the difference between eigenvalue decomposition and SVD?",
16]
17
18documents = [
19 "Use vectorization, caching, and algorithmic improvements to reduce complexity.",
20 "Eigenvalue decomposition applies to square matrices; SVD works for any matrix.",
21]
22
23# Optional domain routing: general / coding / reasoning
24query_embeddings = model.encode(queries, domain="coding", normalize_embeddings=True)
25doc_embeddings = model.encode(documents, domain="coding", normalize_embeddings=True)
26
27similarity = query_embeddings @ doc_embeddings.T
28print(similarity)1import torch
2import torch.nn.functional as F
3
4from torch import Tensor
5from transformers import AutoTokenizer, AutoModel
6
7
8def last_token_pool(last_hidden_states: Tensor,
9 attention_mask: Tensor) -> Tensor:
10 left_padding = (attention_mask[:, -1].sum() == attention_mask.shape[0])
11 if left_padding:
12 return last_hidden_states[:, -1]
13 else:
14 sequence_lengths = attention_mask.sum(dim=1) - 1
15 batch_size = last_hidden_states.shape[0]
16 return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]
17
18
19def get_detailed_instruct(task_description: str, query: str) -> str:
20 return f'Instruct: {task_description}\nQuery: {query}'
21
22
23task = 'Given a web search query, retrieve relevant passages that answer the query.'
24queries = [
25 get_detailed_instruct(task, "How can I optimize a Python function that has nested loops?"),
26 get_detailed_instruct(task, 'summit define')
27]
28# No need to add instructions for documents
29documents = [
30 "Use vectorization, caching, and algorithmic improvements to reduce complexity.",
31 "What is the difference between eigenvalue decomposition and SVD?",
32]
33input_texts = queries + documents
34
35tokenizer = AutoTokenizer.from_pretrained("geevec-ai/geevec-embeddings-1.0-lite")
36model = AutoModel.from_pretrained("/geevec-ai/geevec-embeddings-1.0-lite", trust_remote_code=True)
37model.eval()
38
39max_length = 4096
40# Tokenize the input texts
41batch_dict = tokenizer(input_texts, max_length=max_length, padding=True, truncation=True, return_tensors='pt', pad_to_multiple_of=8)
42
43with torch.no_grad():
44 outputs = model(**batch_dict)
45 embeddings = last_token_pool(outputs.last_hidden_state, batch_dict['attention_mask'])
46
47# normalize embeddings
48embeddings = F.normalize(embeddings, p=2, dim=1)
49scores = (embeddings[:2] @ embeddings[2:].T) * 100
50print(scores.tolist())modeling_qwen3_pseudo_moe.py, configuration_qwen3_pseudo_moe.py, and pseudo_moe_st_module.py.trust_remote_code=True.general by default.general
general
general
coding
reasoning