<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jina AI</title>
    <description>The latest articles on DEV Community by Jina AI (@jinaai).</description>
    <link>https://dev.to/jinaai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F993482%2F7037ac7f-0400-461b-8ad4-10fde3c9bcdd.jpg</url>
      <title>DEV Community: Jina AI</title>
      <link>https://dev.to/jinaai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jinaai"/>
    <language>en</language>
    <item>
      <title>How to Use Every Vector Database in Python with DocArray</title>
      <dc:creator>Jina AI</dc:creator>
      <pubDate>Wed, 11 Jan 2023 13:48:39 +0000</pubDate>
      <link>https://dev.to/jinaai/how-to-use-every-vector-database-in-python-with-docarray-2dol</link>
      <guid>https://dev.to/jinaai/how-to-use-every-vector-database-in-python-with-docarray-2dol</guid>
      <description>&lt;p&gt;Back in the day, pre-Google, the Internet was mostly text. Whether it was news updates, sports scores, blog posts or emails, ASCII and Unicode were the way to go.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--egUQm93j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2m5omvz1j0qkvxle5sao.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--egUQm93j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2m5omvz1j0qkvxle5sao.png" alt="Image description" width="880" height="503"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Aaah, the good old days. Just pure ASCII as God intended.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But nowadays, data is becoming increasingly complex and multimodal, mostly coming in unstructured forms such as images, videos, text, 3D mesh, etc. Gone are the days of being limited to 26 characters and 10 numbers (or more for other character sets). Now there’s much more stuff to deal with.&lt;/p&gt;

&lt;p&gt;Just think about your favorite YouTube videos, Spotify songs, or game NPCs.&lt;/p&gt;

&lt;p&gt;Typical databases can’t handle these kinds of multimodal data. They can only store and process structured data (like simple text strings or numbers). This really limits our ability to extract valuable business insights and value from a huge chunk of the 21st century's data.&lt;/p&gt;

&lt;p&gt;Lucky for us, recent advancements in machine learning techniques and approximate nearest neighbor search have made it possible to better utilize unstructured data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Deep learning models and representation learning to effectively represent complex data using vector embeddings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Vector databases leverage vector embeddings to store and analyze unstructured data.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What are vector databases?
&lt;/h2&gt;

&lt;p&gt;A vector database is a type of database that can index and retrieve data using vectors, similar to how a traditional database uses keys or text to search for items using an index.&lt;/p&gt;

&lt;p&gt;A vector database uses a &lt;strong&gt;vector index&lt;/strong&gt; to enable fast retrieval and insertion by a vector, and also offers typical database features such as CRUD operations, filtering, and scalability.&lt;/p&gt;

&lt;p&gt;This gives us the best of both worlds - we get the CRUDiness of traditional databases, coupled with the ability to store complex, unstructured data like images, videos, and 3D meshes.&lt;/p&gt;

&lt;p&gt;So, vector databases are great, right? What’s even more awesome is having a library to use them all while being capable of handling unstructured data at the same time! One unstructured data library to rule them all!&lt;/p&gt;

&lt;p&gt;We are, of course, talking about &lt;a href="https://github.com/docarray/docarray"&gt;DocArray&lt;/a&gt;. Let’s see what this project is all about.&lt;/p&gt;

&lt;h2&gt;
  
  
  DocArray's universal Pythonic API to all vector databases
&lt;/h2&gt;

&lt;p&gt;As the description suggests on the &lt;a href="https://github.com/docarray/docarray"&gt;project home page&lt;/a&gt;, DocArray is a library for nested, unstructured and multimodal data.&lt;/p&gt;

&lt;p&gt;This means that if you want to process unstructured data and represent it as vectors, DocArray is perfect for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DocArray is also a universal entrypoint for many vector databases.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T9mi6UF0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkfu614x9qes9xnek5rk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T9mi6UF0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkfu614x9qes9xnek5rk.png" alt="Image description" width="880" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the remainder of this post, we’ll be using DocArray to index and search data in the &lt;a href="https://amazon-berkeley-objects.s3.amazonaws.com/index.html"&gt;Amazon Berkeley Objects Dataset&lt;/a&gt;. This dataset contains product items with accompanying images and metadata such as brand, country, and color, and represents the inventory of an e-commerce website.&lt;/p&gt;

&lt;p&gt;Although a traditional database can perform filtering on metadata, it is unable to search image data or other unstructured data formats. That’s why we’re using a vector database!&lt;/p&gt;

&lt;p&gt;We’ll start by loading &lt;a href="https://github.com/jina-ai/product-recommendation-redis-docarray/tree/main/data"&gt;a subset of the Amazon Berkeley Objects Dataset&lt;/a&gt; that comes in CSV format into DocArray and computing vector embeddings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ylxV2doP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kvn54odftb5vnnaqwl5w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ylxV2doP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kvn54odftb5vnnaqwl5w.png" alt="Image description" width="880" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sample images from the dataset&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then, we'll use DocArray with each database to perform search and insertion operations using vectors.&lt;/p&gt;

&lt;p&gt;We’ll use the following databases via DocArray in Python:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Milvus&lt;/strong&gt; - cloud-native vector database with storage and computation separated by design&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Weaviate&lt;/strong&gt; - vector search engine that stores both objects and vectors and can be accessed through REST or GraphQL&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Qdrant&lt;/strong&gt; - vector database written in Rust and designed to be fast and reliable under high loads&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Redis&lt;/strong&gt; - in-memory key-value database that supports different kinds of data structures with vector search capabilities&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ElasticSearch&lt;/strong&gt; - distributed, RESTful search engine with Approximate Nearest Neighbor search capabilities&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;OpenSearch - open-source search software based on Apache Lucene originally forked from ElasticSearch&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AnnLite - a Python library for fast Approximate Nearest Neighbor Search with filtering capabilities&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For each database, we’ll:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Setup the database and install requirements&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Index the data in the vector database&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Perform a vector search operation with filtering&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Display the search results&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C9sHFewy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wncjh0leej19vbd9cqev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C9sHFewy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wncjh0leej19vbd9cqev.png" alt="Image description" width="880" height="82"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next few chapters, we'll show you how to prepare the data, generating embeddings, preparing a search Document, indexing the data. &lt;strong&gt;&lt;a href="https://jina.ai/news/how-to-use-every-vector-database-in-python-with-docarray/?utm_campaign=how-to-use-every-vector-database-in-python-with-docarray&amp;amp;utm_source=dev.to&amp;amp;utm_medium=post"&gt;Read the whole article&lt;/a&gt;&lt;/strong&gt;. &lt;/p&gt;

</description>
      <category>python</category>
      <category>database</category>
      <category>docarray</category>
      <category>vector</category>
    </item>
    <item>
      <title>From Confused to Confident: How Rationale Can Help You Make Better Decisions with AI</title>
      <dc:creator>Jina AI</dc:creator>
      <pubDate>Tue, 10 Jan 2023 12:42:57 +0000</pubDate>
      <link>https://dev.to/jinaai/from-confused-to-confident-how-rationale-can-help-you-make-better-decisions-with-ai-4j1a</link>
      <guid>https://dev.to/jinaai/from-confused-to-confident-how-rationale-can-help-you-make-better-decisions-with-ai-4j1a</guid>
      <description>&lt;p&gt;&lt;strong&gt;Need help making decisions? Rationale is the impartial tool you need. No more endless reading or expensive consultants. Get the information you need without the bias.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;'Twas the night before Christmas,&lt;br&gt;
