Bridging Big Data and AI: Empowering PySpark With Lance Format for Multi-Modal AI Data Pipelines
Summary
- Multimodal AI data pipelines: This video demonstrates how PySpark with Lance format bridges big data processing and multimodal AI workloads for images, tensors, embeddings and large data.
- Lance format advantages: Lance delivers zero-copy schema evolution, robust support for large record-size data and advanced indexing for semantic and full-text search with rapid random access.
- Unified AI data engineering: By combining PySpark's data processing power with Lance's AI-optimized storage, data engineers can manage diverse data types required for cutting-edge AI applications.
Bridging Big Data and AI: Empowering PySpark With Lance Format for Multi-Modal AI Data Pipelines

Talk by Allison Wang, Staff Software Engineer, Databricks ; LU QIU, Database Engineer, LanceDB
PySpark has long been a cornerstone of big data processing, excelling in data preparation, analytics and machine learning tasks within traditional data lakes. However, the rise of multimodal AI and vector search introduces challenges beyond its capabilities. Spark’s new Python data source API enables integration with emerging AI data lakes built on the multi-modal Lance format. Lance delivers unparalleled value with its zero-copy schema evolution capability and robust support for large record-size data (e.g., images, tensors, embeddings, etc), simplifying multimodal data storage. Its advanced indexing for semantic and full-text search, combined with rapid random access, enables high-performance AI data analytics to the level of SQL. By unifying PySpark's robust processing capabilities with Lance's AI-optimized storage, data engineers and scientists can efficiently manage and analyze the diverse data types required for cutting-edge AI applications within a familiar big data framework.
Databricks Named a Leader in the 2025 Gartner® Magic Quadrant™ for Data Science and Machine Learning Platforms: https://www.databricks.com/blog/databricks-named-leader-2025-gartner-magic-quadrant-data-science-and-machine-learning
Build and deploy quality AI agent systems: https://www.databricks.com/product/artificial-intelligence
See all the product announcements from Data + AI Summit: https://www.databricks.com/events/dataaisummit-2025-announcements
FAQs
Why is Lance format important for AI workloads?
Lance format is purpose-built for AI workloads with zero-copy schema evolution, support for large record sizes like images and embeddings, and advanced indexing for semantic and full-text search.
How does PySpark with Lance enhance multimodal data processing?
The combination enables data engineers to use familiar PySpark APIs while leveraging Lance's AI-optimized storage for images, tensors, embeddings and other large data types in unified pipelines.
How does the Lance format optimize data for machine learning and AI workloads?
Lance is an open-source data format designed specifically for AI workloads, offering superior performance for vector embeddings, similarity search, and iterative machine learning operations compared to general-purpose formats. Built on Apache Arrow, Lance provides efficient columnar storage with built-in support for vector operations that accelerate retrieval and computation during model training and inference. Integration with PySpark on the Databricks Data and AI platform enables data scientists to work with large-scale datasets while maintaining the performance characteristics needed for modern AI applications.
How does Lance improve efficiency of vector storage and similarity search?
Lance optimizes vector storage by using specialized data structures and indexing techniques that enable fast approximate nearest neighbor search on billion-scale datasets. The format stores vectors alongside metadata in columnar form, reducing I/O overhead during retrieval and supporting efficient filtering before similarity computation. This efficiency is critical for retrieval augmented generation and semantic search applications where latency and throughput directly impact user experience.
How does Lance bridge the gap between data engineering and AI platforms?
Lance provides a common data interchange format that enables seamless collaboration between data engineering and AI teams by offering efficient access patterns for both analytical queries and machine learning workloads. PySpark integration means data engineers can prepare datasets in familiar environments while data scientists and ML engineers can directly consume the data without expensive format conversion. This standardization reduces pipeline complexity and ensures both teams work with consistent, optimized data representations.
Full transcript
Okay, we will get started. So, hey everyone. Today I today I will have present with my co-speaker. So, we will give a talk here about how we empowering PiSpark with Lens AI Data Lake for multimodal AI data pipeline. And I'm a database engineer at Lens DB. So, I'm basically building like big data AI frameworks. Of course, Lens and also Ray and Spark. But, my contribution is nothing compared to what has done. And she's one of the early members for PiSpark and also Spark SQL.
So, he had been working hard to bridge like big data like Spark with all the gen AI frameworks like Lens. And the problem that we are trying to solve today is how we dealing with the multimodal data. It's not just text, it's not just like small like tabular data. We are actually dealing with like images, PDF, like uh uh sensor data, video, audio, all kinds of like uh large data. Basically, large blobs. And also, embedding are also large.
And the existing frameworks like the big data frameworks, they are short in dealing with those large blob data. And that's why we come up with the solution called Lens AI Data Lake. It's kind of like a Parquet plus Iceberg plus indices, but built for the AI from the day one. We tried to use like Parquet and Iceberg in the beginning to solve the problems that we face in AI workloads. However, we shortly found that it's a heavy lifting for the Parquet and Iceberg.
And we have to do a bunch of like modification on top, but the performance is not meeting our expectation. That's why we try to build everything from the ground up. So, the question that we trying to serve is listed here. We sometimes call it the new cat theorem. So, we want to be able to store multimodal data, basically large blobs. And we want to be able to do really fast data access. And the two access the pattern that we basically uh identified that is common in AI workloads is very similar to Parquet, the fast scan performance.
How can you quickly stream a large blob of data to your applications? And the second one is random access. Basically, for AI workloads, especially for training, like you're doing open shuffling, and also for serving all kinds of different search. You need to be able to do O(1) random access to find the rows that you need. And then then take that row to your application. And Parquet and Iceberg is short in dealing with the random access.
That's why we are building everything from ground up to solve this problem that support large blobs, support multimodal data, allow to fast scan that um basically comparable to what Parquet can did. And solve the O(1) random access which Parquet is short in dealing with. And outside of this, we also want to support all kinds of indices to speed up our fast data access. And compared to uh Iceberg, we have many functions that Iceberg already existing, like doing the versioning, doing the schema evolution.
But, we are not just dealing with the old school school like schema evolution. What we support is called functions. So, you can take a column and then you can define your own function of like how you going to uh what transformation you want to apply on top of that column to generate another column. But, it's so this function will apply to each value in that column. So, you can really easily say that, "Oh, I want to like multiply by two or I want to like leverage some kinds of models to generate some information out of the existing column as a new column."
I will give like more details example in the later slides. Like like AI companies, they are processing a large amount of images, especially for companies like WLE and Midjourney. Like WLE is founded by Fei-Fei Li and is the emerging leader in the 3D generation AI area. And Midjourney is one of the biggest like AI image generation company. For those companies, like images is a critical asset. How can you process a large amount of images and how can you dig out information from those images are critical.
And in this case, they store all their images like building of like images in Lens DB in Lens AI Data Lake. And they they use the functions to leverage the existing models to generate informations like, "Oh, what this image is actually talking about? Are there two people fighting each other? Or what's the caption of this image? Like what they actually catch?" And then you can also use some of the existing Python libraries to generate rich metadata from those images.
Like how what's the width, what's the height of this images. And all those information will be stored as different columns in a well-organized way in a single table. Another example here is about video processing. Like companies like Runway, which is the leading AI video generation company. They need to leverage their massive scale like video assets and rich metadata to build their video like uh foundation models. And they use Lens DB to efficiently store videos and the video metadata that generate here leverage like Lens functions.
And from the videos, they can process like images or also audio information. And all those can be stored as different tables inside Lens AI Data Lake. And from the each like each table, like from video, you can use the existing like Python libraries to get like pattern of the video and also like maybe a summary of like what this video is actually about, like some text information. And you can also use embedding models to generate embeddings and generate all kinds of information from your original multimodal data.
Like what Like for images, you can also like leverage models to generate what this image is actually about, what's the caption, and what's the embedding, and all kinds of information. So, in this way, all your videos, images, and audio together with all the information that you generate from the source data can all store in the same like Lens AI Data Lake. And if we have like multimodal data just stored there and we're not using it, that is useless.
But, so for Lens, we're not just storing multimodal data. We actually allow you to do a rich search on top of your multimodal data. So, that here we support like three kinds of different search capability. We support full text search, which is basically keyword search. Just like Google, you type your keyword and then you get your results. So, it's really helpful when you turn your multimodal data into some text description and then you search based on the keywords on this text columns.
And we also support like but also for full text search, one example is like if you have a kind of like recipe kind of like data lake and you want to search of like, "Oh, I want to make an apple pie tonight." And then you can use keyword search to search apple and pie to get the recipes that basically do apple pie. Um sometimes when you ask your other half of like, "Uh what I What do you feel like eating tonight?" You may say, "Oh, I want something like sweet, but not that sweet.
Uh sour, but not that sour." Then you may not be able to leverage full text search. But, this is the moment that you kind of like trying to leverage better search. So, to search the recipe that actually fulfill your really vague requirements. And you can combine these two together to search a apple recipe that is sweet, but not that sweet. Sour, but not that sour. But, then you may get some uh really creepy kind of like a recipe that maybe like they combine apple pie with salmon, with different kinds of fish, and then create something really weird.
Then this is the moment that you want to leverage SQL search. Like you can search like only the recipes that is that have reviews more than 100 and also the recipes that have like four out of five like reviews. Basically, the score is good. So, in this case, you can leverage all the full text search, better search, and SQL search to fulfill your search requirement both for exactly match queries, for really vague queries, and also to do the filtering to make sure the search quality is good.
And on the other hand, like this we we provide the search engine and the search engine is highly scalable. It The scalable is coming from our architecture design. You store all the multimodal data on cloud storage leveraging Lens AI Data Lake. On the other side, you have the search engine. So, search engine will only pull the needed data and indices from the cloud storage into your compute cluster. So, which is like if you want like more search capability, higher QPS, you just launch more compute engine.
So, that's pretty simple. Then because of that, we are able to support like two different workloads. You can do the local experiment with just a Python library. You can just import PiLens import Python Lens DB or import Lens DB. And then you can do all kinds of like experiment to create your multimodal data set, to do all these kinds of searches. And we also have the massive scalable Lens DB cloud and enterprise offering, which can do a much bigger scale.
For example, our biggest deployment currently is like more than 10 billion rows, more than 20 petabytes of data. And we serve like more than 20,000 QPS queries per second. And also, we're serving at really fast speed under 150 milli- milliseconds for P99. And all those can be used the same code. Basically, when you switch from local experiment to your enterprise, you just switch like which endpoint you connect to. Is it your local endpoint or is the cloud or enterprise endpoint?
So, the same code can be applied to the local environment and also for your enterprise like deployment. And I just talked about so many uh different functionalities that uh Lens already serve, but how does it like how does different pieces that merge together? And this is the graph that we merge all the capabilities together. In the traditional like data lake on the left side, um you may have like the your traditional data lake, you may have different kinds of data space that for different uh functions.
Like for example, you may have the Elastic Search to do full text search. You may leverage vector database for vector search. And you may have the Postgres DB that allow you to do to do the SQL search. Like each database have their uh basically their search capability. If you want to add another one, you need to add another data storage and another data uh a different framework. And on the other side like in order to basically provide a good like data access capability for different like um like data analytics and training framework, you also need to create your own training data lake or your warehouse solution to be able to connect to different big data AI frameworks.
But leverage Lens AI data lake, we are able to how to store multimodal data directly in the data lake. And the data lake does the search engine that we already developed can directly support you to do vector search, full text search, and SQL search. And the combination like random combination of those like search capabilities. And on the other side, we are able to directly connect to like the compute engine. And actually the performance is pretty good because we are able to leverage the random access capability and all kinds of search capability that embedded in our search engine.
So, that we can do a bunch of query optimization that the traditional parquet aspect cannot do. And I So, as I mentioned like Lens um Lens AI data lake like could have a rich functionality, but we are not trying to solve everything by ourselves. We have a rich company ecosystem. So, you can leverage Spark, Pandas, Arrow for data generation. So, especially for Spark, you can quickly ingest your data from your data sources in a distributed way into the this multimodal Lens AI data lake.
And after your data your data is saved in the Lens AI data lake, you are able to analyze this data and under to get information like all of this data leveraging Spark, Trino, and DuckDB to do your SQL queries and to do your BI like workloads. And you are able to use like PyTorch and Ray to do training on the multimodal data. And this is exactly like what like companies like Wola, like Midjourney, like Runway is doing.
So, all those data is stored in the data lake and then we just funnel the data funnel the data into our training workloads. And on the other side, we also support serving. So, you can integrate with the current popular like Ray or agent systems to do serving like using your familiar tools. Although Lens DB will support like serving directly, but you can also integrate with those like frameworks to leverage the bigger community.
And later on like uh will give a really like zoom in view of like how Lens and Spark working together. And because of the all those compa- uh capabilities and the things that we are able to solve, so we are actually being used in production by the leading data infra company and also the frontier model companies like Databricks, Bytedance, uh the several biggest like data infra company. And also for the frontier mid model company like the image uh foundation model company, the video, the 3D, and also the multimodal data access company.
And also automo- autonomous drive like the companies. Also, we are leveraging by the agent company. For example, is the biggest like AI law firm company. Now, I will hand it to talk more about like how Lens and Spark work together. All right. Okay, thanks thanks. Um can everyone hear me? Okay, great. Awesome. Okay, thanks for the awesome introduction for Lens DB. Um I really like the recipe examples that gave. That's uh just a very fascinating examples.
Okay. So, now let's talk about um the challenge. So, the challenge that we are facing today in in the in the big data landscape is the disconnect between the big data and the AI applications. So, on the left-hand side, we have the world of data. So, where So, here we are dealing with multimodal data including text, images, audios, PDF files. And oftentimes, we need to process these multimodal data using analytics engines like Spark and for data transformations and data cleanings and various use cases.
So, on the left-hand side, uh we have data. And on the right-hand side, we have AI. And the efficient data formats like Lens can actually be used to power a variety of AI applications. But here's the problem. There's a gap between the data world and the AI world and they don't really talk to each other seamlessly. You need to write your custom functions to convert a data frame into the Lens format or vice versa. So, how can we bridge these two world together?
And the solution here is the Lens Spark connector. The Spark provides multiple APIs for you to integrate different connectors into uh into Spark. And the Lens DB recently added a new Spark Lens connector. And you can also use the new Python data source API to build your own connectors. So, here is the Lens Spark connector I think built by uh from Lens DB. Uh he's here. So, it can seamlessly uh allow you to query the data sets uh stored in a Lens format in Spark to do all kinds of transformations.
And it can also leverage a lot of uh performance features. For instance, the column pruning and the future push down for different um to make it more performant. However, this connector currently only works for reading from the Lens data sets. So, what if you want to write a Spark data frame data frame into the Lens format? Now, introducing a new kind of API is called Python data source API. It allows you to actually build your custom connectors in Spark um just in Python.
So, it's a new feature in Spark 4 and it can be seamlessly integrated into your existing pipelines and it supports both batch processing and stream stream processing for both reading and writing the data. So, there are three main steps for you to use uh and develop a a connector for Lens DB. So, first of all, you can extend the data source class uh and you can give it a descriptive name like Lens. And then once you uh build your data sets by build your build your data source, you can register this data source into the current Spark session and then be able to use your uh data source uh by leveraging the Spark's data frame API.
So, how it works under the hood. It's um just in three lines of code, we can actually build a fully functional Lens DB Lens writer to convert a Spark data frame into the Lens format. And it's performant because it can leverage Apache Arrow under the hood. So, Arrow actually minimize the over- uh uh the serialization overhead enabling zero uh fast zero copy data transfer between the JVM and the Python process. And it's also very simple.
So, you can use Lens DB's API and Spark's uh data frame API together uh and it seamlessly can be seamlessly integrated with Apache Arrow. And here's how you can easily use this connector. You can register this custom Lens Spark connector and write a data frame uh using the Lens format just in one line of code. So, here are many other sessions in the DICE Summit uh and we recommend you to watch and learn more about Lens DB and the Python data source API.
Okay, that's all. Thank you for coming and if you have any questions, feel free to find me and. Mhm.
Learn more about the Databricks Data and AI platform.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.