Module 1.2
Embed every sentence once. Rank them by cosine similarity to a query. That's it — that's nearest-neighbor search. Compute it below on the full Nimbus corpus.
The math
"Search" is nothing more than this: score every candidate the same way, then take the one with the highest score.
The code
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("all-MiniLM-L6-v2")
corpus = [
"Nimbus exports fail if the workspace quota is exceeded.",
"API keys rotate every 90 days...",
# ...4 more sentences, same corpus every module
]
corpus_vecs = model.encode(corpus) # shape (6, 384) — real models use hundreds of dims
query_vec = model.encode(query) # shape (384,)
import numpy as np
dots = corpus_vecs @ query_vec # one dot product per row, all at once
norms = np.linalg.norm(corpus_vecs, axis=1) * np.linalg.norm(query_vec)
scores = dots / norms # cosine similarity, all 6 candidates
best = np.argmax(scores)
print(corpus[best], scores[best]) # the quota-exceeded sentence, ≈ 0.99
corpus_vecs @ query_vec is a matrix times a vector — six dot products computed in one shot. Module 1.3 is about exactly this operation.
The Nimbus thread
Everything a vector database does on top of this is about doing it fast at scale — an approximate index (HNSW, IVF) so it doesn't have to score millions of documents one by one. The ranking math itself, argmax over cosine similarity, never changes. Module 5 builds that index; the six-sentence version above is the entire idea already.
So what
A "smart search" is embed once, then rank by angle — there's no separate understanding step hiding underneath.