BigQuery vector search and embedding generation

Google Cloud Tech · Beginner ·🔍 RAG & Vector Search ·2y ago

Key Takeaways

This video demonstrates BigQuery's vector search capabilities and embedding generation for analyzing unstructured data, using tools like BigQuery, Vertex AI, and Cloud Storage. It showcases how to create cloud resource connections, define remote models, generate embeddings, and create vector indexes for efficient semantic search.

Full Transcript

the rapid growth of unstructured data like text images and video offers hidden insights however it Shear volume and complexity pose a challenge in extracting its value traditional keyword searches struggle leaving important information in connections undiscovered this is where Vector search offers a breakthrough Vector search uses embeddings which are numerical representations of your data machine learning models transform text images and even video into embeddings allowing you to compare and search them based on their underlying meaning not just literal keywords this is because semantically similar text images and video have similar numerical representations in embeddings Imagine finding images similar to a product photo identifying video clips related to a customer review or finding text documents that all Express a similar sentiment ctor search makes this possible and what if you could do all of this without leaving your data warehouse well big query makes it a reality in this video we'll explore big queries functionality that enables you to generate multimodal embeddings and perform Vector search let's start by understanding how big query handles not only structured data but all types of data including text images audio and video big query is a powerful and flexible tool for bringing together all of your data assets using object tables big query lets you directly connect to and analyze unstructured objects in Cloud object stores you can combine insights from your unstructured data with your structured tables and unlock new analysis opportunities to understand complex data like free form text or images you need a standard way to represent them and embeddings make this possible machine learning models take your unstructured inputs like images and transform them into numerical vectors these Vector embeddings capture the underlying meaning of your data making it possible to compare and search based on semantic relationships not just surface level keywords big query machine learning lets you generate embeddings for your unstructured data directly from your data warehouse using familiar SQL syntax it also supports multiple embedding models to suit your use case you might choose use a text embedding model for all of your textual data or a multimodal embedding model for semantic search across modalities like text image and video you simply invoke the ml. generate embedding function over an object table and embeddings are returned directly to bigquery with your embeddings stored in big query you can index them and use the vector search function to find data based on semantic similarity this means that regardless of the input modality you return relevant results based on the actual meaning big query Vector search is optimized for analytical use cases and can efficiently process large quantities of data and handles the infrastructure management for you previously these types of analyses required complex pipelines and external tools which created silos and friction big query brings it all together embedding generation Vector search and your existing data enhancing your analysis experience let's head over to the cloud console and see how this works imagine I work at an e-commerce company in the Fashion retail space I'm thinking of introducing a new sweater to our collection but first I want to check whether we have produced or sold anything similar I have sales data in big query tables and I also have a vast catalog of product images in cloud storage but unfortunately none of these images are tagged or indexed we can see a sample image from our catalog here in cloud storage I'm going to then navigate over to bigquery I begin by creating a cloud resource connection this allows big query to access our images in cloud storage and the embedding models in vertex AI to add a connection I'll click add connection to external source connection type as vertex AI remote model and then I'll give it the name myor conon and click create connection I can then navigate to the cloud resource connection and copy the service account ID I'll need to give the service account a few more permissions so I'll open up I am and another tab I'll assign the service account to roles storage object viewer and vertex AI user then I'll move back to Big query with permissions all taken care of I'll now create a remote model so that I can access the embedding model through bigquery the create model statement takes a few inputs a model name a remote connection which I just defined and an endpoint in this case I'll use both text and images as inputs so I'll specify the multimodal embedding model this remote model setup is one time for the embedding model and I can continue to use it in this project the last setup step to generate embeddings is to create an object table this will give me a structured interface to my object in cloud storage for this example the object table will display metadata around the product catalog images object tables require a few inputs these include a table name a cloud resource connection and the Google Cloud Storage URI where the product catalog images reside note that object tables Only Store metadata and that there's no movement from cloud storage to another location with our setup in place I can now use the ml that generate embedding function the function takes two inputs the first is a remote embedding model that I defined that takes multimodal inputs the second is an object table that references objects in cloud storage then I'll run the query behind the scenes Big query is submitting all of the images in the object table to the multimodal embeddings API hosted in vertex AI it's then returning the results and storing them in a big query table once the query finishes running I can check out the new table here we see a number of fields the first is a field containing a vector embedding the next field displays the status in case of an error and the function also returns all of the fields in the object table associated with each image so instead of spending time outside of big query to generate these embeddings and load them in later I've instead generated everything without leaving our data warehouse with embeddings in a big query table and ready to use let's now turn to Vector search I'll begin by creating a vector index on top of my table this will enable faster and more scalable semantic search by using an approximate nearest neighbor search algorithm I need to give an index name specify the big query table it refers to and Define the embeddings column within the table lastly I can input a number of options in this example example I'll specify that the index uses cosine distance and you can find other options available in the documentation big query will create a vector index for me and I can immediately run Vector searches but full indexing may take some time depending on the size of the embeddings table I can check that progress using the information scheme of views notee that Vector indexes are fully managed by big query and are automatically refreshed when the indexed table changes now I can run that sem IC search the following query does two things it first takes a text input and uses the ml. generate embedding function to generate an embedding using our remote multimodal model it then takes the embedding and Compares it to all of the indexed embeddings I've specified one optional argument so that I only return the top five results again I'll be searching my product image catalog of clothing images to see whether we've ever sold similar products in the past I'll input the string comfy rainbow sweater and check out the results I return the top five matches and the cloud storage Uris now I'll run the same query using a big query Studio notebook and a helper function that renders the images and it looks like we've sold similar sweaters in the past for my next steps I might want to look at the sales data for these sweaters to see which were the best sellers or maybe look at how many were returned turn to us and for what reason I might also consider summarizing the customer reviews for these items to get some inputs for our new product there's a wide array of possibilities on how to proceed with further analysis traditionally working with embeddings and Vector search require deep knowledge of specialized libraries managing complex pipelines and overseeing additional infrastructure big quy dramatically simplifies this process with embedding generation and Vector search built in and with a familiar power of SQL you can unlock new insights without needing to leave your data warehouse with embedding generation in Vector search and big query you can expand the scope of your analysis examples include building content-based recommendation systems content classification and outlier detection and even retrieval augmented generation with big query's Lang chain integration give it a try check out the description below for a step-by-step guide and resources to get you started

