<aside> 📅

Date: Thursday, October 1, 2026 · Week 1, Day 4 · Type: Build Day

</aside>

Learning Manual

4.1 What an Embedding Is — mapping text sentences into high-dimensional geometric coordinate points.

4.2 Measuring Similarity — how computers determine if two sentences mean the same thing using Cosine Similarity.

4.3 Vector Normalization — what vector length (L2 norm) means and why normalized vectors make search faster.

The Daily Build

Build a "Semantic Sentence Matcher" that accepts 5 user-provided sentences, calls an embedding model to vectorize them, computes a pairwise similarity matrix, and outputs the two most semantically similar sentences.

Architecture Diagram

+--------------------+     +-------------------+     +---------------------+
| Text Sentence List | --> | Embedding API / ML| --> | High-Dim Vector List|
+--------------------+     +-------------------+     +---------------------+
                                                                |
                                                                v
                                                    [Cosine Similarity Matrix]

Interview Questions

  1. What is the mathematical definition of Cosine Similarity, and how does it differ from Euclidean Distance?
  2. If two sentences have completely different words but identical meanings, why do their embedding vectors point in nearly the same direction?
  3. What does the dimensionality of an embedding model (e.g., 384 vs. 1536 dimensions) represent?

Problem Statement

Problem 04. Implement a pure Python function cosine_similarity(vec_a: list[float], vec_b: list[float]) -> float that calculates the cosine similarity between two numerical lists without using NumPy or math libraries.

AI-DSA Primitive

Algorithm: Dot Product & Vector Magnitude (L2 Norm).

Mechanics: Multiplying matching elements and dividing by the product of vector lengths: CosineSim(A,B) = (Σ AᵢBᵢ) / (√ΣAᵢ² · √ΣBᵢ²).

Real-World Production Use: The foundational mathematical calculation executed billions of times daily inside all vector databases (Pinecone, Qdrant, Milvus).

Software Design Pattern