|
| 1 | + |
| 2 | +--- |
| 3 | +draft: false |
| 4 | +date: 2025-05-25 |
| 5 | +authors: |
| 6 | + - sonam |
| 7 | +slug: cohere, weaviate, jina |
| 8 | +title: Release Notes 5.6 |
| 9 | +--- |
| 10 | + |
| 11 | +Super Excited to share the latest development in our library, which essentially giving you more embedding choices -- Cohere and siglip, new chunking method-- late chunking and more crates that facilitates amazing modality and maintainability for our rust codebase, --processor crate. so let's dive in. |
| 12 | + |
| 13 | +<!-- more --> |
| 14 | + |
| 15 | +## Support for late chunking. |
| 16 | + |
| 17 | +The new 0.5.6 version adds Late Chunking to EmbedAnything, a technique introduced by Jina AI and Weaviate. |
| 18 | +Here's how we've implemented Late Chunking in EA: |
| 19 | + |
| 20 | +𝗕𝗮𝘁𝗰𝗵 𝗮𝘀 𝗖𝗵𝘂𝗻𝗸 𝗚𝗿𝗼𝘂𝗽: In EmbedAnything, with late chunking enabled, the batch size determines the number of neighboring chunks that will be processed together. |
| 21 | + |
| 22 | +𝗝𝗼𝗶𝗻𝘁 𝗘𝗺𝗯𝗲𝗱𝗱𝗶𝗻𝗴: The grouped chunks are fed into the embedding model as a single, larger input. This allows the model to capture relationships and dependencies between adjacent chunks. |
| 23 | + |
| 24 | +𝗘𝗺𝗯𝗲𝗱𝗱𝗶𝗻𝗴 𝗦𝗽𝗹𝗶𝘁: After embedding, the combined output is divided back into the embeddings for the original, individual chunks. |
| 25 | + |
| 26 | +𝗠𝗲𝗮𝗻 𝗣𝗼𝗼𝗹𝗶𝗻𝗴 (𝗽𝗲𝗿 𝗖𝗵𝘂𝗻𝗸): Mean pooling is then applied to each individual chunk's embedding, incorporating the contextual information learned during the joint embedding phase. |
| 27 | + |
| 28 | +𝐾𝑒𝑦 𝐵𝑒𝑛𝑒𝑓𝑖𝑡𝑠: |
| 29 | + |
| 30 | +𝗖𝗼𝗻𝘁𝗲𝘅𝘁-𝗔𝘄𝗮𝗿𝗲 𝗘𝗺𝗯𝗲𝗱𝗱𝗶𝗻𝗴𝘀: By embedding neighboring chunks together, we capture crucial contextual information that would be lost with independent chunking. |
| 31 | + |
| 32 | +𝗢𝗽𝘁𝗶𝗺𝗶𝘇𝗲𝗱 𝗥𝗲𝘁𝗿𝗶𝗲𝘃𝗮𝗹 𝗣𝗲𝗿𝗳𝗼𝗿𝗺𝗮𝗻𝗰𝗲: Expect a significant improvement in the accuracy and relevance of your search results. |
| 33 | + |
| 34 | +```python |
| 35 | +model:EmbeddingModel = EmbeddingModel.from_pretrained_onnx( |
| 36 | + WhichModel.Jina, hf_model_id="jinaai/jina-embeddings-v2-small-en", path_in_repo="model.onnx" |
| 37 | +) |
| 38 | +config = TextEmbedConfig( |
| 39 | + chunk_size=1000, |
| 40 | + batch_size=8, |
| 41 | + splitting_strategy="sentence", |
| 42 | + late_chunking=True, |
| 43 | +) |
| 44 | + |
| 45 | +# Embed a single file |
| 46 | +data: list[EmbedData] = model.embed_file("test_files/attention.pdf", config=config) |
| 47 | +``` |
| 48 | + |
| 49 | + |
| 50 | +## 𝘊𝘰𝘩𝘦𝘳𝘦 𝘌𝘮𝘣𝘦𝘥 4: |
| 51 | + |
| 52 | +🧊 Single embedding per document, even for multimodal inputs |
| 53 | +📚 Handles up to 128K tokens – perfect for long-form business documents |
| 54 | +🗃️ Supports compressed vector formats (int8, binary) for real-world scalability |
| 55 | +🌐 Multilingual across 100+ languages |
| 56 | + |
| 57 | +The catch? It’s not open-source—and even if it were, the model would be quite hefty to run locally. But if you’re already using cloud-based embeddings like OpenAI’s, Embed v4 is worth testing. |
| 58 | + |
| 59 | +```python |
| 60 | +# Initialize the model once |
| 61 | +model: EmbeddingModel = EmbeddingModel.from_pretrained_cloud( |
| 62 | + WhichModel.CohereVision, model_id="embed-v4.0" |
| 63 | +) |
| 64 | + |
| 65 | +``` |
| 66 | + |
| 67 | +## SigLIP |
| 68 | + |
| 69 | +We already had Clip support but many of you asked for siglip support. It out performs clip for zero shot classification for smaller batch. It also has better memory efficinecy. |
| 70 | + |
| 71 | +```python |
| 72 | +# Load the model. |
| 73 | +model = embed_anything.EmbeddingModel.from_pretrained_hf( |
| 74 | + embed_anything.WhichModel.Clip, |
| 75 | + model_id="google/siglip-base-patch16-224", |
| 76 | +) |
| 77 | +``` |
| 78 | + |
| 79 | +## Processor Crate: |
| 80 | + |
| 81 | +This crate contains various "processors" that accept files/folders/bytes and produced a chunked, metadata-rich document description. This is especially helpful for retrieval-augmented generation! |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | +We have also received some additional cool feature requests on GitHub, which we would like to implement. If you want to help out please check out EmbedAnything on GitHub. We would love to have a contribution. 🚀 |
| 88 | + |
| 89 | + |
| 90 | + |
0 commit comments