It’s not just the health insurance tho. The older you get the more you realize how most of the trad economy is primarily a grift these days.
5633 bookmarks · page 193 of 226
It’s not just the health insurance tho. The older you get the more you realize how most of the trad economy is primarily a grift these days.
Vector Database by Hand ✍️
Vector databases are revolutionizing how we search and analyze complex data. They have become the backbone of Retrieval Augmented Generation (#RAG).
How do vector databases work?
[1] Given
↳ A dataset of three sentences, each has 3 words (or tokens)
↳ In practice, a dataset may contain millions or billions of sentences. The max number of tokens may be tens of thousands (e.g., 32,768 mistral-7b).
Process "how are you"
[2] 🟨 Word Embeddings
↳ For each word, look up corresponding word embedding vector from a table of 22 vectors, where 22 is the vocabulary size.
↳ In practice, the vocabulary size can be tens of thousands. The word embedding dimensions are in the thousands (e.g., 1024, 4096)
[3] 🟩 Encoding
↳ Feed the sequence of word embeddings to an encoder to obtain a sequence of feature vectors, one per word.
↳ Here, the encoder is a simple one layer perceptron (linear layer + ReLU)
↳ In practice, the encoder is a transformer or one of its many variants.
[4] 🟩 Mean Pooling
↳ Merge the sequence of feature vectors into a single vector using "mean pooling" which is to average across the columns.
↳ The result is a single vector. We often call it "text embeddings" or "sentence embeddings."
↳ Other pooling techniques are possible, such as CLS. But mean pooling is the most common.
[5] 🟦 Indexing
↳ Reduce the dimensions of the text embedding vector by a projection matrix. The reduction rate is 50% (4->2).
↳ In practice, the values in this projection matrix is much more random.
↳ The purpose is similar to that of hashing, which is to obtain a short representation to allow faster comparison and retrieval.
↳ The resulting dimension-reduced index vector is saved in the vector storage.
[6] Process "who are you"
↳ Repeat [2]-[5]
[7] Process "who am I"
↳ Repeat [2]-[5]
Now we have indexed our dataset in the vector database.
[8] 🟥 Query: "am I you"
↳ Repeat [2]-[5]
↳ The result is a 2-d query vector.
[9] 🟥 Dot Products
↳ Take dot product between the query vector and database vectors. They are all 2-d.
↳ The purpose is to use dot product to estimate similarity.
↳ By transposing the query vector, this step becomes a matrix multiplication.
[10] 🟥 Nearest Neighbor
↳ Find the largest dot product by linear scan.
↳ The sentence with the highest dot product is "who am I"
↳ In practice, because scanning billions of vectors is slow, we use an Approximate Nearest Neighbor (ANN) algorithm like the Hierarchical Navigable Small Worlds (HNSW).
"When ChatGPT was released in November 2023, it could only be accessed through the cloud because the model behind it was downright enormous.
Today I am running a similarly capable AI program on a Macbook Air, and it isn’t even warm."
60s scientists: we sent humans to the moon!
90s scientists: we cloned a sheep! We landed a robot on Mars!
Scientists today: for the last time, Earth is not flat and nuclear power is safe!
You can think of this book in two ways. One is as a book about mathematics and physics. The other is as a book of magic spells which unlock the secrets of the universe.
Both these ways of thinking are equally valid.
Generations are a pretty garbage concept.
Google Ad from 1998.
4. Activation - AI by Hand✍️Workbook Series
I share original hand calculation exercises like this, with 36K followers on LinkedIn. I just started sharing on X.
If you find this workbook helpful,
[Follow] me for more!
Previously unseen details of human brain structure revealed. Featured image: a single neuron with ~5,600 of the nerve fibers that connect to it.
I feel overwhelming awe at nature's complexity and order.
If you're familiar with scaling laws @hendrycks, this clause looks like either negligence or regulatory capture.
compute != performance
The definition of "covered model" in Sec. 3f2 regulates ALL models subsequent to a single bad training run at >1e26 FLOPs.
Transformer by Hand✍️
To study the transformer architecture, it is like opening up the hood of a car and seeing all sorts of engine parts: embeddings, positional encoding, feed-forward network, attention weighting, self-attention, cross-attention, multi-head attention, layer norm, skip connections, softmax, linear, Nx, shifted right, query, key, value, masking. This list of jargons feels overwhelming!
What are the key parts that really make the transformer (🚗) run?
In my opinion, the 🔑 key is the combination of: [attention weighting] and [feed-forward network].
All the other parts are enhancements to make the transformer (🚗) run faster and longer, which is still important because those enhancements are what lead us to "large" language models. 🚗 -> 🚚
Walkthrough
[1] Given
↳ Input features from the previous block (5 positions)
[2] Attention
↳ Feed all 5 features to a query-key attention module (QK) to obtain an attention weight matrix (A). I will skip the details of this module. In a follow-up post I will unpack this module.
[3] Attention Weighting
↳ Multiply the input features with the attention weight matrix to obtain attention weighted features (Z). Note that there are still 5 positions.
↳ The effect is to combine features across positions (horizontally), in this case, X1 := X1 + X2, X2 := X2 + X3....etc.
[4] FFN: First Layer
↳ Feed all 5 attention weighted features into the first layer.
↳ Multiply these features with the weights and biases.
↳ The effect is to combine features across feature dimensions (vertically).
↳ The dimensionality of each feature is increased from 3 to 4.
↳ Note that each position is processed by the same weight matrix. This is what the term "position-wise" is referring to.
↳ Note that the FFN is essentially a multi layer perceptron.
[5] ReLU
↳ Negative values are set to zeros by ReLU.
[6] FFN: Second Layer
↳ Feed all 5 features (d=3) into the second layer.
↳ The dimensionality of each feature is decreased from 4 back to 3.
↳ The output is fed to the next block to repeat this process.
↳ Note that the next block would have a completely separate set of parameters.
Together, the two key parts: attention and FFN, transform features both across positions and across feature dimensions. This is what makes the transformer (🚗) run!
asleep.
There is a lesson somewhere in there.
These two images explain the complexity of decision making as a group scales.
@GroqInc whisper-large-v3 is insanely fast! 30 minutes of audio transcribed in 20 seconds! 🤯
it's time to build.
The Paris @MistralAI x @cerebral_valley hackathon is on 🇫🇷
@dennizor hearing reports that the future of coding crowd has got their hands on this
slaps roof of canvas
"First, only hire when you're certain it's necessary and beneficial. Second, conserve your resources and spend wisely - the hardest part isn't building the product but selling it."
we interviewed the founder of Calendesk.
link below 👇
A really intriguing set of findings of AI researchers that needs more exploration, replication, and expansion: AI agents given personalities and backgrounds, and placed into a virtual formal organization (with CEOs, VPs, etc.) outperform normal AI in doing complex tasks.
Annnd we have a timer! With a reset switch.
The propagator model was described as a new "substrate for computation" by Alexey Radul in his 2009 paper. It's having a bit of a resurgence now that people are seeing what it can do... (everything).
Made in @tldraw + custom code
Nobody wants to tell you this but you don't have to solve society's problems. You can just create new technologies that make those problems irrelevant.
We are never definitely right, we can only be sure we are wrong.
hello here i am