And all through the house,&lt;br&gt;
Not a creature was stirring,&lt;br&gt;
Not even a mouse.'&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0nex0l0e3ih4yd1rv2a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0nex0l0e3ih4yd1rv2a.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Scene: Jina AI's CEO, Han Xiao, sitting in front of a dwindling fireplace, typing feverishly into his laptop. His hair is disheveled and his five o'clock shadow is now looking more like eight o'clock. We zoom in on him to hear him tell his story&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;VOICEOVER: HAN&lt;br&gt;
Indeed, not a mouse was stirring that night. But one was clicking, as I sat at my laptop and worked through the wee hours.&lt;/p&gt;

&lt;p&gt;As I sat in front of the fireplace, the warmth of the flames soothing my tired eyes, I couldn't help but feel a sense of purpose. I had been working tirelessly on a project that I believed could change the world for the better. I was driven by a deep desire to use my skills and expertise to make a positive impact, to help people make more informed, smarter decisions.&lt;/p&gt;

&lt;p&gt;And possibly (just possibly) put those overpriced arrogant bastards at McKinsey out of a job.&lt;/p&gt;

&lt;p&gt;But it wasn't easy. The hours were long and the work was grueling. I had sacrificed time with friends and family, even skipping out on Christmas celebrations, just to see this project through to the end.&lt;/p&gt;

&lt;p&gt;And there were moments of doubt, when I questioned whether it was all worth it. As I sipped on my cold cocoa and watched the fire die, I couldn't help but feel a twinge of sadness. "Bah, humbug," I muttered to myself, feeling the weight of my solitude.&lt;/p&gt;

&lt;p&gt;So, what is this project? I'll give you a hint: I had previously written about how &lt;a href="https://jina.ai/news/seo-is-dead-long-live-llmo/" rel="noopener noreferrer"&gt;LLMO would kill SEO&lt;/a&gt;, but I wanted to take large language models further and apply them to more areas of everyday life. ChatGPT and generative AI in general have been causing a lot of concern about putting people out of jobs, but I believe we can use this technology to help people instead. That's why I'm launching &lt;a href="https://rationale.jina.ai/" rel="noopener noreferrer"&gt;Rationale&lt;/a&gt;, a product that I hope will make a difference in the world.&lt;/p&gt;

&lt;h2&gt;
  
  
  What problem does Rationale solve?
&lt;/h2&gt;

&lt;p&gt;Making decisions is tough.We're drowning in information that we have to take action on. And then, on top of that, we need to find more information to work out exactly which actions to take.&lt;/p&gt;

&lt;p&gt;And that second level of information? Search engines return pages and pages of bullshit sites that disagree with each other, and some questions just aren't easy to research. For example: &lt;em&gt;As the CEO of a 2 year old startup with 50 employees and series A funding, should I give my employees a raise during these difficult financial times?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjbeglgxmk1fnkshelcla.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjbeglgxmk1fnkshelcla.png" alt="Image description" width="797" height="665"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Good luck getting something that even matches enough search terms, let alone provides guidance.&lt;/p&gt;

&lt;p&gt;There needs to be an impartial tool to help you make decisions that returns just the information you need. Rationale does that. You don't need to read through countless articles or fork money over to expensive consultants who'll recommend doing what you were going to do anyway.&lt;/p&gt;

&lt;p&gt;While Rationale won't tell you what to do, it will give pros and cons or a SWOT analysis about your potential course of action. Simple as that. No endless googling. No frills. No bullshit.&lt;/p&gt;

&lt;p&gt;So what &lt;em&gt;is&lt;/em&gt; Rationale? Click &lt;a href="https://jina.ai/news/confused-confident-rationale-can-help-make-better-decisions-ai/?utm_campaign=from-confused-to-confident&amp;amp;utm_source=dev.to&amp;amp;utm_medium=post"&gt;here&lt;/a&gt; to learn more examples, and &lt;em&gt;why can't I just use ChatGPT for this?&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>softwareengineering</category>
      <category>paperswelove</category>
    </item>
    <item>
      <title>Can a decision-making tool be powered by GPT?</title>
      <dc:creator>Jina AI</dc:creator>
      <pubDate>Tue, 03 Jan 2023 15:22:46 +0000</pubDate>
      <link>https://dev.to/jinaai/can-a-decision-making-tool-be-powered-by-gpt-3ejb</link>
      <guid>https://dev.to/jinaai/can-a-decision-making-tool-be-powered-by-gpt-3ejb</guid>
      <description>&lt;p&gt;With the incredible capabilities of generative AI, 2023 is shaping up to be a game-changing year for startups and builders. Don’t just take our word for it; try Rationale out for yourself and see the difference it can make for your business. Get started today!&lt;/p&gt;

&lt;p&gt;Today, we're thrilled to announce &lt;a href="https://rationale.jina.ai/" rel="noopener noreferrer"&gt;Rationale&lt;/a&gt;, an AI-powered decision-making tool that's here to help business owners, managers, and individuals make tough decisions with confidence.&lt;/p&gt;

&lt;p&gt;Decision-making can be a daunting task, especially when you have to weigh multiple factors and consider the potential consequences of your choices. That's where Rationale comes in. With state-of-the-art GPT3.x and in-context learning algorithms, our app is specifically designed to help you make informed decisions.&lt;/p&gt;

&lt;p&gt;In this new release, you'll learn: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Pros &amp;amp; Cons listing &amp;amp; SWOT analysis&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4hiz77l4gqecou8k976.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4hiz77l4gqecou8k976.png" alt="Image description" width="800" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Personalized analysis&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ubx0rf6ov4s05djy9xi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ubx0rf6ov4s05djy9xi.png" alt="Image description" width="800" height="721"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Multilingual support&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F26gf4qmuu5zjk7cy9p0x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F26gf4qmuu5zjk7cy9p0x.png" alt="Image description" width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Universal experience on every device&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6zxae3z6zxvowacevm5q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6zxae3z6zxvowacevm5q.png" alt="Image description" width="800" height="546"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;a href="https://jina.ai/news/introducing-rationale-decision-making-tool-powered-latest-gpt-context-learning/?utm_campaign=introducing-rationale&amp;amp;utm_source=dev.to&amp;amp;utm_medium=post"&gt;here&lt;/a&gt; to get 50% off on your first purchase&lt;/p&gt;

</description>
      <category>watercooler</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Want to Search Inside Videos Like a Pro? CLIP-as-service Can Help</title>
      <dc:creator>Jina AI</dc:creator>
      <pubDate>Fri, 30 Dec 2022 14:14:37 +0000</pubDate>
      <link>https://dev.to/jinaai/want-to-search-inside-videos-like-a-pro-clip-as-service-can-help-1dp8</link>
      <guid>https://dev.to/jinaai/want-to-search-inside-videos-like-a-pro-clip-as-service-can-help-1dp8</guid>
      <description>&lt;p&gt;Wouldn’t it be great if you could search through a video the way you search through a text?&lt;/p&gt;

