Downloads · 30 days
25
2% of all-time downloads
YARlabs/v5_Embedding_0.5B
v5_Embedding_0.5B is a feature extraction model from YARlabs. Use it when you need embeddings to search or compare text. It is set up for transformers.
Inspired by the technical excellence of the Qwen3-embedding series, we introduce v5Embedding—the world's first native hyperbolic text embedding model. v5Embedding serves as a universal semantic engine, empirically dem…
Downloads · 30 days
25
2% of all-time downloads
All-time downloads
1.4K
Public
Parameters
596M
2.4 GB on disk
Likes
6
Public
Click a slice to open those files.
.safetensors1.2 GB · 50%
How the weights are stored.
F16596M · 100%
From the Hugging Face model README
Inspired by the technical excellence of the Qwen3-embedding series, we introduce v5_Embedding—the world's first native hyperbolic text embedding model. v5_Embedding serves as a universal semantic engine, empirically demonstrating that non-Euclidean geometries—specifically Lobachevsky, Lorentz, and Klein manifolds—provide a fundamentally more expressive representational space for hierarchical textual data than traditional Euclidean geometry.
Developed through technical synthesis and collaborative exchange with experts from organizations including Google, Alibaba, Baidu, and Apple, this project represents a breakthrough for the open-source community. It proves that independent research can drive fundamental architectural innovations rather than merely following established industry paradigms.
v5_Embedding establishes a new frontier for researchers and engineers globally, enabling superior retrieval performance with significantly reduced computational overhead and latency. We envision v5_Embedding as a catalyst for a new industry standard. Combined with HyperspaceDB, it empowers the democratization of hyper-efficient AI—from next-generation chatbots and autonomous robotics to advanced research laboratories.
YAR.INK v5_Embedding is a state-of-the-art embedding model trained natively into Hyperbolic (Lorentz) space utilizing a custom Matryoshka Representation Learning (MRL) head.
It is the first text embedding model designed from the ground up for highly precise context retrieval, clustering, and structural knowledge discovery in massive datasets while operating in non-Euclidean space.
Hyperbolic geometry naturally models hierarchical data (like language taxonomies and knowledge bases) exponentially better than Euclidean space. By combining this with Matryoshka configurations, our model achieves unparalleled efficiency:
| Model | Recall@1 | MRR@10 | Time (s) | Speed (v/s) | RAM (MB) | CPU (%) | Vector Size (Bytes) | DB Size (KB) | Compression |
|---|---|---|---|---|---|---|---|---|---|
| v5_Embedding_4d Lorentz | 0.7821 | 0.8596 | 46.0 | 12.2 | 4555.6 | 2.5 | 16 | 8.75 | 640x |
| v5_Embedding_8d Lorentz | 0.8393 | 0.8953 | 46.7 | 12.0 | 4571.1 | 2.3 | 32 | 17.50 | 320x |
| v5_Embedding_16d Lorentz | 0.8786 | 0.9276 | 46.3 | 12.1 | 4601.9 | 2.2 | 64 | 35.00 | 160x |
| v5_Embedding_32d Lorentz | 0.9071 | 0.9452 | 46.0 | 12.2 | 4605.5 | 2.3 | 128 | 70.00 | 80x |
| v5_Embedding_64d Lorentz | 0.9393 | 0.9616 | 46.0 | 12.2 | 4609.4 | 2.3 | 256 | 140.00 | 40x |
| v5_Embedding_128d Lorentz | 0.9429 | 0.9650 | 46.0 | 12.2 | 4593.4 | 2.2 | 512 | 280.00 | 20x |
| Qwen3-0.6B-256 Euclidean | 0.8857 | 0.9300 | 46.4 | 12.1 | 12488.9 | 3.8 | 1024 | 560.00 | 10x |
| Qwen3-0.6B-512 Euclidean | 0.8929 | 0.9324 | 46.4 | 12.1 | 12535.2 | 3.6 | 2048 | 1120.00 | 5x |
| Qwen3-0.6B-1024 Euclidean | 0.9000 | 0.9389 | 46.4 | 12.1 | 12537.8 | 3.5 | 4096 | 2240.00 | 2x |
| Qwen3-4B-256 Euclidean | 0.8679 | 0.9197 | 235.9 | 2.4 | 34395.1 | 12.2 | 1024 | 560.00 | 10x |
| Qwen3-4B-512 Euclidean | 0.8929 | 0.9357 | 236.7 | 2.4 | 24326.4 | 12.1 | 2048 | 1120.00 | 5x |
| Qwen3-4B-1024 Euclidean | 0.9071 | 0.9459 | 236.6 | 2.4 | 23784.7 | 12.2 | 4096 | 2240.00 | 2x |
| Qwen3-4B-2560 Euclidean | 0.9036 | 0.9422 | 236.3 | 2.4 | 23785.3 | 12.2 | 10240 | 5600.00 | baseline |
| Qwen3-8B-256 Euclidean | 0.8607 | 0.9174 | 413.4 | 1.4 | 68517.8 | 24.3 | 1024 | 560.00 | 10x |
| Qwen3-8B-512 Euclidean | 0.8893 | 0.9357 | 401.5 | 1.4 | 68539.9 | 24.3 | 2048 | 1120.00 | 5x |
| Qwen3-8B-1024 Euclidean | 0.8893 | 0.9332 | 401.4 | 1.4 | 68592.2 | 24.9 | 4096 | 2240.00 | 2x |
| Qwen3-8B-2048 Euclidean | 0.9000 | 0.9424 | 401.4 | 1.4 | 68644.5 | 24.9 | 8192 | 4480.00 | 1.25x |
| Qwen3-8B-2560 Euclidean | 0.8964 | 0.9398 | 401.4 | 1.4 | 68720.6 | 25.5 | 10240 | 5600.00 | baseline |
| Qwen3-8B-4096 Euclidean | 0.8893 | 0.9358 | 401.4 | 1.4 | 68801.1 | 25.8 | 16384 | 8960.00 | 0.62x |
You must use trust_remote_code=True because this model relies on custom architecture (YarEmbeddingModel, YarConfig) provided directly inside this repository!
import torch
from transformers import AutoTokenizer, AutoModel
model_id = "YARlabs/v5_Embedding"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModel.from_pretrained(model_id, trust_remote_code=True)
model.eval()
texts = [
"What is the capital of France?",
"Paris is the capital of France.",
"Berlin is the capital of Germany."
]
inputs = tokenizer(texts, padding=True, truncation=True, max_length=512, return_tensors="pt")
with torch.no_grad():
# Pass target_dim parameter to explicitly slice the Matryoshka dimensions
# Valid options: 4, 8, 16, 32, 64, 128
# The output is a tensor of shape (batch, target_dim + 1) -> (t, spatial_dims)
lorentz_vectors = model(**inputs, target_dim=64)
print(lorentz_vectors.shape)
# Output: torch.Size([2, 65]) (1 time dimension + 64 spatial dimensions)
For vector search, clustering, NEVER use Cosine Similarity or Euclidean L2 distance! Vectors reside on a Hyperboloid, so you must use the Lorentz Distance.
def lorentz_dist(u: torch.Tensor, v: torch.Tensor) -> torch.Tensor:
"""
Computes the exact Hyperbolic distance between two batches of Lorentz vectors.
"""
# Lorentz Metric signature (- + + ...)
u_0, u_x = u[..., 0:1], u[..., 1:]
v_0, v_x = v[..., 0:1], v[..., 1:]
# Minkowski inner product
inner_product = -u_0 * v_0 + (u_x * v_x).sum(dim=-1, keepdim=True)
# Avoid numerical instability inside acosh for extremely close vectors
inner_product = torch.min(inner_product, torch.tensor(-1.0, device=u.device))
return torch.acosh(-inner_product).squeeze(-1)
# Calculate distance between text 1 and text 2
distance = lorentz_dist(lorentz_vectors[0], lorentz_vectors[1])
print(f"Hyperbolic Distance: {distance.item():.4f}")
Lorentz embeddings represent points on the unit hyperboloid. Every generated vector $(t, x_1, \dots, x_n)$ belongs to the Minkowski manifold and satisfies the following constraint: $$-t^2 + \sum_{i=1}^n x_i^2 = -1, \quad t > 0$$
float16: Hyperbolic geometry is exponentially more sensitive to numerical drift than Euclidean space. Storing these embeddings in float16 will break the manifold constraint and significantly degrade retrieval accuracy.float32 for production storage. If you are using high-performance, strict geometric engines like HyperspaceDB, we recommend using float64 during the indexing phase to ensure zero-drift for $10^{-6}$ precision checks.We provide a langchain_wrapper.py in the repository that natively subclasses LangChain's Embeddings interface.
from langchain_wrapper import YarHyperbolicEmbeddings
# Initialize the embedding model (downloads automatically from YARlabs/v5_Embedding_0.5B)
embeddings = YarHyperbolicEmbeddings(target_dim=128)
vectors = embeddings.embed_documents(["Hello World!"])
Note: Ensure your VectorStore supports custom distance metrics, as these will be returned as Lorentz vectors, where Cosine similarity will not work properly!
Provided explicitly for YAR.INK infrastructure.