Original Description

Discover the power of semantic search! With BigQuery's vector search capabilities, you can analyze unstructured data like text, images, and videos based on their underlying meaning. Explore how machine learning transforms your data into numerical representations called embeddings, making it possible to find connections that traditional keyword searches often miss. In this video, you'll learn how BigQuery seamlessly generates embeddings from unstructured objects and enables semantic search using familiar SQL functions. See a real-world example as we use these techniques to search a non-labeled product image catalog with text. Vector search resources: Learn more in the vector search documentation → https://goo.gle/bq-vector-search Read the vector search blog here→ https://goo.gle/bq-vector-search-blog Embedding generation resources: Learn more in the embedding generation with BigQuery documentation → https://goo.gle/bqml-generate-embedding Subscribe to Google Cloud Tech → https://goo.gle/GoogleCloudTech
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Google Cloud Tech · Google Cloud Tech · 0 of 60

← Previous Next →
1 I’m going for it #GoogleCloudCertified
I’m going for it #GoogleCloudCertified
Google Cloud Tech
2 I had to get #GoogleCloudCertified
I had to get #GoogleCloudCertified
Google Cloud Tech
3 Be better overall at what you do #GoogleCloudCertified
Be better overall at what you do #GoogleCloudCertified
Google Cloud Tech
4 Cloud Monitoring on our radar #Analysis #Uptime
Cloud Monitoring on our radar #Analysis #Uptime
Google Cloud Tech
5 Introduction to Generative AI Studio
Introduction to Generative AI Studio
Google Cloud Tech
6 How to use Github Actions with Google's Workload Identity Federation
How to use Github Actions with Google's Workload Identity Federation
Google Cloud Tech
7 Introduction to Responsible AI
Introduction to Responsible AI
Google Cloud Tech
8 Networking updates and CDMC-certified architecture
Networking updates and CDMC-certified architecture
Google Cloud Tech
9 Create and use a Cloud Storage bucket
Create and use a Cloud Storage bucket
Google Cloud Tech
10 How to digitize text from documents
How to digitize text from documents
Google Cloud Tech
11 Faster analytical queries with AlloyDB
Faster analytical queries with AlloyDB
Google Cloud Tech
12 Next ‘23 sessions and FaaS Wave
Next ‘23 sessions and FaaS Wave
Google Cloud Tech
13 Introduction to Assured Open Source Software
Introduction to Assured Open Source Software
Google Cloud Tech
14 BigQuery Cost Optimization: Storage
BigQuery Cost Optimization: Storage
Google Cloud Tech
15 BigQuery Cost Optimization: Compute
BigQuery Cost Optimization: Compute
Google Cloud Tech
16 BigQuery Cost Optimization: Select Queries
BigQuery Cost Optimization: Select Queries
Google Cloud Tech
17 Remote Field Equipment Management with Manufacturing Data Engine
Remote Field Equipment Management with Manufacturing Data Engine
Google Cloud Tech
18 Supercharging your applications with Cloud SQL Enterprise Plus
Supercharging your applications with Cloud SQL Enterprise Plus
Google Cloud Tech
19 Vector Support on our radar #GenAI
Vector Support on our radar #GenAI
Google Cloud Tech
20 Architecting a blockchain startup with Google Cloud
Architecting a blockchain startup with Google Cloud
Google Cloud Tech
21 Kubernetes and multitasking updates!
Kubernetes and multitasking updates!
Google Cloud Tech
22 GKE: Using Kubernetes Events
GKE: Using Kubernetes Events
Google Cloud Tech
23 How to configure firewall rules for Cloud Composer
How to configure firewall rules for Cloud Composer
Google Cloud Tech
24 Vertex AI Embeddings API + Matching Engine: Grounding LLMs made easy
Vertex AI Embeddings API + Matching Engine: Grounding LLMs made easy
Google Cloud Tech
25 Geospatial analytics on our radar #EarthEngine #BigQuery
Geospatial analytics on our radar #EarthEngine #BigQuery
Google Cloud Tech
26 Ensuring requests are set in Kubernetes
Ensuring requests are set in Kubernetes
Google Cloud Tech
27 Cloud Next 2023, Google research program, and more!
Cloud Next 2023, Google research program, and more!
Google Cloud Tech
28 How to migrate projects between organizations with Resource Manager
How to migrate projects between organizations with Resource Manager
Google Cloud Tech
29 How to run #MySQL in Google Cloud
How to run #MySQL in Google Cloud
Google Cloud Tech
30 #GenerativeAI for enterprises and #Next2023
#GenerativeAI for enterprises and #Next2023
Google Cloud Tech
31 How Google Photos scales to store 4 trillion photos and videos
How Google Photos scales to store 4 trillion photos and videos
Google Cloud Tech
32 Google Cross-Cloud Interconnect (Demo 2)
Google Cross-Cloud Interconnect (Demo 2)
Google Cloud Tech
33 GKE Cost Optimization Golden Signals: Introduction
GKE Cost Optimization Golden Signals: Introduction
Google Cloud Tech
34 GKE Cost Optimization Golden Signals: Workload Rightsizing
GKE Cost Optimization Golden Signals: Workload Rightsizing
Google Cloud Tech
35 GKE Load Balancing: Overview
GKE Load Balancing: Overview
Google Cloud Tech
36 GKE Load Balancing: Best Practices
GKE Load Balancing: Best Practices
Google Cloud Tech
37 Disaster Recovery in GKE
Disaster Recovery in GKE
Google Cloud Tech
38 How to configure IP masquerade agent in GKE Standard clusters
How to configure IP masquerade agent in GKE Standard clusters
Google Cloud Tech
39 Enable and use GKE Control plane logs
Enable and use GKE Control plane logs
Google Cloud Tech
40 Compliance in Australia with Assured Workloads
Compliance in Australia with Assured Workloads
Google Cloud Tech
41 Creating budgets and budget alerts in Google Cloud #FinOps
Creating budgets and budget alerts in Google Cloud #FinOps
Google Cloud Tech
42 Cloud SQL Enterprise Plus on our radar #mySQL
Cloud SQL Enterprise Plus on our radar #mySQL
Google Cloud Tech
43 What's Next for Google Cloud?
What's Next for Google Cloud?
Google Cloud Tech
44 How Loveholidays scaled with Contact Center AI
How Loveholidays scaled with Contact Center AI
Google Cloud Tech
45 What is fleet team management in GKE?
What is fleet team management in GKE?
Google Cloud Tech
46 Troubleshoot VPC Network Peering
Troubleshoot VPC Network Peering
Google Cloud Tech
47 Introduction to DocAI and Contact Center AI
Introduction to DocAI and Contact Center AI
Google Cloud Tech
48 Cloud Run Direct VPC egress explained
Cloud Run Direct VPC egress explained
Google Cloud Tech
49 Database deployment options in GKE
Database deployment options in GKE
Google Cloud Tech
50 Analyze cloud billing data with #BigQuery
Analyze cloud billing data with #BigQuery
Google Cloud Tech
51 Tips to becoming a world-class Prompt Engineer
Tips to becoming a world-class Prompt Engineer
Google Cloud Tech
52 Serverless is simple. Do I need CI/CD?
Serverless is simple. Do I need CI/CD?
Google Cloud Tech
53 Accelerating model deployment with MLOps
Accelerating model deployment with MLOps
Google Cloud Tech
54 How Hawaii's Department of Human Services scaled with CCAI
How Hawaii's Department of Human Services scaled with CCAI
Google Cloud Tech
55 Pricing API on our #Radar
Pricing API on our #Radar
Google Cloud Tech
56 How Recommendations AI for Media can boost customer retention
How Recommendations AI for Media can boost customer retention
Google Cloud Tech
57 Troubleshooting: Node Not Ready Status
Troubleshooting: Node Not Ready Status
Google Cloud Tech
58 One weekend until Cloud Next 2023!
One weekend until Cloud Next 2023!
Google Cloud Tech
59 #GoogleCloudNext starts tomorrow!
#GoogleCloudNext starts tomorrow!
Google Cloud Tech
60 #GoogleCloudNext will be demand!
#GoogleCloudNext will be demand!
Google Cloud Tech

