Embedding Models and Similarity Matching in AI Search Engines

Embedding models and similarity matching represent fundamental technologies that enable modern AI search engines to understand and retrieve information based on semantic meaning rather than keyword matching alone 14. These techniques transform unstructured data—such as text, images, and audio—into numerical vector representations that computers can process and compare mathematically 5. The primary purpose of embedding models is to capture the conceptual relationships and contextual meaning within data, allowing search systems to identify relevant results that align with user intent rather than surface-level keyword overlap 1. This capability has become essential in contemporary information retrieval systems, powering applications ranging from e-commerce product discovery to customer support chatbots and recommendation engines 4.

Overview

The emergence of embedding models and similarity matching addresses a fundamental limitation of traditional search engines: the inability to understand semantic meaning beyond literal keyword matches 4. Conventional search systems rely on lexical matching, where documents are retrieved based on the presence of query terms. This approach fails when relevant documents use different terminology or when users express queries in ways that don’t match indexed content. For instance, a search for “laptop computers” might miss documents about “portable computing devices,” despite their semantic equivalence 4.

The evolution of these technologies began with early word embedding models and has progressed to sophisticated transformer-based architectures capable of encoding entire documents and images into semantically meaningful vector spaces 1. Modern embedding models leverage neural networks trained on vast corpora to learn statistical relationships between concepts, enabling computers to understand that “man bites dog” and “dog bites man” convey fundamentally different meanings despite sharing identical words 4. This statistical approach quantifies semantic similarity mathematically, positioning related concepts like “queen” and “king” near terms such as “chief” or “president” in high-dimensional vector space 4.

As data volumes have grown and user expectations for search relevance have increased, embedding-based semantic search has evolved from research curiosity to production necessity 1. Vector databases and approximate nearest neighbor algorithms now enable real-time similarity searches across millions or billions of items, making semantic search practical for large-scale applications 15.

Key Concepts

Vector Embeddings

Vector embeddings are numerical representations—sequences of numbers—that encode the semantic meaning of data items such as words, sentences, documents, or images 3. These embeddings are generated by machine learning models, typically neural networks, that convert categorical or unstructured data into continuous vector spaces where similar concepts are positioned close together 6.

Example: A sentence embedding model processes the phrase “The cat sat on the mat” and produces a 768-dimensional vector like [0.23, -0.45, 0.67, ..., 0.12]. When the model processes “A feline rested on the rug,” it generates a different vector, but the two vectors are positioned close together in the 768-dimensional space because the sentences convey similar meaning. This proximity enables the search system to recognize their semantic similarity despite different word choices.

Cosine Similarity

Cosine similarity is a mathematical metric that measures how closely aligned two vectors are by calculating the cosine of the angle between them 1. Values range from -1 (opposite directions) to 1 (identical directions), with higher values indicating greater similarity 3. This metric is particularly effective for high-dimensional embeddings because it focuses on directional alignment rather than absolute distance.

Example: An e-commerce search system embeds the query “running shoes for marathons” into a vector. The system then calculates cosine similarity between this query vector and all product description vectors in its database. A product described as “lightweight athletic footwear for long-distance racing” might have a cosine similarity of 0.89 with the query, while “casual leather loafers” might score only 0.12, enabling the system to rank the athletic shoes much higher in search results.

K-Nearest Neighbors (KNN)

K-nearest neighbors is an algorithm that identifies the k data points closest to a query vector in the embedding space 3. The algorithm examines distances between the query vector and all indexed vectors, returning the k items with the smallest distances 5. This approach forms the foundation of similarity search in vector databases.

Example: A customer support chatbot receives the question “How do I reset my password?” The system converts this query into a vector and uses KNN with k=5 to find the five most similar questions in its knowledge base. The algorithm might return vectors corresponding to “Password reset instructions,” “Forgot my login credentials,” “Cannot access my account,” “Change password procedure,” and “Account recovery steps,” all of which are semantically related to the original query.

Approximate Nearest Neighbors (ANN)

Approximate nearest neighbors algorithms find good-enough matches without exhaustively checking all possibilities, trading perfect accuracy for dramatically improved speed 5. These algorithms use indexing structures that organize vectors into clusters or hierarchies, enabling rapid identification of candidate matches without comparing the query to every stored vector 1.

