<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Burcin Bozkaya on Medium]]></title>
        <description><![CDATA[Stories by Burcin Bozkaya on Medium]]></description>
        <link>https://medium.com/@bbozkaya?source=rss-743df9db1666------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3aQbPdqBobNWk3DmrmhQgQ.png</url>
            <title>Stories by Burcin Bozkaya on Medium</title>
            <link>https://medium.com/@bbozkaya?source=rss-743df9db1666------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 01:54:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bbozkaya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Efficient Vector Similarity Search in Recommender Workflows using Milvus with NVIDIA Merlin]]></title>
            <link>https://medium.com/nvidia-merlin/efficient-vector-similarity-search-in-recommender-workflows-using-milvus-with-nvidia-merlin-84d568290ee4?source=rss-743df9db1666------2</link>
            <guid isPermaLink="false">https://medium.com/p/84d568290ee4</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[gpu-acceleration]]></category>
            <category><![CDATA[recommender-systems]]></category>
            <category><![CDATA[vector-embeddings]]></category>
            <dc:creator><![CDATA[Burcin Bozkaya]]></dc:creator>
            <pubDate>Mon, 28 Aug 2023 08:09:47 GMT</pubDate>
            <atom:updated>2023-08-28T08:09:47.018Z</atom:updated>
            <content:encoded><![CDATA[<p>by <a href="https://medium.com/u/743df9db1666">Burcin Bozkaya</a>, <a href="https://medium.com/u/3e8a3c67a8a5">Filip Haltmayer</a>, <a href="https://medium.com/u/279d4c25a145">William Hicks</a>, <a href="https://github.com/liliu-z">Li Liu</a></p><h3>Introduction</h3><p>Modern recommender systems consist of training/inference pipelines that involve multiple stages of data ingestion, data preprocessing, model training and hyperparameter-tuning for retrieval, filtering, ranking and scoring of relevant items. The result is highly personalized recommendations to improve user experience and engagement. In a recent <a href="https://medium.com/nvidia-merlin/recommender-systems-not-just-recommender-models-485c161c755e">blog post</a>, the NVIDIA Merlin team describes these workflows as multistage recommender systems implemented in various industries and use cases, such as e-commerce, streaming services, or social media.</p><p>An important component of a recommender system pipeline is the retrieval or discovery of items that are most relevant to a user, particularly in the presence of large item catalogs. This typically involves an approximate nearest neighbor (ANN) search over an indexed database of low-dimensional vector representations (i.e., embeddings) of product and user attributes, created from deep learning models that train on interactions between users and products/services. Vector representations can also be derived from various modalities of data, such as images, videos or textual descriptions of products and/or users, using computer vision algorithms or language models. A critical step is to conduct an efficient top-k (i.e., k most similar) search over a large set of vector embeddings in the order of hundreds of thousands (e.g., as in an e-commerce product inventory), if not millions/billions.</p><p><a href="https://github.com/NVIDIA-Merlin">NVIDIA Merlin</a>, an open-source framework developed for training end-to-end models to make recommendations at any scale, integrates with an efficient vector database index and search framework. One such framework that has gained much recent attention is <a href="https://zilliz.com/what-is-milvus">Milvus</a>, an open-source framework by <a href="https://zilliz.com/">Zilliz</a>, offering fast index and query capabilities. Most recently, Milvus added <a href="https://github.com/milvus-io/milvus/releases/tag/v2.3.0">GPU acceleration support</a> that uses NVIDIA GPUs that sustain AI workflows. GPU acceleration support is great news because an accelerated vector search library makes fast concurrent queries possible, which has a huge positive impact on the latency requirements in today’s recommender systems, where a large number of concurrent requests are common. Milvus has had 3.4M docker pulls and ~21k stars on GitHub (as of July 2023) and has been used in many application use <a href="https://medium.com/vector-database/tagged/use-cases-of-milvus">cases</a>.</p><p>In this blog, we demonstrate how Milvus works with the Merlin recsys framework, both at training and inference time. We show how Milvus complements Merlin in the item retrieval stage with a highly efficient top-k vector embedding search and how it can be used with NVIDIA Triton Inference Server (TIS) at inference time (see Figure 1). Our benchmark results show an impressive <strong>37x to 91x speedup</strong> with GPU-accelerated Milvus that uses NVIDIA RAFT with the vector embeddings generated by Merlin Models. The code we use to show Merlin-Milvus integration and detailed benchmark results are available <a href="https://github.com/bbozkaya/merlin-milvus/tree/main">here</a> along with the <a href="https://github.com/zilliztech/vectordb-benchmark">library</a> that facilitated our benchmark study.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*daGyviPVFiVZhNpv" /><figcaption>Figure 1. Multistage recommender system with Milvus framework contributing to the retrieval stage. (Source for the original multistage figure: this <a href="https://medium.com/nvidia-merlin/recommender-systems-not-just-recommender-models-485c161c755e">blog post</a>.)</figcaption></figure><h3>The Challenge</h3><p>Given the multistage nature of recommenders and the availability of various components and libraries integrated within, a major challenge is integrating all components seamlessly in an end-to-end pipeline. We aim to show that integration can be done with less effort in our example notebooks.</p><p>Another aspect of recommender workflows is the <strong>need to accelerate</strong> certain parts of the pipeline. While known to play a huge role in training large neural networks, GPUs are only recent additions to the world of vector databases and ANN search. With an increasing size of e-commerce product inventories or streaming media databases and the number of users using these services, CPUs fail to provide the required performance to serve millions of users in performant recsys workflows. To address this challenge, GPU acceleration in other parts of the pipeline has become necessary. The solution in this blog addresses this challenge by showing that ANN search is efficient when using GPUs.</p><h3>Tech Stack</h3><p>Let’s start by first reviewing some of the fundamentals needed to conduct our work. We need a recsys framework that we can base our work on, which is <a href="https://github.com/NVIDIA-Merlin/Merlin">NVIDIA Merlin</a>. Merlin is an open-source library with high-level APIs accelerating recommenders on NVIDIA GPUs. It enables data scientists, ML engineers, and researchers to build high performing recommenders at scale. We also use the following open source tools/libraries in this work:</p><ul><li><a href="https://github.com/NVIDIA-Merlin/NVTabular"><strong>NVTabular</strong></a><strong>:</strong> for pre-processing the input tabular data and feature engineering.</li><li><a href="https://github.com/NVIDIA-Merlin/models"><strong>Merlin Models</strong></a><strong>:</strong> for training deep learning models, and to learn, in this case, user and item embedding vectors from user interaction data.</li><li><a href="https://github.com/NVIDIA-Merlin/systems"><strong>Merlin Systems</strong></a><strong>:</strong> for combining a TensorFlow-based recommendation model with other elements (e.g., feature store, ANN search with Milvus) to be served with TIS.</li><li><a href="https://github.com/triton-inference-server/server"><strong>Triton Inference Server</strong></a><strong>:</strong> for the inference stage where a user feature vector is passed and product recommendations are generated.</li><li><strong>Containerization:</strong> all of the above is available via container(s) provided by NVIDIA in the <a href="https://catalog.ngc.nvidia.com/">NGC catalog</a>. We used the Merlin TensorFlow 23.06 container available <a href="https://catalog.ngc.nvidia.com/orgs/nvidia/teams/merlin/containers/merlin-tensorflow">here</a>.</li><li><a href="https://github.com/milvus-io/milvus/releases/tag/v2.3.0"><strong>Milvus 2.3</strong></a><strong>:</strong> for conducting GPU-accelerated vector indexing and querying.</li><li><a href="https://github.com/milvus-io/milvus/releases"><strong>Milvus 2.2.11</strong></a><strong>:</strong> same as above, but for doing it on CPU.<br>- <strong>pymilvus SDK:</strong> for connecting to Milvus server, creating vector database indexes and running queries via a python interface.</li><li><a href="https://github.com/feast-dev/feast"><strong>Feast</strong></a><strong>:</strong> for saving and retrieving user and item attributes in an (open source) feature store as part of our end-to-end RecSys pipeline.</li></ul><p>We also note that several underlying libraries and frameworks are also used under the hood. For example, Merlin relies on other NVIDIA libraries such as cuDF and Dask, both available under <a href="https://github.com/rapidsai/cudf">RAPIDS cuDF</a>. Likewise, Milvus relies on <a href="https://github.com/rapidsai/raft">NVIDIA RAFT</a> for primitives on GPU acceleration and modified libraries such as HNSW and FAISS for search.</p><h3>Understanding Vector Databases</h3><p>Approximate nearest neighbor is a functionality that relational databases are not built to handle. Relational DBs are designed to handle tabular data with predefined structures and directly comparable values. Relational database indexes rely on this to compare data and create structures that take advantage of knowing if each value is less than or greater than the other. Embedding vectors cannot be directly compared to one another in this fashion, as we do not know what each value in the vector represents. They cannot say if one vector is necessarily less than the other. The only thing that we can do is calculate the distance between the two vectors. If the distance between two vectors is small, we can assume that the features they represent are similar, and if large, we can assume that the data they represent are more different. This is useful to us as, with this knowledge, we can create data structures that can provide efficient means to search through this data. These efficient indexes come at a cost; computing the distance between two vectors is computationally expensive, and vector indexes are not easily adaptable and sometimes not modifiable. Due to these two limitations, integrating these indexes is not simple in relational databases, which is why purpose-built vector databases are needed.</p><p><a href="https://zilliz.com/what-is-milvus">Milvus</a> was created to solve the problems that relational databases hit with vectors and was designed from the ground up to handle these embedding vectors and their indexes at a large scale. To fulfill the cloud-native badge, Milvus separates compute and storage and different compute tasks — querying, data wrangling, and indexing. Users can scale each database part to handle other use cases, whether data insert-heavy or search-heavy. If there is a large influx of insertion requests, the user can temporarily scale the index nodes horizontally and vertically to handle the ingestion. Likewise, if no data is being ingested but there is a large amount of searches, the user can reduce the index nodes and instead scale up the query nodes for more throughput. This system design (see Figure 2) required us to think in a parallel compute mindset, ultimately resulting in a compute-optimized system with many doors open for further optimizations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iCQWSCiNtVkHBdbk" /><figcaption>Figure 2. Milvus system design</figcaption></figure><p>Milvus also uses many state-of-the-art indexing libraries to give users as much customization for their system as possible. It improves them by adding the ability to handle CRUD operations, streamed data, and filtering. Later on, we will discuss how these indexes differ and what the pros and cons of each are.</p><h4>Indexing Vector Data</h4><p>Most vector indexes fall between two computation categories, clustering and graphs. IVF, an algorithm in the clustering bucket, uses k-means to calculate the clusters of closest neighbors. The query vector is then compared to the nearest cluster of centroids and searched during search time. <a href="https://zilliz.com/blog/hierarchical-navigable-small-worlds-HNSW">HNSW</a>, <a href="https://zilliz.com/blog/diskann-a-disk-based-anns-solution-with-high-recall-and-high-qps-on-billion-scale-dataset">DiskANN</a>, and other algorithms in the graph category mainly revolve around Navigating Spreading-out Graphs, which are graphs that are efficient at doing nearest-neighbor searches. Unfortunately, graph algorithms in this space are a bit more complex, so if you are interested, check out this <a href="https://zilliz.com/blog/hierarchical-navigable-small-worlds-HNSW">post</a>.</p><p>On top of these is another level of switches called product quantization (PQ). PQ is a way to compress your vector data to reduce resource usage and increase performance at the cost of recall/accuracy. Most algorithms in this space come with a quantized variant to allow toning down memory usage or increase the performance of their approach.</p><p>What’s the difference between all these algorithms and combinations? Why are there so many? This is due to the tradeoff between performance, recall, and memory usage. An index like IVF_FLAT is a balanced index that gives good results at a good speed without too much memory overhead. Compression-based indexes such as IVF_SQ8 and IVF_PQ are stronger regarding speed and decreased memory usage at the cost of heavy recalls reductions depending on the compression level used. HNSW is on the other side of the spectrum as it targets the best performance and recall at the cost of memory. DiskANN is unique compared to the rest as it is a disk-based index. The previous indexes are all fully in-memory, requiring large amounts of RAM. DiskANN only holds a small amount of the index in memory and instead has the grunt of the data in disk storage, allowing DiskANN to heavily reduce memory usage while still keeping recall at the cost of poor throughput performance and depending on the type of SSD used, latency performance.</p><p>The field has changed; it isn’t the case anymore that only large users/corporations can access extremely large datasets. Small users might generate billions of vectors from their data and need the ability to search it in the most cost-effective way. In contrast, a large user might only have a few hundred thousand data points that need to handle 10,000’s queries per second (QPS). To address this, there are a lot of customizations at the index level to support each use case; for more information, look <a href="https://milvus.io/docs/index.md">here</a>.</p><h4>GPU vs CPU</h4><p>For most users, GPU indexes are key to getting the performance they search for. They provide the high throughput many use cases require while saving money in the long run.</p><p>Building and searching indexes heavily rely on vectorized compute, which can be done on CPU but is greatly increased by GPU. Milvus achieved a <strong>37x</strong> to <strong>91x</strong> increase in QPS by moving the search computations to the GPU. This increase is significant as the only other way to get this increase in performance is by scaling up the cluster significantly. By using GPUs, users can greatly increase their performance while streamlining the cluster, reducing the need for extra nodes and scheduling overhead.</p><p>There is a caveat in this GPU-based search, though, and it’s the case of low concurrency. GPU performance is much better than CPU when the concurrency is high and when the slowdown from transferring data between CPU and GPU memory is smaller than the total savings in search time. In low concurrency situations, latency will be larger with GPUs as the CPU can complete the search faster than it takes to transfer it to and from the GPU.</p><h3>Example Solution</h3><p>The example solution we present demonstrates the integration of Milvus with Merlin at the item retrieval stage (when k most relevant items are retrieved through an ANN search). We use a real-life dataset from a RecSys challenge, described below. We train a Two-Tower deep learning model that learns vector embeddings for users and items. In this section, we also provide the blueprint of our benchmarking work, including the metrics we collect and the range of parameters we use.</p><h4>Dataset</h4><p>YOOCHOOSE GmbH provides the dataset we use in this integration and benchmark study for the RecSys 2015 challenge and is available on Kaggle. It contains user click/buy events from a European online retailer with attributes such as a <em>session id</em>, <em>timestamp</em>, <em>item id</em> associated with click/buy, and <em>item category</em>, which are available in the file yoochoose-clicks.dat. The sessions are independent, and there is no hint of returning users, so we treat each session as belonging to a distinct user. The dataset has 9,249,729 unique sessions (users) and 52,739 unique items.</p><p>Our approach involves a) data ingestion and preprocessing, b) Two-Tower deep learning model training, c) Milvus index building, and d) Milvus similarity search. We briefly describe each step and refer the reader to our <a href="https://github.com/bbozkaya/merlin-milvus/tree/main/notebooks">notebooks</a> for details.</p><h4>Data Ingestion and Preprocessing</h4><p>The tool we use for data preprocessing is <a href="https://github.com/NVIDIA-Merlin/NVTabular">NVTabular</a>, a GPU-accelerated, highly scalable feature engineering and pre-processing component of Merlin. It is designed to easily manipulate terabyte-scale datasets and help train deep learning based recommender systems. It provides a high-level abstraction to simplify code and achieves accelerated computation on the GPU using the RAPIDS <a href="https://github.com/rapidsai/dask-cudf">Dask-cuDF</a> library. We use NVTabular to read data into GPU memory, rearrange features as necessary, export to parquet files and create a train-validation split for training. This results in 7,305,761 unique users and 49,008 unique items to train on. We also <em>categorify</em> each column and its values into integer values. The dataset is now ready for training with the Two-Tower model.</p><h4>Model Training</h4><p>We use the <a href="https://github.com/NVIDIA-Merlin/models/blob/main/examples/05-Retrieval-Model.ipynb">Two-Tower</a> deep learning model to train and generate user and item embeddings, which are later used in vector indexing and querying. The model takes as input user attributes (user_id, user_age) and item attributes (item_id, item_category). Optionally, we can also include a target column to include rows with positive interactions only. After the model is trained, we can extract the learned user and item embeddings.</p><p>The next two steps are optional: a <a href="https://arxiv.org/abs/1906.00091">DLRM</a> model trained to rank the retrieved items for recommendation, and a feature store used (in this case, <a href="https://github.com/feast-dev/feast">Feast</a>) to store and retrieve user and item features. We include them for the completeness of the multi-stage workflow.</p><p>Finally, we export the user and item embeddings to parquet files, which can later be reloaded to create a Milvus vector index. We can now launch the Milvus server and feed the item embeddings to create a vector index. This would be followed by making similarity search queries for existing and new users at inference time using NVIDIA TIS with a custom Merlin Systems operator. This is in our second notebook example.</p><h4>Building and Querying Milvus Index</h4><p>Milvus facilitates vector indexing and similarity search via a “server” launched on the inference machine. In our notebook #2, we set this up by pip-installing <strong>milvus</strong> server and <strong>pymilvus</strong>, then starting the server with its default listening port. Next, we demonstrate building a simple index (IVF_FLAT) and querying against it, with the two functions setup_milvus and query_milvus, respectively.</p><p>It gets more interesting when we accomplish the same tasks as part of a multi-stage inference within the TIS framework. Merlin provides a high-level API, <strong>Merlin Systems</strong>, that allows combining different stages of the recommender system into a single chained “ensemble model”. As a result, all the stages described above are executed in a single request to TIS. We implement a custom Merlin Systems operator here, called QueryMilvus, as part of the ensemble.</p><p>You may have noticed that the pymilvus library did not utilize the GPU while NVTabular and Merlin Models did. This is because the gpu-accelerated version of Milvus requires launching multiple containers, which is not possible with the Merlin container we used. Instead, we used a version of pymilvus that launches the Milvus server as a process on the same container where our notebooks are running. To run Milvus on GPU, check out this <a href="https://github.com/milvus-io/milvus/releases/tag/v2.3.0">recent release</a> that offers GPU support. The benchmarks conducted on GPU, as reported below, use this library version.</p><h4>Benchmarking</h4><p>To demonstrate the case for using a fast and efficient vector indexing/search library such as Milvus, we have designed two sets of benchmarks.</p><ol><li>Using Milvus to build vector indexes with the two sets of embeddings we generated: 1) user embeddings for 7.3M unique users, split as 85% train set (for indexing) and 15% test set (for querying), and 2) item embeddings for 49K products (with a 50–50 train-test split). This benchmark is done independently for each vector dataset, and results are reported separately.</li><li>Using Milvus to build a vector index for the 49K item embeddings dataset and querying the 7.3M unique users against this index for similarity search.</li></ol><p>In these benchmarks, we used IVFPQ and HNSW indexing algorithms, executed on GPU and CPU, along with various combinations of parameters. Details are available <a href="https://github.com/bbozkaya/merlin-milvus/tree/main/results">here</a>.</p><p>An important performance consideration, especially in a production environment, is the <strong>search quality</strong>-<strong>throughput</strong> tradeoff. Milvus allows full control over indexing parameters to explore this tradeoff for a given use case to achieve better search results in relation to ground truth. This may mean increased computational cost in the form of reduced throughput rate or queries per second (QPS). We measure the quality of ANN search with a <strong>recall</strong> metric and provide <strong>QPS-recall</strong> curves that demonstrate the tradeoff. One can then decide on an acceptable level of search quality given the compute resources or latency/throughput requirements of the business case.</p><p>Also note the query batch size (<em>nq</em>) used in our benchmarks. This is useful in workflows where multiple simultaneous requests are sent to inference (e.g. offline recommendations requested and sent to a list of email recipients or online recommendations created by pooling concurrent requests arriving and processing them all at once). Depending on the use case, TIS can also help process these requests in batches.</p><h3>Results</h3><p>We now report the results for the 3 sets of benchmarks on both CPU and GPU, using HNSW (CPU only) and IVF_PQ (CPU and GPU) index types implemented by Milvus.</p><h4>Items vs. Items vector similarity search</h4><p>With this smallest dataset, each run, for a given parameter combination, takes 50% of the item vectors as query vectors and queries the top 100 similar vectors from the rest. We find that HNSW and IVF_PQ produce high recall with the parameter settings tested, in the range 0.958–1.0 and 0.665–0.997, respectively. This suggests that HNSW performs better w.r.t. recall, but IVF_PQ with small <em>nlist</em> settings produces highly comparable recall. We should also note that the recall values can vary greatly depending on the indexing and querying parameters. The values we report have been obtained after preliminary experimentation with general parameter ranges and zooming further into a select subset.</p><p>The total time to execute all queries on CPU with HNSW for a given parameter combination ranges between 5.22 and 5.33 sec.s (faster as <em>m</em> gets larger, relatively unchanged with <em>ef</em>) and with IVF_PQ between 13.67 and 14.67 sec.s (slower as <em>nlist</em> and <em>nprobe</em> gets larger). GPU acceleration does have a noticeable effect as seen in Figure 3.</p><p>Figure 3 shows the recall-throughput trade-off over all runs completed on CPU and GPU with this small dataset using IVF_PQ. We find that GPU provides a speedup of <strong>4x</strong> to <strong>15x</strong> across all parameter combinations tested (larger speedup as <em>nprobe</em> gets larger). This is calculated by taking the ratio of QPS from GPU over QPS from CPU runs, for each parameter combination. Overall, this set presents little challenge for CPU or GPU, and shows prospects for further speedup with the larger datasets, as we discuss below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W_hTnEBp521XYsS7" /><figcaption>Figure 3. GPU speedup with Milvus IVF_PQ algorithm running on NVIDIA A100 GPU (item-item similarity search)</figcaption></figure><h4>Users vs. Users vector similarity search</h4><p>With the much larger second dataset (7.3M users), we set aside 85% (~6.2M) of the vectors as “train” (the set of vectors to be indexed), and the remaining 15% (~1.1M) “test” or query vector set. HNSW and IVF_PQ perform extremely well in this case, with recall values of 0.884–1.0 and 0.922–0.999, respectively. They are, however, computationally much more demanding, especially with IVF_PQ on CPU. The total time to execute all queries on CPU with HNSW ranges from 279.89 to 295.56 sec.s and with IVF_PQ from 3082.67 to 10932.33 sec.s. Note that these query times are cumulative for 1.1M vectors queried, so one can say that a single query against the index is still very fast. However, CPU-based querying may not be a viable option if the inference server expects many thousands of concurrent requests to run queries against an inventory of millions of items.</p><p>The A100 GPU delivers a blazing speedup of <strong>37x</strong> to <strong>91x</strong> (averaging 76.1x) across all parameter combinations with IVF_PQ in terms of throughput (QPS), shown in Figure 4. This is consistent with what we observed with the small dataset, which suggests the GPU performance scales reasonably well using Milvus with millions of embedding vectors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a8-2jB9yv-ZGdIvI" /><figcaption>Figure 4. GPU speedup with Milvus IVF_PQ algorithm running on NVIDIA A100 GPU (user-user similarity search)</figcaption></figure><p>Also, the following detailed Figure 5 shows the recall-QPS tradeoff for all parameter combinations tested on CPU and GPU with IVF_PQ. Each point set (top for GPU, bottom for CPU) on this chart depicts the tradeoff faced when changing vector indexing/query parameters towards achieving higher recall at the expense of lower throughput. Note the considerable loss of QPS in the GPU case as one tries to achieve higher recall levels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rNrZfUyN1Ze7s1zW" /><figcaption>Figure 5. Recall-Throughput tradeoff for all parameter combinations tested on CPU and GPU with IVF_PQ (users vs. users)</figcaption></figure><h4>Users vs. Items vector similarity search</h4><p>Finally, we consider another realistic scenario where user vectors are queried against item vectors (as demonstrated in Notebook 01 above). In this case, 49K item vectors are indexed, and 7.3M user vectors are each queried for the top 100 most similar items.</p><p>This is where things get interesting because querying 7.3M in batches of 1000 against an index of 49K items appears to be time-consuming on CPU for both HNSW and IVF_PQ. GPU seems to handle this case better (see Figure 6). The highest accuracy levels by IVF_PQ on CPU when nlist = 100 are computed in about 86 minutes on average but vary greatly as the <em>nprobe</em> value increases (51 min. when nprobe = 5 vs. 128 min. when nprobe = 20). The NVIDIA A100 GPU speeds up the performance considerably by a factor <strong>4x</strong> to <strong>17x</strong> (higher speedups as <em>nprobe</em> gets larger). Remember that the IVF_PQ algorithm, through its quantization technique, also reduces memory footprint and, combined with the GPU acceleration, provides a computationally viable ANN search solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YaKXnZHETDyIa_00" /><figcaption>Figure 6. GPU speedup with Milvus IVF_PQ algorithm running on NVIDIA A100 GPU (user-item similarity search)</figcaption></figure><p>Similar to Figure 5, the recall-throughput trade-off is shown in Figure 7 for all parameter combinations tested with IVF_PQ. Here, one can still see how one may need to slightly give up some accuracy on ANN search in favor of increased throughput, though the differences are much less noticeable, especially in the case of GPU runs. This suggests that one can expect quite consistently high levels of computational performance with the GPU while still achieving high recall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7nNKrLYmY9In7j9_" /><figcaption>Figure 7. Recall-Throughput tradeoff for all parameter combinations tested on CPU and GPU with IVF_PQ (users vs. items)</figcaption></figure><h3>Conclusion</h3><p>If you’ve made it this far, we’d happily share a few concluding remarks. We want to remind that modern recsys complexity and its multi-stage nature necessitate performance and efficiency at every step. In this blog, we have hopefully gave you compelling reasons to consider using two key features in your RecSys pipelines:</p><ul><li>NVIDIA Merlin with its Merlin Systems library that allows you to easily plug in <a href="https://github.com/milvus-io/milvus/tree/2.3.0">Milvus</a>, an efficient GPU-accelerated vector search engine.</li><li>Use of GPU to accelerate computations for vector database indexing and ANN search with a technology such as <a href="https://github.com/rapidsai/raft">RAPIDS RAFT</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*qh-rKQItz0ZTx2tPadlaeg.png" /></figure><p>These findings suggest that the Merlin-Milvus integration presented is highly performant and much less complex than other options, both for training and inference. Also, both frameworks are actively developed and many new features (e.g. new GPU-accelerated vector database indexes by Milvus) are added in every release. The fact that vector similarity search is a key component in various workflows, such as computer vision, large language modeling, and recommender systems, makes this effort all the more worthwhile.</p><p>In closing, we would like to thank all those from Zillis/Milvus and Merlin, and RAFT teams who contributed to the effort in producing this work and the blog post. Looking forward to hearing from you, should you have a chance to implement Merlin and Milvus in your recsys or other workflows.</p><h3>References and Resource Links</h3><ul><li><a href="https://github.com/bbozkaya/merlin-milvus">Public repo for this blog</a></li><li><a href="https://www.kaggle.com/datasets/chadgostopp/recsys-challenge-2015">Yoochoose dataset</a></li><li><a href="https://medium.com/nvidia-merlin/recommender-systems-not-just-recommender-models-485c161c755e">Recommender Systems, Not Just Recommender Models</a></li><li><a href="https://medium.com/nvidia-merlin/exploring-production-ready-recommender-systems-with-merlin-66bba65d18f2">Exploring Production Ready Recommender Systems with Merlin</a></li><li><a href="https://medium.com/nvidia-merlin/scale-faster-with-less-code-using-two-tower-with-merlin-c16f32aafa9f">Scale faster with less code using Two Tower with Merlin</a></li><li><a href="https://medium.com/nvidia-merlin/transformers4rec-4523cc7d8fa8">Transformers4Rec: A flexible library for Sequential and Session-based recommendation</a></li><li><a href="https://github.com/NVIDIA-Merlin">NVIDIA Merlin</a></li><li><a href="https://github.com/milvus-io/milvus">Milvus repo</a></li><li><a href="https://medium.com/vector-database/tagged/use-cases-of-milvus">Milvus use-cases</a></li><li><a href="https://zilliz.com/blog/hierarchical-navigable-small-worlds-HNSW">Hierarchical navigable small worlds (HNSW)</a></li><li><a href="https://github.com/triton-inference-server">Triton inference server</a></li><li><a href="https://github.com/rapidsai/raft">NVIDIA RAFT</a></li><li><a href="https://github.com/zilliztech/vectordb-benchmark">Vectordb benchmarking library</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84d568290ee4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nvidia-merlin/efficient-vector-similarity-search-in-recommender-workflows-using-milvus-with-nvidia-merlin-84d568290ee4">Efficient Vector Similarity Search in Recommender Workflows using Milvus with NVIDIA Merlin</a> was originally published in <a href="https://medium.com/nvidia-merlin">NVIDIA Merlin</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A “Practical Data Science” Approach to Detecting Meteors with CAMS]]></title>
            <link>https://bbozkaya.medium.com/a-practical-data-science-approach-to-detecting-meteors-with-cams-9521635f6ac?source=rss-743df9db1666------2</link>
            <guid isPermaLink="false">https://medium.com/p/9521635f6ac</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[meteor-detection]]></category>
            <category><![CDATA[capstone-project]]></category>
            <category><![CDATA[practical-data-science]]></category>
            <dc:creator><![CDATA[Burcin Bozkaya]]></dc:creator>
            <pubDate>Tue, 23 May 2023 14:40:21 GMT</pubDate>
            <atom:updated>2023-05-23T14:40:21.379Z</atom:updated>
            <content:encoded><![CDATA[<p>by <a href="https://medium.com/u/743df9db1666">Burcin Bozkaya</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JoxgW0mysaDba1UnAvEKqw.png" /><figcaption>Image credit: <a href="https://www.nasa.gov/image-feature/perseid-meteor-shower/">NASA</a></figcaption></figure><p>Have you ever looked up to a starry night sky, seen a shooting star and made a wish? I am sure you have. Well, look again and look carefully. Are you sure it is a shooting star, or could it be something else? Can you tell for sure? Well, maybe if your wish comes true, then you can tell with certainty that it was a shooting star, no? 🙂</p><p>In the Fall 2021 semester at <a href="https://www.ncf.edu/academics/graduate-program/">New College of Florida</a>, 7 students* in the Applied Data Science master’s program joined the world-wide effort in analyzing data collected from cameras watching the night skies. Known as the CAMS project (Cameras for Allsky Meteor Surveillance), a NASA-sponsored initiative with the <a href="https://www.seti.org/">SETI Institute</a> and under the leadership of Dr. Peter Jenniskens, the effort is aimed at detecting meteors in the night sky through the use of data collected from multiple cameras watching night-time sky activity. Since 2011, 19 locations worldwide have been launched to collect such data that are intended to help astronomers and researchers to detect meteors, calculate their orbit trajectories and trace their origins. Many researchers and data scientists have tackled to date the challenging task of analyzing these large datasets with the help of data science and machine learning techniques. But this process wasn’t always easy, in fact scientists had to travel to the camera locations, grab the video data, come back to their offices and spend hours in almost uneventful darkness watching the video footage to recognize meteors. in 2017 a team from <a href="https://frontierdevelopmentlab.org/">Frontier Development Lab</a> (FDL) automated this process and built an initial data processing pipeline. Since then the CAMS AI pipeline has been improved yearly, leading to 6x growth and now in 2021 a team from <a href="https://spaceml.org/">SpaceML</a> improved the AI models precision and recall and built a portal to view meteor data from all over the world (more information <a href="https://meteorshowers.seti.org/">here</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TK3MPUDUJmyDByTNGbKN1A.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TR_Xx7YrocOhfBYxryd5yw.gif" /></figure><p><strong>A Hands-on Capstone Project Course</strong></p><p>We took up this challenge as part of our Practical Data Science course offered at New College every Fall semester in partnership with companies and organizations. This is a major hands-on activity in our master’s program after all foundational coursework is completed, that aims to serve one main purpose: connect our students with the industry to provide them hands-on experience in applying data science to real-world problems. Companies and organizations present their problems along with matching datasets and seek help from student teams that will develop solutions, models, algorithms, and applications that address these problems. Under my supervision as the course instructor, we start the process as early as the Spring semester by soliciting projects and datasets from companies, followed by compiling and presenting them to the cohort who will enroll in the course, overseeing the communications that would lead to student-team and team-project assignments, and finally launching each project the first week of the Fall semester. In Fall 2021, 14 project ideas were proposed by 4 organizations, one of which was the SpaceML led CAMS project. Two of the five teams favored the CAMS project, and each developed a complete data science pipeline over the course of the 13-week semester.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TDtmXknkuOAJWWGujVTgqg.png" /><figcaption>Team Brilliant. Left-to-right: Amanda Norton, Steven Spielman, Dimitri Angelov. Fourth member Tim McCormack presented virtually.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fmEyZm6A1wUFs5XAjKhTrg.png" /><figcaption>Team Radiant. Left-to-right: Vivienne Prince, Reilly Kalani Stanton, Sara Haman</figcaption></figure><p>Our connection with the CAMS project came through Ms. <a href="https://medium.com/u/43ce294a7ce">Siddha Ganju</a>, a computer scientist and Artificial Intelligence expert who automated the network and process that produces and prepares the dataset related to night-sky observations. She also developed a Machine Learning algorithm to classify night-sky activity as meteor or non-meteor. This was a great starting point for the teams because a) they had benchmark results and findings to compare against, and b) Ms. Ganju provided an invaluable domain expertise and guidance to the teams. There is a wealth of experience offered by Ms. Ganju and the rest of the <a href="https://frontierdevelopmentlab.org/">FDL</a> team that provided the information to make sense of data attributes, the deep learning model that was developed, the actual Python code and the findings obtained. Throughout the semester, we met twice a week in class and our project sponsor, Ms. Ganju was also present in many of these meetings.</p><p><strong>What Did We Find Out?</strong></p><p>The teams started out with a large dataset that included a single row for each time-stamped geo-referenced night-sky observation acquired from one or more cameras (see Table 1 for five rows of data). Interestingly, this came in a different format from one would naturally expect, i.e., a night-sky camera footage or image that shows the illumination in the sky. Instead, it included numeric data extracted through a process that corresponded to coordinates, altitude, brightness, and velocity of the object observed in the sky.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2oL4o25je0XKEa8Br99TA.png" /><figcaption>Table 1. Key features of a night-sky activity: timestamp, height (km), velocity (km/sec), mv_vmag, mv_flux (magnetic flux) and lat/long.</figcaption></figure><p>Both teams had many ideas for developing several machine learning models, and it was quite enjoyable throughout the semester to discuss and guide them towards the final solution. To start off, however, they had to do a lot of data preprocessing and data preparation. The dataset shown in Table 1 had tens of thousands of records, which were not clearly associated with distinct cameras, and had a lot of outlier records, too. In addition, depending on the predictive models to be used, the data had to be formatted into a specific structure. While some team members worked on these tasks, others conducted comprehensive research on possible ML models that can be employed. In the end, the two teams developed several deep learning and machine learning models that included the following variations: BiLSTM, BiLSTM with multiple layers, Parallel LSTM, GRU, CNN, CNN-LSTM, CNN-GRU, Transformer, XGBoost. They used GPU-accelerated frameworks like Tensorflow, PyTorch, Rapids and NVTabular on four NVIDIA Quadro RXT 6000 GPUs with 24GB memory. The motivation of the teams towards developing, training, and testing each of these models was simply amazing! They spent countless hours training, re-training, analyzing, and discussing. The class discussions that led to the findings that we share below were so enjoyable. We had many sessions where the two teams, who normally worked on the same problem but independently, ended up offering ideas to one another, leading to synergistic models that produced much improved results. See, for instance, how one team processed the multi-camera input into meaningful segments (Figure 2-bottom) that can be fed into a parallel BiLSTM network that also has convolutional layers as suggested by the other team (Figure 2-top).</p><p>Two teams working on a dataset and a problem for 13 weeks did pay off! The teams were able to improve the earlier prediction results obtained by SpaceML by a significant margin, thanks to two genuine ideas: a) a parallel LSTM model that is much better suited to the dataset provided, because the data represent multiple cameras and their associated data records, and b) a CNN-LSTM model that proved to be quite effective and also much faster, thanks to the CNN layers’ ability to extract critical features for the LSTM to take advantage of.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r1rMtQYh-cDEm-vOXZOjOA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_QnPRQjRw18Y4FNxWdu1gg.png" /><figcaption>Table2. Accuracy results for the validation set (after 70/30 train-validation split) by Team Radiant (top) and Team Brilliant (bottom)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V9NhzRzBEeqcYZD8ZFnaaA.png" /><figcaption>Figure 1. Validation accuracies and runtimes produced by 3-layer deep learning models (Team Brilliant)</figcaption></figure><p>Great results, no? Now you can make a wish with higher confidence when you see a streak of light in the night sky.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LirFaPIwDPS40zGx6w0Y5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P4WD8PjYMtHk4tTKnC-ScA.png" /><figcaption>Figure 2. Parallel CNN-BiLSTM network models (top) and the pre-processing to match multiple camera data with the network model’s segment-based input (bottom)</figcaption></figure><p><strong>What Did We Learn?</strong></p><p>As the course instructor who oversaw and mentored the entire process, I can see several takeaways on the part of students, myself as well as the overall project itself.</p><ol><li>Domain knowledge is a must! I see this all the time as data science is applied in a variety of settings: space, bioinformatics, retail and e-commerce, finance, etc. One must have a good understanding of the underlying notions and dynamics that lead to the datasets and behaviors that we observe. In the case of CAMS, understanding how the data was generated, why it is in the form that was provided to us, what each data attribute means in relation to the natural phenomenon that was observed, etc. were critical for the success of the models developed.</li><li>The dirtier your hands get, the better results you have. I mean there is no free lunch. If you avoid coding, or if you do not try a different version of the model with a different twist (and many many of those twists), it is hard to get where you would like to get. It is a lot of tedious work of course, but it must be done. No pain no gain.</li><li>There is always room for improvement. It is not only about approaching the problem from a certain (and hopefully the right) angle, but also about soliciting ideas and contributions from all team members and other stakeholders. There is no wrong idea or question; one comment or question that might be seemingly very simple or basic might lead to an interesting breakthrough, and hence the improvements or new solutions one is looking for.</li><li>Teams work efficiently and effectively when members have complementary skills and knowledge. To me, this is another no-brainer, but it is something I observe that is overlooked a lot. Data scientists are not just statisticians or computer scientists, and they come from a variety of backgrounds. One particular background may provide an insight or approach that might prove quite valuable for the task at hand. For instance, a team member with Physics background may provide a better domain knowledge and understanding of the dataset and offer a more suitable approach, such as a mathematical model from the physics domain, in modeling the behavior of the heavenly bodies. Or in a different context, say retailing or e-commerce, a team member with a psychology background may offer a new perspective or explanation on particular consumer behavior. These approaches and perspectives might simply result in the much-needed leap in the project.</li></ol><p><strong>In Conclusion…</strong></p><p>In the end, this was an amazing learning experience for our students on a very exciting topic (space and meteors!), and it led to good results with reusable models that employed creative ideas. For someone like me who is doing this year after year, I can tell that every project offers its unique challenges that we all together (students, company advisors, myself) need to navigate through. Data Science is a fast-developing field after all with learning opportunities for all, even the much-skilled data scientist or programmer, or a professor of data science. What we experienced over the course of 13 weeks in the CAMS project was a collective learning experience, and a certainly working model that involves industry folks looking for talent to address their big data challenges and students looking for real-life experience dealing with data and exciting yet challenging problems.</p><p>Looking forward to launching the next offering of our Practical Data Science course with another project in partnership with SpaceML for Fall 2022, with the help of more industry partners, current and new…</p><p><strong>*Team Radiant</strong>: Sara Haman, Vivienne Prince, Reilly Kalani Stanton and <strong>Team Brilliant</strong>: Dimitri Angelov, Timothy McCormack, Amanda Norton, Steven Spielman</p><p><strong>References</strong></p><ul><li>Github repos by Team Radiant and Team Brilliant: available upon request; please contact the author</li><li>LinkedIn pages: <a href="https://www.linkedin.com/in/sarahaman/">Sara Haman</a>, <a href="https://www.linkedin.com/in/viviprince/">Vivienne Prince</a>, <a href="https://www.linkedin.com/in/reilly-stanton-aa9474125/">Reilly Kalani Stanton</a>, <a href="https://www.linkedin.com/in/dimitri-angelov/">Dimitri Angelov</a>, <a href="https://www.linkedin.com/in/timothy-mccormack-43086b19a/">Timothy McCormack</a>, <a href="https://www.linkedin.com/in/amanda-norton-datasci/">Amanda Norton</a>, <a href="https://www.linkedin.com/in/sfs0126/">Steven Spielman</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9521635f6ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>