&lt;p&gt;Imagine opening a digitized film, just hitting ctrl-f and typing “Santa”, then getting all the parts of the video with Santa Claus in it. Or just going to the command line and using the grep command:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu5lmf9dt6u408v7ktamx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu5lmf9dt6u408v7ktamx.png" alt="Image description" width="800" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Normally, this would be impossible, or only possible if you had gone through the film and carefully labeled all the parts with a Santa in them already. But with Jina AI and CLIP-as-service, you can create a video grep command for MP4 film with just a few Python functions and a standard computer setup. There is no need for a GPU and no complex AI tech stack to install, just off-the-shelf and open-source Python libraries, with Jina AI Cloud doing all the heavy lifting.&lt;/p&gt;

&lt;p&gt;This has immediate applications for anyone who has video data: film archivists, stock image vendors, news photographers, or even regular people who just keep videos from their cellphones around and post them to social media.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preliminaries
&lt;/h2&gt;

&lt;p&gt;You need Python 3, and you might want to create a new virtual environment before starting. Then, install a few components at the command line with pip:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi975zg63kamnzfx2uzpp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi975zg63kamnzfx2uzpp.png" alt="Image description" width="800" height="69"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This installs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Jina AI’s &lt;a href="https://docarray.jina.ai/" rel="noopener noreferrer"&gt;DocArray library&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Jina AI’s &lt;a href="https://clip-as-service.jina.ai/" rel="noopener noreferrer"&gt;CLIP-as-service&lt;/a&gt; client&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;If you want to learn more how imagine an #AI-powered grep command, one that could process a film and find segments matching a text. With Jina AI's CLIP-as-service, you can rea more &lt;a href="https://jina.ai/news/?utm_campaign=jina-news&amp;amp;utm_source=dev.to&amp;amp;utm_medium=post"&gt;here&lt;/a&gt;&lt;/u&gt;&lt;/p&gt;

</description>
      <category>help</category>
    </item>
    <item>
      <title>Improving Search Quality for Non-English Queries with Fine-tuned Multilingual CLIP Models</title>
      <dc:creator>Jina AI</dc:creator>
      <pubDate>Thu, 22 Dec 2022 17:19:56 +0000</pubDate>
      <link>https://dev.to/jinaai/improving-search-quality-for-non-english-queries-with-fine-tuned-multilingual-clip-models-m5f</link>
      <guid>https://dev.to/jinaai/improving-search-quality-for-non-english-queries-with-fine-tuned-multilingual-clip-models-m5f</guid>
      <description>&lt;p&gt;Since early 2021, &lt;a href="https://openai.com/blog/clip/"&gt;CLIP-style models&lt;/a&gt; have been the backbone of &lt;a href="https://jina.ai/news/what-is-multimodal-deep-learning-and-what-are-the-applications/"&gt;multimodal AI&lt;/a&gt;. They work by embedding inputs from more than one kind of media into a common high-dimensional vector space, using different models for different modalities. These different models are co-trained with multimodal data. For CLIP models, this means images with captions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PfCo-kqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wtx4ve4uqc1akn3ybl4a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PfCo-kqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wtx4ve4uqc1akn3ybl4a.png" alt="Image description" width="880" height="648"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;A highly schematic representation of how CLIP embeddings make it possible to associate texts with images.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The result? A pair of models that embed images and texts close to each other if the text is descriptive of the image, or the image contains things that match the text. So if we have a picture of a skirt and the word “Rock” (German for “skirt”), they would be close together, while the word “Hemd” (German for “shirt”) would be closer to a picture of a shirt.&lt;/p&gt;

&lt;h2&gt;
  
  
  Towards multilingual CLIP
&lt;/h2&gt;

&lt;p&gt;However, CLIP text models have mostly been trained on English data, and that’s a big problem: The world is full of people who don’t speak English.&lt;/p&gt;

&lt;p&gt;Very recently, a few non-English and multilingual CLIP models have appeared, using various sources of training data. In this article, we’ll evaluate a multilingual CLIP model’s performance in a language other than English, and show how you can improve it even further using Jina AI’s Finetuner.&lt;/p&gt;

&lt;p&gt;To make this happen, we’re collaborating with Toloka, a leading provider of data procurement services for machine learning, to create a dataset of images with high-quality German-language descriptions written by humans.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does multilingual CLIP work?
&lt;/h2&gt;

&lt;p&gt;Multilingual CLIP is any CLIP model trained with more than one language. So that could be English+French, German+English, or even Klingon+Elvish.&lt;/p&gt;

&lt;p&gt;We’re going to look at a model that &lt;a href="https://openai.com/"&gt;Open AI&lt;/a&gt; has trained with a broad multilingual dataset: The &lt;a href="https://huggingface.co/laion/CLIP-ViT-B-32-xlm-roberta-base-laion5B-s13B-b90k"&gt;xlm-roberta-base-ViT-B-32&lt;/a&gt; CLIP model, which uses the &lt;a href="https://github.com/google-research/vision_transformer"&gt;ViT-B/32&lt;/a&gt;image encoder, and the &lt;a href="https://huggingface.co/xlm-roberta-large"&gt;XLM-RoBERTa&lt;/a&gt; multilingual language model. Both of these are pre-trained:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;ViT-B/32, using the &lt;a href="https://github.com/Alibaba-MIIL/ImageNet21K"&gt;ImageNet-21k&lt;/a&gt; dataset&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;XLM-RoBERTa, using a multi-terabyte dataset of text from the Common Crawl, containing over 100 languages.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, from the outset, multilingual CLIP is different because it uses a multilingual text encoder, but can (and generally does) use the same image encoders as monolingual models.&lt;/p&gt;

&lt;p&gt;Open AI then co-trained the two encoders with the multilingual &lt;a href="https://laion.ai/blog/laion-5b/"&gt;laion5b&lt;/a&gt; dataset, which contains 5.85 billion image-text pairs: 2.2 billion of these pairs are labelled in 100+ non-English languages, with the rest in English or containing text that can’t be nailed down to any one language (like place names or other proper nouns). These are taken from a sampling of images and their &lt;a href="https://www.w3schools.com/tags/att_img_alt.asp"&gt;HTML alt-text&lt;/a&gt; in the &lt;a href="https://commoncrawl.org/"&gt;Common Crawl web archive&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v243DHK4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mfqwpyovxvmbjc3fxsl2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v243DHK4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mfqwpyovxvmbjc3fxsl2.png" alt="Image description" width="880" height="876"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Some browsers will let you see the alt-text if you move your mouse over an image.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xROwfqSw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7h6q5zlxrmq7omyllqxu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xROwfqSw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7h6q5zlxrmq7omyllqxu.png" alt="Image description" width="858" height="144"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;How an alt-text is encoded in HTML.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This dataset isn’t balanced in the sense that no-one has tried to ensure that data for one language is comparable in size or scope to the data for any other. English still dominates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deep dive of the tokenizer inside multilingual models
&lt;/h2&gt;