Example: A video streaming platform with 50 million indexed movie descriptions uses an ANN algorithm called HNSW (Hierarchical Navigable Small World) to organize its embedding vectors. When a user searches for “psychological thrillers with unreliable narrators,” the ANN algorithm navigates through the hierarchical index structure, examining only about 10,000 vectors instead of all 50 million. It returns results in 50 milliseconds with 95% recall (finding 95% of the true top matches), whereas exact KNN would require 5 seconds.

Vector Databases

Vector databases are specialized systems designed for storing, indexing, and searching large numbers of high-dimensional vectors 3. Unlike traditional databases optimized for structured data and exact matches, vector databases implement indexing structures specifically designed for similarity search, such as inverted file indexes, product quantization, and graph-based approaches 1.

Example: A medical research institution uses the Milvus vector database to store embeddings of 10 million scientific abstracts. Each abstract is represented as a 1024-dimensional vector. The database uses an IVF_FLAT index that partitions the vector space into 4,096 clusters. When researchers query for papers related to “CRISPR gene editing applications in cancer treatment,” the system first identifies the most relevant clusters (perhaps 50 of the 4,096), then searches only within those clusters, reducing the search space by 98% while maintaining high accuracy.

Reranking Models

Reranking models refine initial search results by applying more sophisticated similarity calculations to a smaller set of candidate documents 8. This two-stage approach uses a fast, lightweight model for initial retrieval, then applies a larger, more accurate model to reorder the top candidates 8. Reranking models often consider both query and document text together, enabling more nuanced relevance judgments.

Example: A legal document search system first uses a small embedding model (100MB) to retrieve the top 100 potentially relevant case law documents from a database of 5 million cases in 200 milliseconds. It then applies a large reranking model (2GB) that processes each of the 100 candidates alongside the original query, considering cross-attention between query terms and document passages. This reranking stage takes an additional 800 milliseconds but significantly improves precision by filtering out the 40 documents that matched superficially but lack substantive relevance, reordering the remaining 60 by true legal relevance.

Multimodal Embeddings

Multimodal embeddings represent different data types—text, images, audio—in a shared vector space, enabling cross-modal search and comparison 2. Models like CLIP (Contrastive Language-Image Pre-training) are trained to position semantically related items close together regardless of their original format 2.

Example: An online furniture retailer implements CLIP embeddings for its product catalog. A customer uploads a photo of a mid-century modern chair they saw in a magazine and searches using the image. The CLIP model converts the uploaded image into a 512-dimensional vector. The system compares this vector against both product image embeddings and text description embeddings in the same vector space. It successfully retrieves visually similar chairs from the catalog, but also finds products described as “Danish modern teak armchair” and “1960s Scandinavian design seating” because the text descriptions are embedded near the visual features of mid-century furniture in the shared semantic space.

Applications in Information Retrieval

E-Commerce Product Discovery

Embedding models transform e-commerce search by enabling semantic product discovery that transcends keyword matching 1. Product descriptions, specifications, and user queries are embedded into the same vector space, allowing the system to retrieve semantically similar products even when descriptions use different terminology. This capability is particularly valuable for fashion and home goods, where customers often search using subjective or descriptive terms rather than product names.

A fashion retailer implements sentence transformers to embed both product descriptions and customer queries. When a customer searches for “flowy summer dress for beach vacation,” the system retrieves products described as “lightweight maxi dress,” “breezy resort wear,” and “casual sundress” because these descriptions are semantically similar in the embedding space, even though they share few keywords with the original query. The system also uses image embeddings to find visually similar items, enabling customers to search by uploading photos of styles they like.

Code Search and Software Development

Embedding models enable developers to find similar code patterns across large codebases, facilitating code reuse, refactoring, and bug detection 8. By embedding code snippets based on their semantic functionality rather than syntactic structure, these systems help developers locate relevant examples even when implementation details differ.

A software company with a 15-million-line codebase implements code embeddings using a model fine-tuned on programming languages. When a developer searches for “function to validate email addresses with regex,” the system retrieves relevant functions even if they’re named checkEmailFormat(), isValidEmail(), or validateUserInput(). The embedding model understands the semantic purpose of the code—email validation—rather than matching keywords. This capability accelerates development by helping engineers discover existing implementations before writing duplicate code, and assists in automated refactoring by identifying functionally similar code blocks that could be consolidated.

Customer Support and Knowledge Retrieval

