---
title: Vertex AI Embeddings for Text | Grounding LLMs
description: "Gen AI service reliability: Uncover the power of Vertex AI Embeddings for Text. No memorization hassles, just efficient grounding with vector search."
image: https://www.c2cglobal.com/hubfs/Imported_Blog_Media/General%20Article%20Graphic-Mar-21-2024-09-06-39-8943-PM-Mar-26-2024-08-36-18-6455-PM.jpg
---

[![c2c logo blue](https://www.c2cglobal.com/hubfs/c2c-logo-blue.svg "c2c logo blue")](https://www.c2cglobal.com/)

[AI and Machine Learning](https://www.c2cglobal.com/articles/tag/ai-and-machine-learning), [Vertex AI](https://www.c2cglobal.com/articles/tag/vertex-ai)

# Vertex AI Embeddings for Text: Grounding LLMs made easy

By [C2C Community Team](https://www.c2cglobal.com/articles/author/c2c-community-team) | March 17, 2022

May 26, 2023

 

![https://storage.googleapis.com/gweb-cloudblog-publish/images/aiml2022_PO1vxqJ.max-2500x2500.jpg](https://www.c2cglobal.com/hubfs/Imported_Blog_Media/aiml2022_PO1vxqJ_max-2500x2500-1.jpg)

##### Kaz Sato

Developer Advocate, Google Cloud

##### Ivan Cheung

Developer Programs Engineer, Google Cloud

 

Many people are now starting to think about how to bring Gen AI and large language models (LLMs) to production services. You may be wondering "How to integrate LLMs or AI chatbots with existing IT systems, databases and business data?", "We have thousands of products. How can I let LLM memorize them all precisely?", or "How to handle [the hallucination issues](https://en.wikipedia.org/wiki/Hallucination_(artificial_intelligence)) in AI chatbots to build a reliable service?". Here is a quick solution: **grounding with embeddings and vector search.**

What is grounding? What are embedding and vector search? In this post, we will learn these crucial concepts to build reliable Gen AI services for enterprise use. But before we dive deeper, here is an example:

![https://storage.googleapis.com/gweb-cloudblog-publish/original_images/1._demo_animation.gif](https://www.c2cglobal.com/hubfs/Imported_Blog_Media/1__demo_animation-1.gif)

 

*Semantic search on 8 million Stack Overflow questions in milliseconds. (Try the demo [here](https://ai-demos.dev/demos/matching-engine))*

 

This demo is available as a public live demo [here](https://ai-demos.dev/demos/matching-engine). Select "STACKOVERFLOW" and enter any coding question as a query, so it runs a text search on 8 million questions posted on [Stack Overflow](https://stackoverflow.com/).

The following points make this demo unique:

- **LLM-enabled semantic search**: The 8 million Stack Overflow questions and query text are both interpreted by [Vertex AI Generative AI models](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/overview). The model understands the meaning and intent (semantics) of the text and code snippets in the question body at librarian-level precision. The demo leverages this ability for finding highly relevant questions and goes far beyond simple keyword search in terms of user experience. For example, if you enter "How do I write a class that instantiates only once", then the demo shows "How to create a [singleton](https://en.wikipedia.org/wiki/Singleton_pattern) class" at the top, as the model knows their meanings are the same in the context of computer programming.
- **Grounded to business facts**: In this demo, we didn't try having the LLM to memorize the 8 million items with complex and lengthy prompt engineering. Instead, we attached the Stack Overflow dataset to the model as an external memory using vector search, and used no prompt engineering. This means, the outputs are all directly "grounded" (connected) to the business facts, not the artificial output from the LLM. So the demo is ready to be served today as a production service with mission critical business responsibility. It does not suffer from the limitation of LLM memory or unexpected behaviors of LLMs such as the hallucinations.
- **Scalable and fast**: The demo gives you the search results in tens of milliseconds while retaining the deep semantic understanding capability. Also, the demo is capable of scaling out to handle thousands of search queries every second. This is enabled with the combination of LLM embeddings and Google AI's vector search technology.

The key enablers of this solution are 1) the embeddings generated with [Vertex AI Embeddings for Text](https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings) and 2) fast and scalable vector search by [Vertex AI Matching Engine](https://cloud.google.com/vertex-ai/docs/matching-engine/overview). Let's start by taking a look at these technologies.

## First key enabler: Vertex AI Embeddings for Text

On May 10, 2023, Google Cloud announced the following Embedding APIs for Text and Image. They are available on [Vertex AI Model Garden](https://cloud.google.com/model-garden). 

- [**Embeddings for Text**](https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings) : The API takes text input up to 3,072 input tokens and outputs 768 dimensional text embeddings, and is available as a public preview. As of May 10, 2023, the pricing is $0.0001 per 1000 characters (the latest pricing is available on [the Pricing for Generative AI models page](https://cloud.google.com/vertex-ai/pricing#generative_ai_models)).
- [**Embeddings for Image**](https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-image-embeddings): Based on [Google AI's Contrastive Captioners (CoCa) model](https://ai.googleblog.com/2022/05/image-text-pre-training-with.html), the API takes either image or text input and outputs 1024 dimensional image/text multimodal embeddings, available to trusted testers. This API outputs so-called "multimodal" embeddings, enabling multimodal queries where you can execute semantic search on images by text queries, or vise-versa. We will feature this API in another blog post soon.

In this blog, we will explain more about why embeddings are useful and show you how to build and an application leveraging Embeddings API for Text. In a future blog post, we will provide a deep dive on Embeddings API for Image.

![https://storage.googleapis.com/gweb-cloudblog-publish/images/2._model_garden.max-2200x2200.png](https://www.c2cglobal.com/hubfs/Imported_Blog_Media/2__model_garden_max-2200x2200-1.png)

*Embeddings API for Text on Vertex AI Model Garden*

## What is embeddings?

So, what are semantic search and embeddings? With the rise of LLMs, why is it becoming important for IT engineers and ITDMs to understand how they work? To learn it, please take a look at [this video](https://youtu.be/HD_xreaLKb4?t=367) from a Google I/O 2023 session for 5 minutes:

 

 

Also, [Foundational courses: Embeddings](https://developers.google.com/machine-learning/crash-course/embeddings/video-lecture) on Google Machine Learning Crush Course and [Meet AI's multitool: Vector embeddings](https://cloud.google.com/blog/topics/developers-practitioners/meet-ais-multitool-vector-embeddings) by Dale Markowitz are great materials to learn more about embeddings.

 

 

## [**Click here to read more**](https://cloud.google.com/blog/products/ai-machine-learning/how-to-use-grounding-for-your-llms-with-text-embeddings/?utm_campaign=CDR__GCP_vertexaiembeddingste_052523)

---

## Recent Articles

<https://www.c2cglobal.com/articles/generative-ai-are-you-behind>

[Data Analytics](https://www.c2cglobal.com/articles/tag/data-analytics)

## [Generative AI: Are You Behind?!](https://www.c2cglobal.com/articles/generative-ai-are-you-behind)

Review the latest insights from the AI Readiness Report.

By Bruno Aziza

<https://www.c2cglobal.com/articles/make-gen-ai-work-landscape-slms-vs.-llms-cost-more>

[Industry Solutions](https://www.c2cglobal.com/articles/tag/industry-solutions)

## [Make "Gen AI Work": Landscape, SLMs vs. LLMs, Cost & More...](https://www.c2cglobal.com/articles/make-gen-ai-work-landscape-slms-vs.-llms-cost-more)

Discover the 5 metrics you need to know in order to be an exceptional CEO and Operator.

By Bruno Aziza

<https://www.c2cglobal.com/articles/ai-cheat-sheet>

[Google Cloud Strategy](https://www.c2cglobal.com/articles/tag/google-cloud-strategy)

## [AI Cheat Sheet](https://www.c2cglobal.com/articles/ai-cheat-sheet)

AI is no more and no less the drive to create robots with human minds so they can do everything we do and more. Use this cheat sheet to help decode the space.

By Leah Zitter

## Subscribe to our newsletter

Get the latest from C2C, direct to your inbox.

[Subscribe](https://share.hsforms.com/1znKGo6ySS9uaRyvLQQzxRw4qbyr)

![c2c-logo-white-tagline](https://www.c2cglobal.com/hubfs/c2c-logo-white-tagline.svg "c2c-logo-white-tagline")

C2C is the only peer-to-peer community built to support, connect, and educate Google Cloud customers across regions and industries so they can better harness the power of the cloud—and each other—to solve their biggest challenges and drive innovation.

©2024  C2C Global. All rights reserved. [Privacy Policy](https://www.c2cglobal.com/privacy)

20 N Wacker Drive • Suite 1810 • Chicago, IL • 60606

**Join over 60K members on C2C.**

Let's connect!

- [mailto:hello@c2cglobal.com](mailto:hello@c2cglobal.com)
- <https://m.youtube.com/channel/UCWOli-_qQyZziBdPQ-6p-eQ>
- <https://www.linkedin.com/company/66934702>
- [![X](https://www.c2cglobal.com/hubfs/twitter-x-icon-white.svg)](https://twitter.com/MeetC2C)

![](https://px.ads.linkedin.com/collect/?pid=2634489&fmt=gif)