This video teaches you how to leverage BigQuery's vector search capabilities and embedding generation to analyze unstructured data, making it possible to efficiently process large quantities of data and return relevant results. By following the steps outlined in the video, you can build your own vector search models and optimize analytical use cases. The video covers key concepts such as retrieval augmented generation, fine-tuning, and vector search, and provides practical examples using BigQuer

Key Takeaways
  1. Create a cloud resource connection to access images in Cloud Storage
  2. Define a remote model in BigQuery to access the embedding model
  3. Create an object table in BigQuery to give a structured interface to objects in Cloud Storage
  4. Use the ML generate embedding function to generate embeddings from images in Cloud Storage
  5. Create a vector index on top of a BigQuery table to enable faster and more scalable semantic search
  6. Generate an embedding using a remote multimodal model
  7. Compare the generated embedding to all indexed embeddings to return top results
💡 The key insight from this video is that BigQuery's vector search capabilities and embedding generation can be used to efficiently analyze unstructured data and return relevant results, making it a powerful tool for a variety of applications.

Related Reads

📰
Your RAG Eval Isn't Flaky. Your Retrieval Is Non-Deterministic.
Learn why your RAG evaluation may be returning different results despite using the same query, documents, and model, and how to address non-deterministic retrieval
Dev.to · Vasyl
📰
Reciprocal Rerank Fusion (RRF): The Simple, Powerful Way to Combine Keyword + Semantic Search in RAG
Learn how to combine keyword and semantic search in RAG using Reciprocal Rerank Fusion (RRF) for improved search results
Dev.to · Christopher S. Aondona
📰
RAG Evaluation with RAGAs: Faithfulness, Context Recall, and Answer Relevance
Learn to evaluate RAG models using RAGAs, focusing on faithfulness, context recall, and answer relevance, to improve AI assistant performance
Dev.to · Michael Pham
📰
Stop Serving Raw Cosine Scores: Explainable RAG Confidence Scoring at Query Time
Learn to move beyond raw cosine scores for RAG confidence scoring and create more explainable and trustworthy results
Dev.to AI
Up next
Google RAG Secret to Higher Rankings w/ Josh Bachynski #shorts
josh bachynski
Watch →