Embedding-based search powers intelligent chatbots and support systems that understand customer queries and retrieve relevant knowledge base articles 4. By encoding both customer questions and support documentation into the same semantic space, these systems match queries to solutions based on conceptual similarity rather than keyword overlap.

A telecommunications company deploys an embedding-based support chatbot that handles 100,000 customer inquiries daily. When a customer asks “My internet keeps dropping every few minutes,” the system embeds this query and searches against 50,000 knowledge base articles. It retrieves articles titled “Troubleshooting Intermittent Connection Issues,” “Resolving Wi-Fi Stability Problems,” and “Modem Reset Procedures” because these articles are semantically related to connectivity problems, even though they don’t contain the exact phrase “internet keeps dropping.” The system uses a multi-query retriever that generates variations like “unstable internet connection” and “frequent disconnections” to improve recall, ensuring comprehensive coverage of potentially relevant solutions.

Medical Literature Search

Healthcare researchers use embedding models to search vast medical literature databases, finding relevant studies based on conceptual similarity 7. Domain-specific fine-tuning on medical texts enables these systems to understand specialized terminology and relationships between diseases, treatments, and outcomes.

A pharmaceutical research team uses a PubMed-fine-tuned embedding model to search 30 million biomedical abstracts. When searching for “immunotherapy approaches for triple-negative breast cancer,” the system retrieves papers discussing “checkpoint inhibitors in TNBC,” “PD-L1 targeting in basal-like breast tumors,” and “immune-oncology strategies for hormone-receptor-negative disease.” The model understands that “triple-negative” and “hormone-receptor-negative” refer to the same breast cancer subtype, and that “checkpoint inhibitors” and “PD-L1 targeting” are specific immunotherapy approaches. This semantic understanding dramatically improves research efficiency compared to keyword-based PubMed searches.

Best Practices

Maintain Embedding Model Consistency

The same embedding model must be used for both indexing documents and encoding queries to ensure vectors exist in the same semantic space 7. Mismatches between indexing and query models produce vectors in different semantic spaces, causing semantically similar items to appear distant and degrading search accuracy.

Rationale: Embedding models learn to position concepts in vector space based on their training data and architecture. Different models create fundamentally different geometric arrangements of concepts. A query embedded with Model A cannot be meaningfully compared to documents embedded with Model B because they inhabit incompatible vector spaces.

Implementation Example: A content management system establishes a strict versioning policy for its embedding model. When indexing 500,000 documents, the system records that it used sentence-transformers/all-MiniLM-L6-v2 version 2.2.0. All query encoding uses exactly the same model version. When the team decides to upgrade to a newer model for better performance, they re-embed the entire document corpus rather than mixing embeddings from different models. They implement a blue-green deployment strategy, maintaining the old index while building a new one, then switching traffic only after complete re-indexing.

Normalize Vector Lengths

Vector normalization—scaling vectors to unit length—improves similarity search accuracy and performance 7. Most pre-trained models produce normalized vectors, but verification is essential, and normalization should be applied if vectors aren’t already unit length.

Rationale: When vectors are normalized, cosine similarity becomes equivalent to dot product similarity, which is computationally faster. Normalization also ensures that similarity scores reflect directional alignment rather than magnitude differences, producing more consistent relevance rankings.

Implementation Example: A news aggregation platform implements a validation pipeline that checks vector norms after embedding generation. For each batch of 10,000 article embeddings, the system calculates the L2 norm (length) of each vector. If any vector has a norm significantly different from 1.0 (outside the range 0.99-1.01), the system logs a warning and applies normalization by dividing each vector component by the vector’s length. This verification catches potential issues with model updates or data preprocessing errors that might produce unnormalized vectors.

Implement Two-Stage Retrieval with Reranking

Use a fast, lightweight embedding model for initial retrieval, then apply a larger, more accurate model to rerank the top candidates 8. This approach balances speed and accuracy by processing all documents quickly in the first stage, then applying expensive computation only to promising candidates.

Rationale: Large embedding models produce higher-quality representations but require significantly longer inference time 8. Processing millions of documents with a large model is impractical for real-time search. Two-stage retrieval achieves near-optimal accuracy while maintaining acceptable latency by limiting expensive processing to a small candidate set.

