## 3 Methodology
### Retrieval-Augmented Generation
#### 3.2.2 Vector Search  
Vector search is a technique used to find items that are the most similar to a given query by comparing their vector representations in a high-dimensional space. Unlike traditional keyword-based search, which relies on exact or partial word matches, vector search uses numerical embeddings that capture the semantic meaning of text, images, or other data types. This enables more flexible and accurate retrieval, particularly in instances where relevant content may not share the same vocabulary as the query. By measuring the distance or similarity between vectors using metrics like cosine similarity or Euclidean distance vector search enables systems to return results that are conceptually related, even if they differ in wording or structure. In the application of this work, we utilized vector search to find the matching vectors based on the user's query. The query that was converted to a vector itself was processed to find similar vectors from the list of vector embeddings. The Approximate Nearest Neighbor (ANN) search is a method for efficiently finding points in high-dimensional space that are close to a query point without guaranteeing exact matches. It is beneficial for large datasets where an exact search is too slow or costly. By allowing for slight inaccuracies, ANN significantly speeds up the search, making it practical for applications such as recommendation systems, image recognition, and Natural Language Processing. Common ANN algorithms include methods like Locality-Sensitive Hashing (LSH), Product Quantization (PQ), Hierarchical Navigable Small World (HNSW) graphs, and tree-based approaches such as KD-Trees and Ball Trees. These techniques reduce search time and memory usage by organizing data in a way that allows for the quick approximation of nearest neighbors. ANN typically begins with dimensionality reduction to simplify  
Figure 4: An example of words in a vector space. computations, and it operates within metric spaces using distance measures, such as Euclidean or cosine similarity, to evaluate the closeness of data points to one another. BM25 (Best Matching 25) is a widely used ranking function in information retrieval that estimates the relevance of documents to a given query. It is based on the probabilistic retrieval framework and incorporates key factors, including term frequency, inverse document frequency, and document length normalization. The BM25 scoring function rewards documents that contain frequent and rare query terms while penalizing excessively long documents to prevent length bias. The relevance score of a document \(D\) concerning a query \(Q\) is given by  
\[\text{Score}(D,Q)=\sum_{i=1}^{n}IDF(q_{i})\cdot\frac{f(q_{i},D)\cdot(k_{1}+1)}{ f(q_{i},D)+k_{1}\cdot\left(1-b+b\cdot\frac{|D|}{\text{avgdl}}\right)} \tag{1}\]  
Here, \(f(q_{i},D)\) is the frequency of term \(q_{i}\) in document \(D\), \(|D|\) is the length of the document, and avgdl is the average document length in the corpus. The parameters \(k_{1}\) and \(b\) are typically set to values such as 1.2 and 0.75, respectively. \(IDF(q_{i})\) represents the inverse document frequency of term \(q_{i}\), which gives more weight to informative terms. In this work, we employed an ANN alongside BM25 to perform a technique called Hybrid Vector Search. While the method's performance greatly depends on the tuning of the functions, it tends to perform better with large datasets, such as parts. On the ANN aspect, the cosine similarity search was utilized. Cosine similarity measures the similarity between two vectors by calculating the cosine of the angle between them. Unlike other metrics, it is independent of vector magnitude, focusing solely on the orientation of vectors within the vector space.