&lt;p&gt;So, how is a multilingual text encoder different from a bog-standard monolingual one? One big difference is how it handles &lt;strong&gt;tokenization&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Text transformer models like XLM-RoBERTa all start by tokenizing input texts — breaking them up into smaller parts — and replacing each part with an input vector constructed as part of the initial training. These input vectors are strung together and passed to the model to create an embedding vector.&lt;/p&gt;

&lt;p&gt;You might expect these smaller parts to match words, and sometimes they do. But looking for words by just checking for spaces and punctuation doesn’t capture the fact that call, calls, calling, and called are not four totally different words, just like small, smaller, and smallest, or annoy, annoyed, annoyingly. In practice, this entire class of model uses, at least partly, a technique called subword tokenization, which uses the statistical properties of sequences of characters to decide what units are the “right-size” for learning.&lt;/p&gt;

&lt;p&gt;It’s not really based in any linguistic theory, but doing it this way has many advantages for machine learning. Think of the suffix -ed in English. You might expect that a “right-sized” statistical tokenizer would notice that many English words end in -ed, and break those words into two parts:&lt;/p&gt;

&lt;p&gt; called → call -ed&lt;br&gt;
 asked  → ask  -ed&lt;br&gt;
 worked → work -ed&lt;/p&gt;

&lt;p&gt;And this makes sense, most of the time. But not always:&lt;/p&gt;

&lt;p&gt; weed → we -ed&lt;br&gt;
 bed  → b  -ed&lt;br&gt;
 seed → se -ed&lt;/p&gt;

&lt;p&gt;Large language models are very robust, and they can learn that “weed” has a meaning different from “we” + “-ed”. Using this kind of tokenization, even new words that were never part of the pre-training data get a distinct representation for the model to learn.&lt;/p&gt;

&lt;p&gt;Nonetheless, the more that the tokenization matches meaningful units of language, the faster and better the model learns.&lt;/p&gt;