Implementation Example: A job search platform implements two-stage retrieval for matching candidate resumes to job descriptions. The first stage uses a 100MB embedding model that processes the query and retrieves the top 200 candidates from 5 million resumes in 150 milliseconds using approximate nearest neighbors. The second stage applies a 1.5GB cross-encoder model that processes each of the 200 candidates alongside the job description, computing a refined relevance score. This reranking takes an additional 600 milliseconds but improves precision@10 (relevance of the top 10 results) by 35% compared to using only the lightweight model. Total latency of 750 milliseconds remains acceptable for user experience.

Fine-Tune Models for Domain Specificity

Pre-trained embedding models trained on general text corpora may not capture domain-specific semantic relationships 7. Fine-tuning models on domain-specific data—such as medical literature, legal documents, or technical documentation—improves relevance for specialized applications.

Rationale: General-purpose embedding models learn semantic relationships from broad training data like Wikipedia and web text. They may not understand specialized terminology, acronyms, or conceptual relationships specific to particular domains. Fine-tuning adapts the model’s vector space to reflect domain-specific semantics.

Implementation Example: A legal technology company starts with the general-purpose sentence-transformers/all-mpnet-base-v2 model but finds it performs poorly on legal queries because it doesn’t understand relationships between legal concepts. They create a fine-tuning dataset of 50,000 pairs of related legal documents (e.g., cases citing similar precedents, statutes and their interpretations). Using contrastive learning, they fine-tune the model for 3 epochs, teaching it that “habeas corpus” and “writ of habeas corpus” are nearly identical, that “plaintiff” and “petitioner” are contextually similar, and that cases involving “qualified immunity” are semantically related to “Section 1983 claims.” After fine-tuning, the model’s performance on legal search tasks improves by 40% as measured by normalized discounted cumulative gain (NDCG).

Implementation Considerations

Model Selection and Performance Trade-offs

Selecting an appropriate embedding model requires balancing quality, speed, and resource requirements 8. Larger models (measured in gigabytes) produce higher-quality embeddings but require significantly longer inference time and more computational resources. Practitioners must evaluate models based on their specific latency requirements, accuracy needs, and infrastructure constraints.

Example: A mobile application implementing on-device semantic search must use a small model (under 50MB) that can run efficiently on smartphones with limited memory and processing power. The team selects all-MiniLM-L6-v2, which produces 384-dimensional embeddings and requires only 80 milliseconds per query on typical mobile hardware. While this model’s accuracy is lower than larger alternatives, the trade-off is necessary for acceptable user experience. In contrast, a cloud-based enterprise search system with powerful GPU infrastructure selects all-mpnet-base-v2, which produces 768-dimensional embeddings with 15% better accuracy but requires 300 milliseconds per query on CPU.

Vector Database Selection and Configuration

Choosing and configuring a vector database involves evaluating indexing algorithms, scalability characteristics, and integration requirements 1. Different vector databases offer various indexing approaches—such as HNSW (Hierarchical Navigable Small World), IVF (Inverted File), and LSH (Locality-Sensitive Hashing)—each with distinct performance characteristics 5.

Example: A startup building a semantic search feature for 1 million documents evaluates three vector database options. They test Milvus with an HNSW index, which provides excellent query performance (20ms average latency) but requires significant memory (8GB for the index). They also test FAISS with an IVF index, which uses less memory (2GB) but has slightly slower queries (35ms). Finally, they test Pinecone, a managed service that handles infrastructure but costs $70/month for their scale. They select FAISS with IVF because their infrastructure budget is limited, and 35ms latency meets their requirements. They configure the IVF index with 256 clusters and probe 32 clusters per query, achieving 92% recall while keeping memory usage manageable.

Monitoring and Quality Assurance

Continuous monitoring of embedding model performance is essential for maintaining search quality 7. Organizations should establish baseline metrics, implement automated testing, and monitor for performance degradation over time.

Example: An e-commerce company implements a comprehensive monitoring system for their semantic search. They maintain a test set of 1,000 queries with human-labeled relevant products. Every week, they run these queries through their production system and calculate metrics including recall@10 (percentage of relevant products in top 10 results), mean reciprocal rank (average position of first relevant result), and query latency. They set alerts that trigger if recall drops below 85% or latency exceeds 200ms. When they detect a 5% recall drop after a model update, they quickly roll back to the previous version and investigate the issue, discovering that the new model wasn’t properly normalized.

