# 1536 --- # Actually... sorry... it was 3072 --- (this joke worked better before) --- # We had a problem --- [Cord.com baby!](https://cord.com/) --- ![Actual man writing actual documentation](https://www.blackgate.com/wp-content/uploads/2013/10/Men-Writing.jpg) --- ![John Travolta can't find our docs](https://media2.giphy.com/media/3o7aTskHEUdgCQAXde/giphy.gif?cid=ecf05e47bah597278z0h84ltbjfk9akasmf5s9s40q5y65x4&ep=v1_gifs_search&rid=giphy.gif&ct=) --- ![Man crying](https://domf5oio6qrcr.cloudfront.net/medialibrary/10433/GettyImages-1220736928.jpg) --- ![Thinking face](https://media4.giphy.com/media/L1bqiQs0bibjqG9zXZ/giphy.gif?cid=ecf05e47fdu8et49i7q8r6eqax8fi53cz083dkmfz7ar08uc&ep=v1_gifs_search&rid=giphy.gif&ct=g) --- # So... use Elastic Search?! --- ![No](https://media4.giphy.com/media/v1.Y2lkPTc5MGI3NjExcTF6eXBoYWs3YWlvamdvaWhvMW9jZGZkenBpNW44NTBwb2Q0dXFjZiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/8vUEXZA2me7vnuUvrs/giphy.gif) --- # What about the new shiny thing?! --- ![OpenAI](https://media3.giphy.com/media/SnbwVKTj0vBQSK47us/giphy.gif?cid=ecf05e479gmx9g7vzj7hlp6hzog3eb2fa1s88yp3zk3bgz8k&ep=v1_gifs_search&rid=giphy.gif&ct=g) --- # Wait... how does it work? --- # Show of hands --- ![We are one](https://www.lights4fun.co.uk/cdn/shop/products/PL22003_We-Are-One-Neon-Wall-Light.jpg?v=1641401565&width=1280) --- ![Not this kind of embedding](https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExdW1ic2kycjR0bzM2bHlsazk4YXcxbHdldHd3ODl0bGx5NGJ1cXliNSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/ZNAMvXn6ZzNVS/giphy.gif) --- ![Embeddings](https://cdn.sanity.io/images/vr8gru94/production/e016bbd4d7d57ff27e261adf1e254d2d3c609aac-2447x849.png) --- # It's far more than keyword search --- # How many numbers? --- # I lied. The year was not 1536. --- 1536, 3072 --- # Cosine Similarity --- ![SpiderMEN!](https://www.bradleyscout.com/wp-content/uploads/2020/10/unnamed-4.jpg) --- ```typescript function dot(a: number[], b: number[]) { return a.map((x, i) => a[i] * b[i]).reduce((m, n) => m + n); } function norm(v: number[]) { return Math.sqrt(dot(v, v)); } export function cosineSimilarity(a: number[], b: number[]): number { return dot(a, b) / (norm(a) * norm(b)); } ``` --- # To the terminal! --- # Thank you! ❤️ **Questions?** ### >>> jack@cord.com ---
{"description":"Man crying","title":"Why Are Embeddings So Absurdly Useful","contributors":"[{\"id\":\"023103e3-69ca-4950-a1f0-0212c6dcb3a4\",\"add\":5627,\"del\":3289}]"}
    287 views