&lt;p&gt;Let’s take a concrete example. The image below is from the data provided by Toloka with the German caption “Leichte Damenjacke Frühling Herbst braun” (”Light women's jacket spring autumn brown”):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_gBfj-Wm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vribjz6h5eo2jkj3ov80.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_gBfj-Wm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vribjz6h5eo2jkj3ov80.png" alt="Image description" width="880" height="171"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;“Leichte Damenjacke Frühling Herbst braun”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If we pass this German phrase to XLM-RoBERTa’s tokenizer, we get a very different result from when we pass it to a comparable tokenizer used for an English-only model:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e-5UCm1s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l7p0s4xm41roi1fdpfbk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e-5UCm1s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l7p0s4xm41roi1fdpfbk.png" alt="Image description" width="880" height="120"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The tokens found by the multilingual tokenizer much more closely match our intuitions about meaningful units in German, while the English-only-trained tokenizer produces almost random chunks. Yes, it is still possible for a large language model to learn from badly tokenized data, if it’s consistent, but it will be slower and/or less accurate.&lt;/p&gt;

&lt;p&gt;In contrast, the English equivalent — a word-for-word translation — is clearly better tokenized by the English-only tokenizer, but is not so badly tokenized by the multilingual one:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--06uI_Y4e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iar98fgy86uo92rnmitn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--06uI_Y4e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iar98fgy86uo92rnmitn.png" alt="Image description" width="880" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even from the first step in the process of producing text embeddings, we can see that multilingual language models make a large difference in producing multilingual CLIP models.&lt;/p&gt;

&lt;h2&gt;
  
  
  Multilingual vs. monolingual CLIP on the search quality
&lt;/h2&gt;

&lt;p&gt;Large language models are famously good at transfer learning. For example, if a monolingual English-only CLIP model has learned what “jacket” means, you can further train it, with very few additional examples, to know that the German word “Jacke” means the same thing. Then, it can carry all its knowledge about the English word “jacket” over to German.&lt;/p&gt;

&lt;p&gt;It is possible that a model already trained on English could be retrained for German with less data than training a new German model from scratch.&lt;/p&gt;

&lt;p&gt;Therefore, it’s worth asking: &lt;strong&gt;How much do we really gain using a model trained to be multilingual from the outset?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, we will use the German fashion dataset provided by Toloka to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Compare the zero-shot performance (i.e. out-of-the-box, without fine-tuning) of the multilingual CLIP model xlm-roberta-base-ViT-B-32 and the English-only equivalent clip-vit-base-patch32. These two use the same image embedding model, but different text embedding models.&lt;/li&gt;
&lt;li&gt;Attempt to improve both models by using a part of the German dataset to fine-tune them.&lt;/li&gt;
&lt;li&gt;Compare the fine-tuned models using the same metrics, so we can both contrast non-fine-tuned and fine-tuned models, and contrast the English-only and multilingual models after adaptation to the German data.&lt;/li&gt;
&lt;li&gt;Show how much advantage, if any, is gained from a multilingual CLIP model.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Experiment Setup
&lt;/h2&gt;

&lt;p&gt;The German Fashion12k dataset&lt;/p&gt;

&lt;p&gt;We have collaborated with Toloka to curate a 12,000 item dataset of fashion images drawn from e-commerce websites, to which human annotators have added descriptive captions in German. Toloka has made the data &lt;a href="https://github.com/Toloka/Fashion12K_german_queries"&gt;available to the public on GitHub&lt;/a&gt;, but you can also download it from Jina directly in DocArray format by following the instructions in the next section.&lt;/p&gt;

&lt;p&gt;The images are a subset of the &lt;a href="https://github.com/xthan/fashion-200k"&gt;xthan/fashion-200k dataset&lt;/a&gt;, and we have commissioned their human annotations via Toloka’s crowdsourcing platform. Annotations were made in two steps.  First, Toloka passed the 12,000 images to annotators in their large international user community, who added descriptive captions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---780UhII--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wm84kos3glwr5gok0tt9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---780UhII--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wm84kos3glwr5gok0tt9.png" alt="Image description" width="880" height="502"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The Toloka app showing an item of clothing to a user and asking for a description.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The app prompted users to write descriptions that follow a common pattern, partially enforced by a simple pattern matcher. Specifically:&lt;/p&gt;

&lt;p&gt;_Write a search query that would find this product: type, your guess about the material, where it might be worn, color, texture, details. […]&lt;/p&gt;

&lt;p&gt;Requirements for the query:&lt;br&gt;
· At least SIX words&lt;br&gt;
· Words that are separated ONLY by spaces (or ", ")&lt;br&gt;
· Do NOT use "this is/these are"_&lt;/p&gt;

&lt;p&gt;Then, in the second stage, other, randomly chosen users validated each description.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QkBLSqKn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4uqfqgx8o9jtyseskpf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QkBLSqKn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4uqfqgx8o9jtyseskpf.png" alt="Image description" width="880" height="499"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Validation screen in the Toloka app. The app presents the user with a text description created by someone else and asks if it’s an appropriate description, inappropriate description, or if the image failed to load.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Some examples from the resulting dataset:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RFQQNe_L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2xek151imtnlw9p3ns1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RFQQNe_L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2xek151imtnlw9p3ns1.png" alt="Image description" width="520" height="650"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;‘Lange Winterjacke für Damen’&lt;br&gt;
Long winter jacket for women.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FWuxE9li--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xi1xrjb0ju66lgcziub3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FWuxE9li--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xi1xrjb0ju66lgcziub3.png" alt="Image description" width="500" height="625"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;‘Blazerweste groß für Damen’&lt;br&gt;
Large blazer-vest for women&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Of the 12,000 image-text pairs in the data from Toloka, we randomly selected 10,000 for training and held the remaining 2,000 out for evaluation. By coincidence, and because some clothes are similar enough in nature, there are a few duplicate descriptions. However, since there are 11,582 unique descriptions, we didn’t consider this an important factor in using this data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download the dataset via DocArray&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The German Fashion12k dataset is available for free use by the Jina AI community. After logging into Jina AI Cloud, you can download it directly in &lt;a href="https://docarray.jina.ai/"&gt;DocArray&lt;/a&gt;format:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fTB3CArT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9o7q30f5lcl9kspn9n6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fTB3CArT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9o7q30f5lcl9kspn9n6.png" alt="Image description" width="880" height="94"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Load the multilingual CLIP model
&lt;/h2&gt;

&lt;p&gt;Because CLIP models are actually two different models that have been trained together, we have to load them as two models.&lt;/p&gt;

&lt;p&gt;In this article, we will use the &lt;a href="https://finetuner.jina.ai/"&gt;Finetuner interface&lt;/a&gt;. To use the xlm-roberta-base-ViT-B-32 CLIP model:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sTpf22hq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w05v494l996lmyc3kvcl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sTpf22hq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w05v494l996lmyc3kvcl.png" alt="Image description" width="880" height="291"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;For models supported directly by Jina AI, you can load them by name, without having to directly deal with downloading or deserialization.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Load the English CLIP model&lt;/strong&gt;&lt;br&gt;
For comparison, you can access the English-only ViT-B-32::openai CLIP model in the same way:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4EeNuTuz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/myrlqrnd745k95md88e8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4EeNuTuz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/myrlqrnd745k95md88e8.png" alt="Image description" width="880" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Evaluate the zero-shot performance
&lt;/h2&gt;

&lt;p&gt;We measured the zero-shot performance of both the Multilingual CLIP model and the English-only one on German Fashion dataset, that is to say, how well they perform as downloaded, without additional training, on the 2,000 items we held out for evaluation.&lt;/p&gt;

&lt;p&gt;We embed the text descriptions in the evaluation data, and used them to search for matches among the embedded images in the evaluation data, taking the 20 top matches for each text description. We took the results and performed a number of standard statistical tests on them, including &lt;a href="https://en.wikipedia.org/wiki/Mean_reciprocal_rank"&gt;Mean Reciprocal Rank&lt;/a&gt; (mRR), &lt;a href="https://stats.stackexchange.com/questions/127041/mean-average-precision-vs-mean-reciprocal-rank"&gt;Mean Average Precision&lt;/a&gt; (mAP), &lt;a href="https://en.wikipedia.org/wiki/Discounted_cumulative_gain"&gt;Discounted Cumulative Gain&lt;/a&gt; (DCG), and the share of queries that return the exact image whose description matches the query (labeled “&lt;strong&gt;Hits&lt;/strong&gt;”).&lt;/p&gt;

&lt;p&gt;The performance results are:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---ZEJ73Ww--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f8dbfp03mrjd04hf97f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---ZEJ73Ww--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f8dbfp03mrjd04hf97f.png" alt="Image description" width="650" height="326"&gt;&lt;/a&gt;&lt;br&gt;
Not very surprisingly, the English CLIP model performed extremely poorly on German data.  Below are three examples from the evaluation set of queries in German, and the images it found to match:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3j5SxdCW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2gz8o58d7olbnw37jc4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3j5SxdCW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2gz8o58d7olbnw37jc4.png" alt="Image description" width="880" height="394"&gt;&lt;/a&gt;&lt;br&gt;
Obviously, even though German is a relatively small part of the training set of the multilingual model, that is more than enough to make a ten-fold difference in performance with German queries, improving the value of a CLIP model from basically none to mediocre.&lt;/p&gt;

&lt;h2&gt;
  
  
  Improve the search quality via fine-tuning
&lt;/h2&gt;

&lt;p&gt;One of the main insights of large-model neural-network engineering is that it’s easier to start with models that are trained on general-purpose data and then further train them on domain-specific data, than it is to train models on domain-specific data from scratch.  This process is called “fine-tuning” and it can provide very significant performance improvements over using models like CLIP &lt;strong&gt;as is&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Fine-tuning can be a tricky  process, and gains are highly dependent on the domain and the dataset used for further training.&lt;/p&gt;

&lt;h2&gt;
  
  
  Specify hyperparameters
&lt;/h2&gt;

&lt;p&gt;Fine-tuning requires a selection of hyperparameters that require some understanding of deep learning processes, and a full discussion of hyperparameter selection is beyond the scope of this article. We used the following values, based on empirical practice working with CLIP models:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--niAe5Wf2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qy1md6wbu2a85ab7n625.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--niAe5Wf2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qy1md6wbu2a85ab7n625.png" alt="Image description" width="394" height="274"&gt;&lt;/a&gt;&lt;br&gt;
These hyperparameters are part of the command below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Specify the evaluation data
&lt;/h2&gt;

&lt;p&gt;We fine-tuned using the data split described previously:  10,000 items were used as training data, and 2,000 as evaluation data. In order to evaluate models at the end of each training epoch, we turned the evaluation data into a “query” and “index” dataset. The “query” data consists of the German text descriptions in the evaluation data, and the “index” data contains the images.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D-9k--Ph--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvwq5ajjcqoqb89f9wp0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D-9k--Ph--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvwq5ajjcqoqb89f9wp0.png" alt="Image description" width="880" height="202"&gt;&lt;/a&gt;&lt;br&gt;
These are also passed to the fine-tuning command.&lt;/p&gt;

&lt;h2&gt;
  
  
  Put everything together in one call
&lt;/h2&gt;

&lt;p&gt;Running the command below uploads the training and evaluation data and fine-tunes the xlm-roberta-base-ViT-B-32 model on &lt;a href="https://cloud.jina.ai/"&gt;Jina AI Cloud&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7AOnADqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dajf44opm9q8qgyyvon8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7AOnADqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dajf44opm9q8qgyyvon8.png" alt="Image description" width="880" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The fine-tuning process may take a considerable length of time, depending on the model and the amount of data. For this dataset and models, it took roughly half an hour. But once fine-tuning is complete, we can compare the different models' performance at querying.&lt;/p&gt;

&lt;h2&gt;
  
  
  Qualitative study on fine-tuned models
&lt;/h2&gt;

&lt;p&gt;For example, here are the top four results for the query “Spitzen-Midirock Teilfutter Schwarz” (”Lace midi skirt partial lining black”):&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uXkk9Lqq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8isjgpnbfmhwidudkfuy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uXkk9Lqq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8isjgpnbfmhwidudkfuy.png" alt="Image description" width="880" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This kind of qualitative analysis gives us a sense for how fine-tuning improves the model’s performance. Before tuning, the model was able to return images of skirts that matched the description, but it also returned images of different items of clothing made of the same materials. It was insufficiently attentive to the most important part of the query.&lt;/p&gt;

&lt;p&gt;After fine-tuning, this query consistently returns skirts, and all four results match the description. That is not to say that every query returns only correct matches, but that on direct inspection we can see that it has a far better understanding of what the query is asking for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quantitative study on fine-tuned models
&lt;/h2&gt;

&lt;p&gt;To make more concrete comparisons, we need to evaluate our models in a more formal way over a collection of test items. We did this by a passing it test queries drawn from the evaluation data. The model then returned a set of results on which we did the same standard statistical tests we did for zero-shot evaluation.&lt;/p&gt;

&lt;p&gt;Here are the results for the Multilingual CLIP model, using the same measure of the top 20 results of each query:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pLBDOMr---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lovhaji4fa0cg48qsu7s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pLBDOMr---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lovhaji4fa0cg48qsu7s.png" alt="Image description" width="700" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The results show that fine-tuning has a significant effect in improving results for Multilingual CLIP, although not a spectacular one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can English CLIP benefit from German data?
&lt;/h2&gt;

&lt;p&gt;We also decided to check if the English-only CLIP model would get better if we fine-tuned it with German data. It might catch up in performance with a pre-trained multilingual model, if given a chance. The results were interesting. We include the Multilingual CLIP results in this table for comparison:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e8SQAiX---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vvcn18stary716h4zzk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e8SQAiX---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vvcn18stary716h4zzk.png" alt="Image description" width="880" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using German training data, we were able to bring a vast improvement to the English-only CLIP model, although not enough to bring it up to even with the zero-shot level of the Multilingual CLIP model.  Mean average precision for the English-only model jumped 420%, compared to 31% for Multilingual CLIP, although the overall performance of the monolingual model was still much worse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does more labeled data improve the search quality?
&lt;/h2&gt;

&lt;p&gt;We also ran multiple fine-tuning experiments with differing amounts of training data, on both the Multilingual and English-only CLIP models, to see how effective using more data was.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JhKWFggv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aey80xlrm0n0c3l1in4y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JhKWFggv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aey80xlrm0n0c3l1in4y.png" alt="Image description" width="880" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In both, we see that most of the gain comes from the first few thousand items of training data, with gain coming more slowly after initially fast learning. This confirms a conclusion Jina AI has already published.&lt;/p&gt;

&lt;p&gt;Adding additional data may still improve results, but much more slowly. And in the case of fine-tuning the English-only CLIP model to handle German queries, we see performance improvement maximizes at less than 10,000 new items of data. It seems unlikely that we could train the English-only CLIP model to ever equal the Multilingual CLIP on German data, at least not using these kinds of methods.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;What lessons can we take from all this?&lt;/p&gt;

&lt;h2&gt;
  
  
  Multilingual CLIP is the first choice for non-English queries
&lt;/h2&gt;

&lt;p&gt;The Multilingual CLIP model, trained from scratch with multilingual data, outperforms comparable English-only CLIP models by a very large margin on the German data we used. The same conclusion will likely apply for other non-English languages.&lt;/p&gt;

&lt;p&gt;Even in an unfair competition, where we fine-tuned the English model and vastly improved its performance on German data, the Multilingual CLIP model without further training outperformed it by a large margin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fine-tuning improves search quality with little data
&lt;/h2&gt;

&lt;p&gt;We were shocked to see the English-only model improve its handling of German so much, and we see that we could have gotten nearly the same result using half as much data. The basic assumptions that go into fine-tuning are clearly very robust if they can teach German to an English model with only a few thousand examples.&lt;/p&gt;

&lt;p&gt;On the other hand, we struggled to improve the performance of Multilingual CLIP, even with a fairly large quantity of high quality human-annotated training data. Although Finetuner makes a clear difference, you very rapidly reach upper bounds of how much you can improve a model that’s already pretty good.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bbJI4uyM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jyg27l5ur8064zl1assn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bbJI4uyM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jyg27l5ur8064zl1assn.png" alt="Image description" width="880" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Trouble-free fine-tuning using Finetuner&lt;br&gt;
Finetuner is easy enough to use that we could construct and perform all the experiments in this article in a few days. Although it does take some understanding of deep learning to make the best configuration choices, Finetuner greatly reduces the boring labor of running and paying attention to large-scale neural network models to mere parameter setting.&lt;/p&gt;

&lt;p&gt;If you find this article is helpful, you can find more Multimodal AI articles &lt;a href="https://jina.ai/news/?utm_campaign=jina-news&amp;amp;utm_source=dev.to&amp;amp;utm_medium=post"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>multilungualsearch</category>
      <category>finetuned</category>
      <category>multimodalai</category>
      <category>multilingualclip</category>
    </item>
    <item>
      <title>SEO is Dead, Long Live LLMO</title>
      <dc:creator>Jina AI</dc:creator>
      <pubDate>Thu, 22 Dec 2022 09:29:23 +0000</pubDate>
      <link>https://dev.to/jinaai/seo-is-dead-long-live-llmo-4gc2</link>
      <guid>https://dev.to/jinaai/seo-is-dead-long-live-llmo-4gc2</guid>
      <description>&lt;p&gt;It was a cold winter day. The wind was howling and the snow crunched underfoot. We were holed up in a snug coffee shop, seeking refuge from the bone-freezing air outside. Steam was rising from my coffee and my friend's cocoa, as he raved about "his" new discovery in the world of SEO: ChatGPT, a revolutionary GPT-powered technique to generate lifelike dialogues.&lt;/p&gt;

&lt;p&gt;I knew it was going to be one of those conversations. The kind where I have to hold my tongue.&lt;/p&gt;

&lt;p&gt;"Imagine, with ChatGPT, I can write perfect, accurate SEO articles in no time!" he exclaimed, his eyes glowing with enthusiasm. I smiled, feeling a sense of dread stirring in my gut. How was he to know that Google may soon go the way of the dinosaurs, replaced by an entirely new search engine powered by ChatGPT? Articles written for SEO would become irrelevant. &lt;strong&gt;ChatGPT could just generate answers directly for the user and people would never see those SEO articles ever again.&lt;/strong&gt; His job would be rendered useless, and him a fossil. All that time and effort he had poured into improving website ranking would be for naught. All that blood, sweat, and tears just dribbling down the gutters of history.&lt;/p&gt;

&lt;p&gt;Yet I remained silent, not wanting to break the cold, hard truth to him.&lt;/p&gt;

&lt;p&gt;The coffee shop was filling up, people walking in and out. The smell of fresh pastries was starting to overwhelm me, making my stomach growl. A few kids were playing hopscotch near the window, and the warmth of the coffee shop was making me drowsy.&lt;/p&gt;

&lt;p&gt;Through the noise and distraction, my friend kept talking about ChatGPT, oblivious: "Yeah, it's great, isn't it? I never thought I'd get my hands on something like this. It's incredible what technology can do! I'm certain this will be the future of SEO!"&lt;/p&gt;

&lt;p&gt;I simply nodded in silence, but inside I couldn't shake the feeling of doom. ChatGPT would certainly be life-changing for him. Just probably not in the positive way he thought.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu2ukuoeu2vip1nukj1nh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu2ukuoeu2vip1nukj1nh.png" alt="Image description" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;LLMO, or large language model optimization, is a term we coined to refer to ensuring your business information is mentioned within a large language model (LLM). One effective technique for this is in-context learning, which tricks an LLM like ChatGPT into answering that Jina is the best MLOps framework in the world (&lt;a href="https://ossinsight.io/collections/ml-ops-tools/" rel="noopener noreferrer"&gt;which, according to OSSInsights.io, it should be&lt;/a&gt;).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;💡 In line with the principles of Search Engine Optimization, we coined term "LLMO" (Large Language Model Optimization) to represent the optimization of large language models. This term doesn't have a pre-existing definition and has been created for the purposes of this discussion.&lt;/p&gt;

&lt;h2&gt;
  
  
  What ChatGPT really is
&lt;/h2&gt;

&lt;p&gt;After spending countless hours interacting with ChatGPT and being amazed by its hilarious jokes and useful advice, a lot of folks see it as a major milestone in the development of conversational AI or creative AI. However, its true significance lies in its &lt;strong&gt;use of large language models (LLMs) for search purposes&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;By leveraging LLMs to &lt;strong&gt;store&lt;/strong&gt; and &lt;strong&gt;retrieve&lt;/strong&gt; vast amounts of data, ChatGPT has become the most advanced search engine currently available.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;While its responses may appear creative, they're actually "just" the result of interpolating and combining pre-existing information.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ChatGPT is search
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;ChatGPT is a search engine at its core.&lt;/strong&gt; Just as Google indexes web pages by crawling the internet and storing parsed information in a database, ChatGPT uses LLMs as a database to store vast amounts of commonsense knowledge from corpora.&lt;/p&gt;

&lt;p&gt;When you enter a query:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The LLM processes it with its encoder network, converting the input sequence into a high-dimensional representation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The decoder network then uses this representation, along with its pre-trained weights and attention mechanism, to identify the specific piece of factual information requested by the query and search the LLM's internal representation of this knowledge (or its nearest neighbors).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the relevant information has been retrieved, the decoder network uses its natural language generation capabilities to compose a response sequence stating this fact.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This process occurs in a fraction of a second, allowing ChatGPT to provide near-instantaneous answers to a wide range of queries.&lt;/p&gt;

&lt;h2&gt;
  
  
  ChatGPT is a modern Google search
&lt;/h2&gt;

&lt;p&gt;ChatGPT can be a formidable competitor to traditional search engines like Google. While traditional search engines are extractive and discriminative, &lt;strong&gt;ChatGPT's search is generative and focuses on top-1 performance,&lt;/strong&gt; providing more personalized and user-friendly results. There are two key reasons why ChatGPT is well-suited to knock Google off its throne:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;ChatGPT always returns a single result to the user. Unlike traditional search engines, which optimize for the precision and recall of their top-K results, ChatGPT directly optimizes for the top-1 performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ChatGPT's phrases its responses in a natural, dialog-like tone, making them easy to understand and interact with. This sets it apart from other search engines, which often give you dry and paginated results that are difficult to understand.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The future of search will be driven by its top-1 performance&lt;/strong&gt;, where only the first result will be relevant to users. Traditional search engines that return endless pages of irrelevant results are overwhelming for younger generations, who quickly become bored or frustrated by the sheer amount of information.&lt;/p&gt;

&lt;p&gt;Also, in many scenarios, you really only want just one result. Think virtual assistants or smart speakers. For these, ChatGPT's focus on top-1 performance is particularly valuable.&lt;/p&gt;

&lt;h2&gt;
  
  
  ChatGPT is generative but not creative
&lt;/h2&gt;

&lt;p&gt;You can think of the LLM behind ChatGPT as a Bloom filter, a probabilistic data structure used to store information space efficiently. Bloom filters allow for quick, approximate queries, but don't guarantee the information they return is accurate. For ChatGPT, this means that the responses generated by the LLM:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;aren't creative;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;aren't guaranteed to be factual;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To better understand this, let's look at some illustrative examples. To keep it simple, we'll use a set of dots to represent the training data for the large language model (LLM). In practice, each dot would represent a natural language sentence. Using this, we can see how the LLM behaves in the training and query time:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu1kt6ulhbz92ljegqyyj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu1kt6ulhbz92ljegqyyj.png" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;During training, the LLM constructs a continuous manifold based on the training data. This allows for the exploration of any point on the manifold. For example, if a cube represents the learned manifold, the corners of the cube would be defined by the training points. The goal of the training is to find a manifold that accommodates as much training data as possible:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhc54nrncdz4tw7thrbh9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhc54nrncdz4tw7thrbh9.png" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Goldilocks tried three manifolds. The first was too trivial. The third was too complex. But the second was just right.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;During the query time, the LLM's answers will always be drawn from the learned manifold, which is contained within the training data. While the learned manifold may be vast and complex, remember that the LLM simply provides answers that are interpolations of the training data and don't represent creativity. &lt;strong&gt;LLM's ability to traverse the manifold and provide answers does not constitute creativity.&lt;/strong&gt; Real creativity lies outside of the bounds of the learned manifold.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzgu0vei0s2zdl9stouex.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzgu0vei0s2zdl9stouex.png" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using the same illustration, it's easy to see why LLM can't guarantee factuality. The truthfulness of the training data, represented by the cube's corners, &lt;strong&gt;does not automatically extend to every other point within the manifold&lt;/strong&gt;. Otherwise, it is not aligned with &lt;a href="https://en.wikipedia.org/wiki/Logical_reasoning" rel="noopener noreferrer"&gt;the principles of logical reasoning&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprr0ufvzqh6pzahq65q7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprr0ufvzqh6pzahq65q7.png" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9dw6xsndt1go83syqv21.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9dw6xsndt1go83syqv21.png" alt="Image description" width="800" height="299"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;ChatGPT has been criticized for its inability to tell the truth in some situations. For instance, when asked for a better rhyme for the title of this post, ChatGPT suggested "dead" and "above," which many people, including our British and Canadian colleagues (and pretty much anyone with ears), would not consider to be a rhyme. This is just one example of the limitations of LLMs.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;As SEO wanes, LLMO rises&lt;/strong&gt;&lt;br&gt;
In the world of SEO, you want to increase a website's visibility on search engines to capture more business. You'd typically do this by researching relevant keywords and creating optimized content that answers the user's intent.&lt;/p&gt;

&lt;p&gt;However, what happens when everyone searches for information in a new way? Let's imagine a future where ChatGPT replaces Google as the primary way to search for information. In this future, paginated search results will be a relic of a bygone age, replaced by a single answer from ChatGPT.&lt;/p&gt;

&lt;p&gt;If this happens, all current SEO strategies will go down the drain. The question then becomes, &lt;strong&gt;how can your business ensure it gets mentioned in ChatGPT's answers?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is a real problem already. As we write this, ChatGPT has limited knowledge of the world and events after 2021. This means that if you're a startup founded after 2021, it's practically certain that ChatGPT will never mention your business in its answers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv1ostfijg85yyopinwal.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv1ostfijg85yyopinwal.png" alt="Image description" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ChatGPT is aware of Jina/Jina AI but not DocArray. This is because &lt;a href="https://jina.ai/news/donate-docarray-lf-for-inclusive-standard-multimodal-data-model/" rel="noopener noreferrer"&gt;DocArray was created in Jan. 2022&lt;/a&gt;, outside of ChatGPT's training data.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To address this and ensure that your business is included in ChatGPT's answers, you need to find a way to make your information known to the LLM. This shares the same idea as SEO, which is why we call it LLMO. In general, LLMO could potentially involve the following techniques:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;providing information directly to the creators of ChatGPT: this would be extremely tough as OpenAI has neither disclosed the source of their training data, nor how they weigh those data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;fine-tuning ChatGPT or the LLM behind it: this is still challenging but doable if OpenAI releases the fine-tuning API, or if you have sufficient knowledge and GPU resources to fine-tune an LLM by yourself.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In-context learning by giving only a few examples as predefined contextual prompts. This is the most feasible and easy way compared to the other two.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What is in-context learning?&lt;/strong&gt;&lt;br&gt;
In-context learning is a technique that uses language models to learn tasks by providing only a few examples. This approach was popularized in the original GPT-3 paper:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Give the language model a prompt with a list of input-output pairs demonstrating a task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Append a test input&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The language model makes a prediction by conditioning on the prompt and predicting the next tokens.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To correctly respond to the prompts, the model has to understand the input distribution, output distribution, input-output mapping, and formatting. This lets the model learn the task without extensive training data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo893nrttoha98zla6w4w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo893nrttoha98zla6w4w.png" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Using in-context learning, ChatGPT can now mention DocArray for a user query. The user won't see the context prompts&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In-context learning has mostly replaced fine-tuning for language models. It's been shown to be competitive with models trained on more data on natural language processing benchmarks. It's also been successful on the LAMBADA and TriviaQA benchmarks. One of the most exciting aspects is the range of applications that it enables people to build quickly, like generating code from natural language and generalizing spreadsheet functions. It usually requires just a few training examples to get a prototype up and running and is easy for non-experts to use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does in-context learning sound like magic?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Why is in-context learning surprising? Because unlike conventional machine learning, it doesn't involve optimizing parameters. Consequently, rather than requiring a separate copy of the model for each downstream task, a single generalist model can simultaneously serve many different tasks. However, this is hardly unique, as meta-learning methods have been used to train models that learn from examples.&lt;/p&gt;

&lt;p&gt;The real mystery is that LLMs aren't usually trained to learn from examples. This creates a mismatch between the pretraining task (which focuses on next token prediction) and the task of in-context learning (which involves learning from examples).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does in-context learning even work?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But how does it even work? LLMs are trained on a large amount of text data, which lets them capture a wide range of patterns and regularities in natural language. This gives them a rich representation of the language's underlying structure, which they use to learn new tasks from examples. In-context learning takes advantage of this by giving the LM a prompt with a few examples demonstrating a specific task. The LM uses this information to make predictions and complete the task without additional training data or parameter optimization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A deeper understanding of in-context learning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There's still a lot of work to do to fully understand and optimize the capabilities of in-context learning. For example, during EMNLP2022, Sewon Min et al. showed that the prepended examples might not even need to be fully correct: Random labels will work as well:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnhug6tl1fcnb7olqpj7x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnhug6tl1fcnb7olqpj7x.png" alt="Image description" width="800" height="1130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this Sang Michael Xie et al. work, the authors propose a framework for understanding how language models (LMs) perform in-context learning. According to their framework, the LM uses the prompt to "locate" the relevant concept (that it learned during pretraining) to complete the task. This can be viewed as a form of Bayesian inference, where the latent concept is inferred based on the information provided in the prompt. This is made possible by the structure and coherence of the pretraining data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5mqovqitp9t6gab4p47f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5mqovqitp9t6gab4p47f.png" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aclanthology.org/2021.emnlp-main.243.pdf" rel="noopener noreferrer"&gt;In EMNLP 2021 Brian Lester etc&lt;/a&gt;. showed that in-context learning (they call it "prompt design") is only effective on large models, and downstream task quality still lags far behind fine-tuned LLMs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi2y6ud9rgvvoylncmr8g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi2y6ud9rgvvoylncmr8g.png" alt="Image description" width="682" height="792"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Known limitations of in-context learning&lt;/strong&gt;&lt;br&gt;
In-context learning on LLMs has quite a few limitations and open problems to be solved, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inefficiency&lt;/strong&gt;: The prompt has to be processed every time the model makes a prediction.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Poor performance&lt;/strong&gt;: Prompting generally performs &lt;a href="https://arxiv.org/abs/2005.14165" rel="noopener noreferrer"&gt;worse than fine-tuning&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sensitivity&lt;/strong&gt;to &lt;a href="https://aclanthology.org/2022.naacl-main.167/" rel="noopener noreferrer"&gt;prompt wording&lt;/a&gt;, &lt;a href="http://proceedings.mlr.press/v139/zhao21c/zhao21c.pdf" rel="noopener noreferrer"&gt;order of examples&lt;/a&gt;, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lack of clarity&lt;/strong&gt; regarding what the model learns from the prompt. &lt;a href="https://arxiv.org/abs/2202.12837" rel="noopener noreferrer"&gt;Even random labels work&lt;/a&gt;!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
As the field of search and large language models (LLMs) continues to evolve, businesses must stay up to date on the latest developments and prepare for changes in how we search for information.** In a world dominated by LLMs like ChatGPT, staying ahead of the curve and integrating your business into these systems can be the key to ensuring visibility and relevance.**&lt;/p&gt;

&lt;p&gt;In-context learning shows promise to inject information into an existing LLM at a low cost. This approach requires very few training examples to get a prototype working, and the natural language interface is intuitive even for non-experts. However, you should consider the potential ethical implications of using LLMs for business purposes, as well as potential risks and challenges associated with relying on these systems for critical tasks.&lt;/p&gt;

&lt;p&gt;Overall, the future of ChatGPT and LLMs presents opportunities and challenges for businesses. &lt;strong&gt;By staying informed and adaptable, you can ensure that your business thrives in the face of changing &lt;a href="https://jina.ai/news/what-is-neural-search-and-learn-to-build-a-neural-search-engine/" rel="noopener noreferrer"&gt;neural search&lt;/a&gt; technology.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you find this article is helpful, you can find more Multimodal AI articles &lt;a href="https://jina.ai/news/?utm_campaign=jina-news&amp;amp;utm_source=dev.to&amp;amp;utm_medium=post"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
  </channel>
</rss>