Handling Multilingual Requirements

Applications serving international users must address multilingual semantic search 1. This requires selecting embedding models trained on multiple languages or implementing language-specific models with cross-lingual alignment.

Example: A global customer support platform serves users in English, Spanish, French, German, and Japanese. They implement paraphrase-multilingual-mpnet-base-v2, a model trained on 50+ languages that embeds semantically similar phrases into nearby vectors regardless of language. When a Spanish-speaking customer asks “¿Cómo restablezco mi contraseña?” (How do I reset my password?), the system retrieves relevant knowledge base articles written in Spanish, but also surfaces English articles about password reset if Spanish-language coverage is incomplete. The multilingual embedding space enables cross-lingual search, improving support quality for non-English users.

Common Challenges and Solutions

Challenge: Cold Start Problem with Limited Training Data

Organizations implementing embedding-based search often lack sufficient domain-specific training data to fine-tune models effectively 7. Pre-trained general-purpose models may not understand specialized terminology or domain-specific semantic relationships, but creating large labeled datasets for fine-tuning is expensive and time-consuming.

Solution:

Implement a hybrid approach combining pre-trained models with synthetic data generation and active learning 8. Start with a general-purpose embedding model and augment it with a small amount of domain-specific data. Use generative models to create synthetic training examples, and implement active learning to identify the most valuable examples for human labeling.

Example: A legal tech startup has only 500 labeled pairs of related legal documents—insufficient for effective fine-tuning. They implement a multi-pronged approach: (1) They use GPT-4 to generate 5,000 synthetic pairs by paraphrasing legal concepts and creating variations of legal queries. (2) They implement active learning that identifies document pairs where the embedding model is most uncertain, prioritizing these for human review. (3) They use hard negative mining, identifying documents that are lexically similar but semantically different (e.g., cases with similar facts but opposite outcomes), which helps the model learn subtle distinctions. After three months, they’ve accumulated 3,000 high-quality labeled pairs and achieved a 25% improvement in search relevance.

Challenge: Computational Cost and Latency at Scale

As document collections grow to millions or billions of items, maintaining acceptable query latency becomes challenging 5. Exact nearest neighbor search becomes computationally prohibitive, and even approximate algorithms struggle with very large scales. Infrastructure costs for storing and searching high-dimensional vectors can become substantial.

Solution:

Implement a multi-tiered architecture combining approximate nearest neighbors, dimensionality reduction, and caching strategies 15. Use ANN algorithms with carefully tuned parameters to balance recall and latency. Consider dimensionality reduction techniques like product quantization to reduce memory footprint. Implement caching for common queries and pre-computation for predictable search patterns.

Example: A video streaming platform with 100 million content items faces query latencies exceeding 2 seconds. They implement a comprehensive optimization strategy: (1) They switch from exact KNN to HNSW approximate nearest neighbors, reducing latency to 400ms with 94% recall. (2) They apply product quantization to compress 768-dimensional vectors to 96 bytes each, reducing memory requirements by 75% and improving cache efficiency. (3) They implement a two-level cache: an in-memory cache for the 10,000 most common queries (serving 40% of traffic with 5ms latency) and a distributed cache for the top 1 million queries (serving another 30% of traffic with 50ms latency). (4) For trending content, they pre-compute similar items during off-peak hours. These optimizations reduce average latency to 120ms while cutting infrastructure costs by 60%.

Challenge: Handling Out-of-Domain Queries

Embedding models trained on specific domains often perform poorly on queries outside their training distribution 4. When users submit queries using unexpected terminology or asking about topics the model hasn’t encountered, the system may return irrelevant results or fail to recognize that it lacks relevant information.

Solution:

Implement confidence scoring, fallback mechanisms, and hybrid search combining embeddings with traditional keyword search 1. Use ensemble methods that combine multiple retrieval approaches. Implement query classification to detect out-of-domain queries and route them appropriately.

Example: A medical literature search system trained on clinical research papers struggles when users submit queries about healthcare policy or medical device engineering—topics outside its training domain. The team implements a multi-layered solution: (1) They add a query classifier that detects whether queries are clinical, policy-related, or technical/engineering-focused. (2) For out-of-domain queries, they fall back to BM25 keyword search, which is more robust to domain shifts. (3) They implement an ensemble retriever that combines embedding-based search (70% weight) with BM25 (30% weight), providing better coverage across diverse query types. (4) They add confidence scoring based on the similarity score of the top result—if the best match has a similarity below 0.6, the system displays a message: “Limited results found. Try rephrasing your query or using more specific medical terms.” This hybrid approach improves user satisfaction by 30% and reduces failed searches by 45%.

