A few months ago, we launched the inaugural version of UForm, the efficient Vision-Language Transformer AI model designed for search applications. It was uniquely trained on a balanced multi-lingual dataset spanning 12 languages to empower a wider range of applications all across the globe. Since then, weโve innovated with new techniques to cram even more learning capacity into our compact, cost-effective retrieval-oriented models. Hereโs what UForm v2 brings to the table:
- ๐ Global Reach: UForm v2 speaks Armenian ๐ฆ๐ฒ and 20 popular languages: English ๐บ๐ธ, German ๐ฉ๐ช, French ๐ซ๐ท, Spanish ๐ช๐ธ, Portuguese ๐ต๐น, Italian ๐ฎ๐น, Polish ๐ต๐ฑ, Ukrainian ๐บ๐ฆ, Russian ๐ท๐บ, Turkish ๐น๐ท, Persian ๐ฎ๐ท, Hebrew ๐ฎ๐ฑ, Chinese ๐จ๐ณ, Vietnamese ๐ป๐ณ, Thai ๐น๐ญ, Indonesian ๐ฎ๐ฉ, Korean ๐ฐ๐ท, Japanese ๐ฏ๐ต, with some of the biggest gains in Arabic ๐ธ๐ฆ and Hindi ๐ฎ๐ณ.
- ๐ Peak Performance: While the default OpenCLIP achieves a 73.5% recall (at 10) for English text-to-image search, UForm v2 hits 75.9% in English and exceeds 70% in 10 other languages.
- โก Streamlined Efficiency: Our model crafts embeddings that are half the size (256 dimensions vs. 512), doubling the speed of searches and recommendations. This boost is especially noticeable when paired with our USearch vector-search engine.
- ๐ต Cost-Effective: UForm is open-source and optimized for cheaper and faster inference. In partnership with Graphcore, weโve fine-tuned UForm for model-parallelism, achieving 6x larger batch sizes and unparalleled throughput compared to conventional CLIP models.
Whatโs a release without a demo to showcase it? Weโve melded StreamLit, USearch, and the latest UForm checkpoints with UCall for remote procedure calls. All of those projects are open-source, and free for commercial use, including the demo itself. Check them out on GitHub, jump to the evaluation results, or continue reading for more details.
ยง Training Methodology
- We amalgamated several mid-sized, high-quality datasets: MSCOCO, VG, SBU, CC.
- Captions were translated using NLLB, ensuring each image was paired with 21 distinct captions.
- We expanded on the contrastive pre-training concepts from our previous post, introducing new techniques to maintain cross-lingual attributes.
ยง Evaluation Dataset
MSCOCO stands out as the premier multi-modal retrieval evaluation dataset. However, sourcing its manual translations for popular languages is a challenge, and for many languages we target, itโs an impossibility. Thus, we augmented the evaluation dataset synthetically. This time, we diversified our tools to minimize bias:
- Google Translate API: $20 / 1 Million characters.
- Microsoft Translator API: $10 / 1 Million characters.
- Meta NLLB: Free, provided you have the hardware.
The variance between these three evaluation datasets was minimal. Access all translations and scripts to replicate our benchmarks on GitHub.
ยง Evaluation Results
When benchmarking models, we prioritize two core metrics. The first is recall. โRecall @ ๐ฅโ essentially measures the likelihood (percentage) of the ground-truth best search result appearing within the top ๐ฅ results of the output. For brevity, for every language and ๐ฅ, we have averaged results across all translations. Assuming our training data was also augmented with Metaโs NLLB model, we separately list mean recall for every set of translations in the end of the table.
| Language | OpenCLIP @ 1 | UForm @ 1 | OpenCLIP @ 5 | UForm @ 5 | OpenCLIP @ 10 | UForm @ 10 | Speakers |
|---|---|---|---|---|---|---|---|
| Arabic ๐ธ๐ฆ | 22.7 | 31.7 | 44.9 | 57.8 | 55.8 | 69.2 | 274 M |
| Armenian ๐ฆ๐ฒ | 5.6 | 22.0 | 14.3 | 44.7 | 20.2 | 56.0 | 4 M |
| Chinese ๐จ๐ณ | 27.3 | 32.2 | 51.3 | 59.0 | 62.1 | 70.5 | 1,118 M |
| English ๐บ๐ธ | 37.8 | 37.7 | 63.5 | 65.0 | 73.5 | 75.9 | 1,452 M |
| French ๐ซ๐ท | 31.3 | 35.4 | 56.5 | 62.6 | 67.4 | 73.3 | 274 M |
| German ๐ฉ๐ช | 31.7 | 35.1 | 56.9 | 62.2 | 67.4 | 73.3 | 134 M |
| Hebrew ๐ฎ๐ฑ | 23.7 | 26.7 | 46.3 | 51.8 | 57.0 | 63.5 | 9 M |
| Hindi ๐ฎ๐ณ | 20.7 | 31.3 | 42.5 | 57.9 | 53.7 | 69.6 | 602 M |
| Indonesian ๐ฎ๐ฉ | 26.9 | 30.7 | 51.4 | 57.0 | 62.7 | 68.6 | 199 M |
| Italian ๐ฎ๐น | 31.3 | 34.9 | 56.7 | 62.1 | 67.1 | 73.1 | 67 M |
| Japanese ๐ฏ๐ต | 27.4 | 32.6 | 51.5 | 59.2 | 62.6 | 70.6 | 125 M |
| Korean ๐ฐ๐ท | 24.4 | 31.5 | 48.1 | 57.8 | 59.2 | 69.2 | 81 M |
| Persian ๐ฎ๐ท | 24.0 | 28.8 | 47.0 | 54.6 | 57.8 | 66.2 | 77 M |
| Polish ๐ต๐ฑ | 29.2 | 33.6 | 53.9 | 60.1 | 64.7 | 71.3 | 41 M |
| Portuguese ๐ต๐น | 31.6 | 32.7 | 57.1 | 59.6 | 67.9 | 71.0 | 257 M |
| Russian ๐ท๐บ | 29.9 | 33.9 | 54.8 | 60.9 | 65.8 | 72.0 | 258 M |
| Spanish ๐ช๐ธ | 32.6 | 35.6 | 58.0 | 62.8 | 68.8 | 73.7 | 548 M |
| Thai ๐น๐ญ | 21.5 | 28.7 | 43.0 | 54.6 | 53.7 | 66.0 | 61 M |
| Turkish ๐น๐ท | 25.5 | 33.0 | 49.1 | 59.6 | 60.3 | 70.8 | 88 M |
| Ukranian ๐บ๐ฆ | 26.0 | 30.6 | 49.9 | 56.7 | 60.9 | 68.1 | 41 M |
| Vietnamese ๐ป๐ณ | 25.4 | 28.3 | 49.2 | 53.9 | 60.3 | 65.5 | 85 M |
| Mean | 26.5ยฑ6.4 | 31.8ยฑ3.5 | 49.8ยฑ9.8 | 58.1ยฑ4.5 | 60.4ยฑ10.6 | 69.4ยฑ4.3 | - |
| Google Translate | 27.4ยฑ6.3 | 31.5ยฑ3.5 | 51.1ยฑ9.5 | 57.8ยฑ4.4 | 61.7ยฑ10.3 | 69.1ยฑ4.3 | - |
| Microsoft Translator | 27.2ยฑ6.4 | 31.4ยฑ3.6 | 50.8ยฑ9.8 | 57.7ยฑ4.7 | 61.4ยฑ10.6 | 68.9ยฑ4.6 | - |
| Meta NLLB | 24.9ยฑ6.7 | 32.4ยฑ3.5 | 47.5ยฑ10.3 | 58.9ยฑ4.5 | 58.2ยฑ11.2 | 70.2ยฑ4.3 | - |
Summarizing the results:
- OpenCLIP slightly edges out with a 0.1% higher โrecall @ 1โ, but falls behind in all other metrics.
- Languages under-represented in CommonCrawl and other common datasets saw significant improvement.
- Even the most popular language groups can benefit from data-efficient pre-training techniques.
- UForm has natural bias towards NLLB, noticeable during evaluation.
Delving into the third point, both Chinese and Hindi experienced a substantial boost, with Hindiโs โrecall @ 1โ jumping from 20.4% to 30.8%, and its โrecall @ 10โ soaring from 53.3% to 69.1%. These improvements, however, focus on retrieval tasks, and donโt mean you should expect good results on other multi-modal tasks, such as zero-shot ImageNet classification. That, however, is part of our ongoing effort and will be improved in UForm v3.
| ๐ธ๐ฆ | ๐ฆ๐ฒ | ๐จ๐ณ | ๐ซ๐ท | ๐ฉ๐ช | ๐ฎ๐ฑ | ๐ฎ๐ณ | ๐ฎ๐ฉ | ๐ฎ๐น | ๐ฏ๐ต | ๐ฐ๐ท | ๐ฎ๐ท | ๐ต๐ฑ | ๐ต๐น | ๐ท๐บ | ๐ช๐ธ | ๐น๐ญ | ๐น๐ท | ๐บ๐ฆ | ๐ป๐ณ | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| OpenCLIP NDCG | 0.639 | 0.204 | 0.731 | 0.823 | 0.806 | 0.657 | 0.616 | 0.733 | 0.811 | 0.737 | 0.686 | 0.667 | 0.764 | 0.832 | 0.777 | 0.849 | 0.606 | 0.701 | 0.704 | 0.697 |
| UForm NDCG | 0.868 | 0.691 | 0.880 | 0.932 | 0.927 | 0.791 | 0.879 | 0.870 | 0.930 | 0.885 | 0.869 | 0.831 | 0.897 | 0.897 | 0.906 | 0.939 | 0.822 | 0.898 | 0.851 | 0.818 |
The second metric we emphasize is the Normalized Discounted Cumulative Gain (NDCG), typically used to assess ranking quality. In the absence of a definitive ground-truth multi-lingual ranking, we use English as a benchmark for other languages. A higher NDCG score indicates more consistent model behavior for a particular language. For a comprehensive view, we evaluate the top 20 results across all languages. On average, the NDCG for OpenCLIP is 0.716ยฑ0.149 across 20 languages. For UForm it grows to 0.875ยฑ0.064, with higher than 0.9 scores for Spanish, Italian, French, German, and Russian. These results are important step forward in our quest for better aligned multi-modal representations, which are still horrible, even for 10x larger models trained on 1000x more data.
ยง PyTorch, PopTorch, and Graphcore
In the past, UFormโs inference library was entangled with numerous high-level dependencies, making version transitions unpredictable. Weโve since refactored the core classes down to pure PyTorch. This not only enhances performance but also ensures UForm deployments are more stable than most high-level AI libraries. But we didnโt stop at PyTorch. Recognizing the surge in specialized high-performance AI hardware, weโve adapted UForm for PopTorch. This means UForm is ready to run on Graphcore IPUs right out of the box, seamlessly handling model-parallelism.
import uform
import poptorch
import PIL as pil
options = poptorch.Options()
model = uform.get_model_ipu('unum-cloud/uform-vl-english')
model = poptorch.inferenceModel(model, options=options)
text = 'a small red panda in a zoo'
image = pil.Image.open('red_panda.jpg')
image_data = model.preprocess_image(image)
text_data = model.preprocess_text(text)
image_features, text_features = model(image_data, text_data)Running on IPUs is akin to operating on GPUs. First, ensure the drivers are correctly set up. Next, download the desired model. Lastly, feed in your data. UForm offers flexibility, allowing for both model-parallel and data-parallel operations. The code snippet below demonstrates how to distribute the model across 4 IPUs. Additionally, it replicates this sharded setup fourfold, aiming to utilize a total of 16 IPUs simultaneously.
options = poptorch.Options()
options.replicationFactor(4)
options.deviceIterations(4)
model = uform.get_model_ipu('unum-cloud/uform-vl-english').parallelize()
model = poptorch.inferenceModel(model, options=options)Similarly, we have ported the model to Appleโs CoreML for mobile inference on iOS, and ONNX for broader adoption. Still, need assistance integrating Semantic Search into your application? Donโt hesitate โ join us on Discord ๐ค
