Building and joining organizations are core aspects of what make us human. How would the nature of human organizations evolve now that machines can understand human language? Join me on Thursday as I participate in a panel discussion on this intriguing topic at #TheAISummit.
Scaling Laws for Reward Model Overoptimization in Direct Alignment Algorithms
Reinforcement Learning from Human Feedback (RLHF) has been crucial to the recent success of Large Language Models (LLMs), however, it is often a complex and brittle process.
[Self-Attention] by Hand ✍️
Self-attention is what enables LLMs to understand context.
How does it work?
This exercise demonstrates how to calculate a 6-3 attention head by hand. Note that if we have two instances of this, we get 6-6 attention (i.e., multi-head attention, n=2).
-- 𝗚𝗼𝗮𝗹 --
Transform [6D Features 🟧] to [3D Attention Weighted Features 🟦]
-- 𝗪𝗮𝗹𝗸𝘁𝗵𝗿𝗼𝘂𝗴𝗵 --
[1] Given
↳ A set of 4 feature vectors (6-D): x1,x2,x3,x4
[2] Query, Key, Value
↳ Multiply features x's with linear transformation matrices WQ, WK, and WV, to obtain query vectors (q1,q2,q3,q4), key vectors (k1,k2,k3,k4), and value vectors (v1,v2,v3,v4).
↳ "Self" refers to the fact that both queries and keys are derived from the same set of features.
[3] 🟪 Prepare for MatMul
↳ Copy query vectors
↳ Copy the transpose of key vectors
[4] 🟪 MatMul
↳ Multiply K^T and Q
↳ This is equivalent to taking dot product between every pair of query and key vectors.
↳ The purpose is to use dot product as an estimate of the "matching score" between every key-value pair.
↳ This estimate makes sense because dot product is the numerator of Cosine Similarity between two vectors.
[5] 🟨 Scale
↳ Scale each element by the square root of dk, which is the dimension of key vectors (dk=3).
↳ The purpose is to normalize the impact of the dk on matching scores, even if we scale dk to 32, 64, or 128.
↳ To simplify hand calculation, we approximate [ □/sqrt(3) ] with [ floor(□/2) ].
[6] 🟩 Softmax: e^x
↳ Raise e to the power of the number in each cell
↳ To simplify hand calculation, we approximate e^□ with 3^□.
[7] 🟩 Softmax: ∑
↳ Sum across each column
[8] 🟩 Softmax: 1 / sum
↳ For each column, divide each element by the column sum
↳ The purpose is normalize each column so that the numbers sum to 1. In other words, each column is a probability distribution of attention, and we have four of them.
↳ The result is the Attention Weight Matrix (A) (yellow)
[9] 🟦 MatMul
↳ Multiply the value vectors (Vs) with the Attention Weight Matrix (A)
↳ The results are the attention weighted features Zs.
↳ They are fed to the position-wise feed forward network in the next layer.
GNN-RAG
Combines the language understanding abilities of LLMs with the reasoning abilities of GNNs in a RAG style.
The GNN extracts useful and relevant graph information while the LLM takes the information and leverages its capabilities to perform question answering over knowledge graphs (KGQA).
GNN-RAG improves vanilla LLMs on KGQA and outperforms or matches GPT-4 performance with a 7B tuned LLM.
Quote from the paper: "GNN-RAG is shown to retrieve multi-hop information that is necessary for faithful LLM reasoning on complex questions."
It's interesting to see the recent use of both tree and graph-based approaches integrated with LLMs to further enhance the reasoning abilities of LLMs.
One of the biggest challenges of using knowledge graphs is building it.
Here we show an awesome research project using LLMs to construct knowledge graphs, allowing researchers to make conceptual connections between disparate fields (e.g. relate materials science to biology)
It’s a perfect example of LLMs at every step of data transformation to insight 💡
✅ A LLM is used to generate conversational data about scientific concepts
✅ An LLM is used to generate the actual KG
✅ An LLM can be used to query the KG to answer additional questions about relationships
Check MechGPT (@ProfBuehlerMIT) out 👇
Open source AI is the way to go!
Proud to see @huggingface, @scaleway, & @meta joining to launch an AI startup accelerator at Station F.
This will help concretize our common vision of an open and collaborative AI ecosystem.
More from TechCrunch:
https://t.co/iR3sH6BRRd