| --- | |
| language: | |
| - en | |
| - zh | |
| - multilingual | |
| license: apache-2.0 | |
| library_name: sentence-transformers | |
| tags: | |
| - sentence-transformers | |
| - sentence-similarity | |
| - feature-extraction | |
| - embedding | |
| - text-embedding | |
| - retrieval | |
| pipeline_tag: sentence-similarity | |
| base_model: Qwen/Qwen3-Embedding-4B | |
| --- | |
| # Octen-Embedding-4B | |
| Octen-Embedding-4B is a text embedding model designed for semantic search and retrieval tasks. This model is fine-tuned from [Qwen/Qwen3-Embedding-4B](https://huggingface.co/Qwen/Qwen3-Embedding-4B) and supports multiple languages, providing high-quality embeddings for various applications. | |
| ## Model Details | |
| - **Base Model**: [Qwen/Qwen3-Embedding-4B](https://huggingface.co/Qwen/Qwen3-Embedding-4B) | |
| - **Model Size**: 4B parameters | |
| - **Max Sequence Length**: 40,960 tokens | |
| - **Embedding Dimension**: 2560 | |
| - **Languages**: English, Chinese, and multilingual support | |
| - **Training Method**: LoRA fine-tuning | |
| ## Usage | |
| ### Using Sentence Transformers | |
| ```python | |
| from sentence_transformers import SentenceTransformer | |
| model = SentenceTransformer("Octen/Octen-Embedding-4B") | |
| # Encode sentences | |
| sentences = [ | |
| "This is an example sentence", | |
| "Each sentence is converted to a vector" | |
| ] | |
| embeddings = model.encode(sentences) | |
| print(embeddings.shape) | |
| # Output: (2, 2560) | |
| # Compute similarity | |
| from sentence_transformers.util import cos_sim | |
| similarity = cos_sim(embeddings[0], embeddings[1]) | |
| print(f"Similarity: {similarity.item():.4f}") | |
| ``` | |
| ### Using Transformers | |
| ```python | |
| from transformers import AutoModel, AutoTokenizer | |
| import torch | |
| import torch.nn.functional as F | |
| tokenizer = AutoTokenizer.from_pretrained("Octen/Octen-Embedding-4B", padding_side="left") | |
| model = AutoModel.from_pretrained("Octen/Octen-Embedding-4B") | |
| model.eval() | |
| def encode(texts): | |
| inputs = tokenizer(texts, padding=True, truncation=True, | |
| max_length=8192, return_tensors="pt") | |
| with torch.no_grad(): | |
| outputs = model(**inputs) | |
| # Use last token embedding | |
| embeddings = outputs.last_hidden_state[:, -1, :] | |
| # Normalize embeddings | |
| embeddings = F.normalize(embeddings, p=2, dim=1) | |
| return embeddings | |
| # Example usage | |
| texts = ["Hello world", "你好世界"] | |
| embeddings = encode(texts) | |
| similarity = torch.matmul(embeddings[0], embeddings[1]) | |
| print(f"Similarity: {similarity.item():.4f}") | |
| ``` | |
| ## Recommended Use Cases | |
| - Semantic search and information retrieval | |
| - Document similarity and clustering | |
| - Question answering | |
| - Cross-lingual retrieval | |
| - Text classification with embeddings | |
| ## Limitations | |
| - Performance may vary across different domains and languages | |
| - Very long documents (>40K tokens) require truncation | |
| - Optimized for retrieval tasks, not for text generation | |
| ## License | |
| This model is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). | |
| This model is derived from [Qwen/Qwen3-Embedding-4B](https://huggingface.co/Qwen/Qwen3-Embedding-4B), which is also licensed under Apache License 2.0. | |
| ## Paper | |
| For more details, please refer to our blog post: [Octen-Embedding: Reproducible 1st Place on RTEB](https://octen-team.github.io/octen_blog/posts/octen-rteb-first-place/) | |
| ## Citation | |
| If you find our work helpful, please consider citing: | |
| ```bibtex | |
| @misc{octen2025rteb, | |
| title={Octen-Embedding: Reproducible 1st Place on RTEB}, | |
| author={Octen Team}, | |
| year={2025}, | |
| url={https://octen-team.github.io/octen_blog/posts/octen-rteb-first-place/} | |
| } | |
| ``` | |