How to Learn Any New AI / The Method
Building the smallest thing that proves it works.
Reviewed by Yuvaraj
You can read every page of a new model's documentation and still not understand it. Reading produces recognition, not knowledge, it lets you nod along while every real assumption stays hidden. The most reliable way to genuinely understand a new AI technology is older and humbler than any tutorial: build the smallest thing that actually runs.
Prose smooths over exactly the details that break in practice. A minimal working example does the opposite, it drags every hidden assumption into the open. To make even ten lines execute, you are forced to discover the precise dependency versions, the shape your input data must take, where the API key is read from, what the response object actually contains, and which defaults the library quietly chose for you. None of that survives in your head after reading. All of it becomes unavoidable the moment code has to run.
A minimal reproduction, often called a spike, isolates one concept and strips away everything else. The discipline is subtraction: anything not under study gets hard-coded, faked, or deleted. You are not building a product; you are buying one specific piece of knowledge as cheaply as possible.
Ask about this lesson, or about anything in AI. Answers cite the lessons they draw on.
Finished this lesson?
Mark it complete to earn XP, keep your streak, and schedule a review.
Suppose you want to understand an embeddings API you have never touched. Do not wire it into a vector database or a retrieval pipeline. Write roughly ten lines:
# pinned for reproducibility: openai==1.51.0, numpy==2.1.1
from openai import OpenAI
import numpy as np
client = OpenAI() # reads OPENAI_API_KEY from the environment
MODEL = "text-embedding-3-small"
def embed(text):
resp = client.embeddings.create(model=MODEL, input=text)
return np.array(resp.data[0].embedding)
def cosine(a, b):
return a @ b / (np.linalg.norm(a) * np.linalg.norm(b))
a = embed("The cat sat on the mat.")
b = embed("A feline rested on the rug.") # similar meaning
c = embed("Quarterly revenue exceeded forecasts.") # unrelated
print("dim:", len(a)) # -> learn the dimensionality
print("similar:", cosine(a, b)) # should be high
print("dissimilar:", cosine(a, c)) # should be lower
assert cosine(a, b) > cosine(a, c) # confirm the mental model
That tiny script teaches three things reading never could. len(a) reveals the dimensionality, the number that drives your storage cost and index configuration. Writing the call teaches the exact request and response shape: the input argument, the .data[0].embedding path. And the final assert confirms your mental model is correct, under cosine similarity, , semantically similar text really does score higher, so the numbers mean what you think they mean.
One knob per experiment
Changing one variable at a time is what turns a script into an experiment. Swap the model, the input text, and the library version together, watch the similarity score move, and you have learned nothing, you cannot attribute the change to any single cause. Move one knob, observe, record, reset. Slow is fast.
If your ten lines refuse to run, you have not wasted your time, you have localized the problem to a space small enough to understand. A repro that fails cleanly is also the ideal bug report: a maintainer can paste it, run it, and see exactly what you see, because you have already removed everything irrelevant. Pin your versions with pip freeze so the failure is reproducible tomorrow and on someone else's machine. An unpinned repro is a story, not evidence.
Common mistakes