Challenge: Maintaining Search Quality Through Model Updates

Updating embedding models to improve performance risks disrupting existing search quality 7. New models may organize the vector space differently, causing previously relevant results to become less relevant. Re-embedding large document collections is time-consuming and resource-intensive, but mixing embeddings from different models degrades accuracy.

Solution:

Implement versioned indices with A/B testing and gradual rollout strategies 7. Maintain parallel indices during transitions, conduct thorough testing with representative queries, and monitor quality metrics closely during rollout. Establish clear rollback procedures if quality degrades.

Example: An enterprise search company with 50 million indexed documents wants to upgrade from an older embedding model to a newer version that promises 20% better accuracy. They implement a careful migration strategy: (1) They create a new index and begin re-embedding documents in parallel with the production system, processing 500,000 documents daily to avoid overwhelming infrastructure. (2) After two weeks, when 7 million documents are re-embedded, they begin A/B testing, routing 5% of traffic to the new index. (3) They monitor key metrics: recall@10, click-through rate, and user satisfaction scores. (4) They gradually increase traffic to the new index: 10%, 25%, 50%, 75%, monitoring at each stage. (5) After six weeks, when all documents are re-embedded and metrics show consistent improvement, they complete the migration and decommission the old index. This gradual approach allows them to detect and address issues early, and they discover that the new model performs poorly on technical documentation, prompting them to apply domain-specific fine-tuning before full rollout.

Challenge: Bias and Fairness in Semantic Search

Embedding models can encode and amplify biases present in their training data, leading to unfair or discriminatory search results 4. For example, models might associate certain professions with specific genders or ethnicities, causing biased retrieval in hiring or lending applications.

Solution:

Implement bias detection and mitigation strategies including diverse training data, fairness-aware fine-tuning, and post-processing filters 4. Conduct regular bias audits using standardized test sets. Establish clear fairness metrics and monitoring systems.

Example: A job search platform discovers that their embedding model associates “software engineer” more strongly with male names than female names, causing resumes from women to rank lower for technical positions. They implement a comprehensive bias mitigation strategy: (1) They create a bias test set with 1,000 resume pairs that differ only in gender-indicating information (names, pronouns) and measure ranking differences. (2) They apply fairness-aware fine-tuning using a technique called “counterfactual data augmentation,” creating training examples where gender information is systematically varied while keeping qualifications constant. (3) They implement a post-processing filter that detects when protected attributes (gender, ethnicity) correlate with ranking and applies calibration to equalize opportunity. (4) They establish ongoing monitoring, running bias audits monthly and setting alerts if gender-based ranking differences exceed 2%. After implementing these measures, they reduce gender-based ranking bias by 75% while maintaining overall search quality.

See Also

References

  1. Milvus. (2024). How Are Embeddings Applied in Search Engines. https://milvus.io/ai-quick-reference/how-are-embeddings-applied-in-search-engines
  2. Elastic. (2024). 5 Technical Components of Image Similarity Search. https://www.elastic.co/blog/5-technical-components-image-similarity-search
  3. Oracle. (2025). AI Vector Search: Similarity Search. https://www.oracle.com/database/ai-vector-search/similarity-search/
  4. TechTarget. (2024). Embedding Models for Semantic Search: A Guide. https://www.techtarget.com/searchenterpriseai/tip/Embedding-models-for-semantic-search-A-guide
  5. Hopsworks. (2024). Similarity Search. https://www.hopsworks.ai/dictionary/similarity-search
  6. Dev.to. (2024). Understanding Embedding Models and How to Use Them in Search. https://dev.to/josmel/understanding-embedding-models-and-how-to-use-them-in-search-4ab9
  7. Microsoft. (2024). Vector Search: How to Generate Embeddings. https://learn.microsoft.com/en-us/azure/search/vector-search-how-to-generate-embeddings
  8. Moderne. (2024). Building Search with AI Embeddings to Assist Automated Code Refactoring. https://www.moderne.ai/blog/building-search-with-ai-embeddings-to-assist-automated-code-refactoring