{"id":489,"date":"2026-04-11T20:43:27","date_gmt":"2026-04-11T19:43:27","guid":{"rendered":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/"},"modified":"2026-04-11T20:43:33","modified_gmt":"2026-04-11T19:43:33","slug":"understanding-transformers-part-5-queries-keys-and-similarity","status":"publish","type":"post","link":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/","title":{"rendered":"Understanding Transformers Part 5: Queries, Keys, and Similarity"},"content":{"rendered":"<div class=\"anp-pro-entry\">\n<p class=\"anp-pro-lead\">The topic <strong>Understanding Transformers Part 5: Queries, Keys, and Similarity<\/strong> is currently the subject of lively discussion \u2014 readers and analysts are keeping a close eye on developments.<\/p>\n<p class=\"anp-pro-p\">This is taking place in a dynamic environment: companies\u2019 decisions and competitors\u2019 reactions can quickly change the picture.<\/p>\n<p class=\"anp-pro-p\">In the previous article, we explored the self-attention concept for transformers, in this article we will go deeper into how the comparisons are performed.<\/p>\n<p class=\"anp-pro-p\">We have already added positional encoding to the words \u201cLet\u2019s\u201d and \u201cgo\u201d.<\/p>\n<p class=\"anp-pro-p\">The first step is to multiply the position-encoded values for the word \u201cLet\u2019s\u201d by a set of weights.<\/p>\n<p class=\"anp-pro-p\">Next, we repeat the same process using a different set of weights, which gives us another value (for example, 3.7).<\/p>\n<p class=\"anp-pro-p\">We do this twice because we started with two position-encoded values representing the word \u201cLet\u2019s\u201d.<\/p>\n<figure class=\"anp-pro-inline-figure\" style=\"margin:1.75em auto;text-align:center;max-width:100%\"><img decoding=\"async\" class=\"anp-pro-inline-img\" src=\"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fz6vfpw160kp4vkcmnaov.webp\" alt=\"\" style=\"margin:0 auto;max-width:100%;width:auto;height:auto;object-fit:contain;object-position:center\" loading=\"lazy\"><\/figure>\n<p class=\"anp-pro-p\">These resulting values together represent \u201cLet\u2019s\u201d in a new form.<\/p>\n<p class=\"anp-pro-p\">Now, we use these query values to measure similarity with other words, such as \u201cgo\u201d.<\/p>\n<p class=\"anp-pro-p\">To do this, we first create a new set of values for each word, similar to how we created the query values.<\/p>\n<p class=\"anp-pro-p\">We will use these key values along with the query values to calculate how similar \u201cLet\u2019s\u201d is to \u201cgo\u201d.<\/p>\n<p class=\"anp-pro-p\">We will explore how this similarity is calculated in the next article.<\/p>\n<p class=\"anp-pro-p\">Looking for an easier way to install tools, libraries, or entire repositories?<br \/>\nTry Installerpedia: a community-driven, structured installation platform that lets you install almost anything with minimal hassle and clear, reliable guidance.<\/p>\n<figure class=\"anp-pro-inline-figure\" style=\"margin:1.75em auto;text-align:center;max-width:100%\"><img decoding=\"async\" class=\"anp-pro-inline-img\" src=\"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fk820jaw399uoa7nm3fjv.webp\" alt=\"\" style=\"margin:0 auto;max-width:100%;width:auto;height:auto;object-fit:contain;object-position:center\" loading=\"lazy\"><\/figure>\n<p class=\"anp-pro-p\">Templates let you quickly answer FAQs or store snippets for re-use.<\/p>\n<p class=\"anp-pro-p\">Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment&#8217;s permalink.<\/p>\n<p class=\"anp-pro-p\">For further actions, you may consider blocking this person and\/or reporting abuse<\/p>\n<p class=\"anp-pro-p\">Thank you to our Diamond Sponsors for supporting the DEV Community<\/p>\n<p class=\"anp-pro-p\">Google AI is the official AI Model and Platform Partner of DEV<\/p>\n<p class=\"anp-pro-p\">DEV Community \u2014 A space to discuss and keep up software development and manage your software career<\/p>\n<p class=\"anp-pro-p\">Built on Forem \u2014 the open source software that powers DEV and other inclusive communities.<\/p>\n<p class=\"anp-pro-p\">We&#8217;re a place where coders share, stay up-to-date and grow their careers.<\/p>\n<aside class=\"anp-pro-aside\" aria-label=\"context\">\n<p class=\"anp-pro-kicker\">Why it matters<\/p>\n<p class=\"anp-pro-p\">News like this often changes audience expectations and competitors\u2019 plans.<\/p>\n<p class=\"anp-pro-p\">When one player makes a move, others usually react \u2014 it is worth reading the event in context.<\/p>\n<\/aside>\n<aside class=\"anp-pro-aside\" aria-label=\"outlook\">\n<p class=\"anp-pro-kicker\">What to look out for next<\/p>\n<p class=\"anp-pro-p\">The full picture will become clear in time, but the headline already shows the dynamics of the industry.<\/p>\n<p class=\"anp-pro-p\">Further statements and user reactions will add to the story.<\/p>\n<\/aside>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p class=\"text-justify mb-2\" >The topic Understanding Transformers Part 5: Queries, Keys, and Similarity is currently the subject of lively discussion \u2014 readers and analysts are keeping a close eye on developments. This is taking place in a dynamic environment: companies\u2019 decisions and competitors\u2019 reactions can quickly change the [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":490,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wpscppro_dont_share_socialmedia":false,"_wpscppro_custom_social_share_image":0,"_facebook_share_type":"","_twitter_share_type":"","_linkedin_share_type":"","_pinterest_share_type":"","_linkedin_share_type_page":"","_instagram_share_type":"","_medium_share_type":"","_threads_share_type":"","_google_business_share_type":"","_selected_social_profile":[],"_wpsp_enable_custom_social_template":false,"_wpsp_social_scheduling":{"enabled":false,"datetime":null,"platforms":[],"status":"template_only","dateOption":"today","timeOption":"now","customDays":"","customHours":"","customDate":"","customTime":"","schedulingType":"absolute"},"_wpsp_active_default_template":true},"categories":[1],"tags":[129,127,128,126,130],"class_list":["post-489","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology-news","tag-article","tag-similarity","tag-transformers","tag-values","tag-word"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Understanding Transformers Part 5: Queries, Keys, and Similarity - who-offers.site<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding Transformers Part 5: Queries, Keys, and Similarity - who-offers.site\" \/>\n<meta property=\"og:description\" content=\"The topic Understanding Transformers Part 5: Queries, Keys, and Similarity is currently the subject of lively discussion \u2014 readers and analysts are keeping a close eye on developments. This is taking place in a dynamic environment: companies\u2019 decisions and competitors\u2019 reactions can quickly change the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/\" \/>\n<meta property=\"og:site_name\" content=\"who-offers.site\" \/>\n<meta property=\"article:published_time\" content=\"2026-04-11T19:43:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-11T19:43:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fiy5gd42djq4w3s9kwpjv.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"627\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Understanding Transformers Part 5: Queries, Keys, and Similarity\",\"datePublished\":\"2026-04-11T19:43:27+00:00\",\"dateModified\":\"2026-04-11T19:43:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/\"},\"wordCount\":434,\"publisher\":{\"@id\":\"https:\/\/who-offers.site\/#organization\"},\"image\":{\"@id\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fiy5gd42djq4w3s9kwpjv.webp\",\"keywords\":[\"Article\",\"Similarity\",\"Transformers\",\"Values\",\"Word\"],\"articleSection\":[\"Technology News\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/\",\"url\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/\",\"name\":\"Understanding Transformers Part 5: Queries, Keys, and Similarity - who-offers.site\",\"isPartOf\":{\"@id\":\"https:\/\/who-offers.site\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fiy5gd42djq4w3s9kwpjv.webp\",\"datePublished\":\"2026-04-11T19:43:27+00:00\",\"dateModified\":\"2026-04-11T19:43:33+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#primaryimage\",\"url\":\"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fiy5gd42djq4w3s9kwpjv.webp\",\"contentUrl\":\"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fiy5gd42djq4w3s9kwpjv.webp\",\"width\":1200,\"height\":627},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/who-offers.site\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understanding Transformers Part 5: Queries, Keys, and Similarity\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/who-offers.site\/#website\",\"url\":\"https:\/\/who-offers.site\/\",\"name\":\"who-offers.site\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/who-offers.site\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/who-offers.site\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/who-offers.site\/#organization\",\"name\":\"who-offers.site\",\"url\":\"https:\/\/who-offers.site\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/who-offers.site\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/01\/cropped-logo.png\",\"contentUrl\":\"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/01\/cropped-logo.png\",\"width\":50,\"height\":50,\"caption\":\"who-offers.site\"},\"image\":{\"@id\":\"https:\/\/who-offers.site\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Understanding Transformers Part 5: Queries, Keys, and Similarity - who-offers.site","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/","og_locale":"en_GB","og_type":"article","og_title":"Understanding Transformers Part 5: Queries, Keys, and Similarity - who-offers.site","og_description":"The topic Understanding Transformers Part 5: Queries, Keys, and Similarity is currently the subject of lively discussion \u2014 readers and analysts are keeping a close eye on developments. This is taking place in a dynamic environment: companies\u2019 decisions and competitors\u2019 reactions can quickly change the [&hellip;]","og_url":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/","og_site_name":"who-offers.site","article_published_time":"2026-04-11T19:43:27+00:00","article_modified_time":"2026-04-11T19:43:33+00:00","og_image":[{"width":1200,"height":627,"url":"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fiy5gd42djq4w3s9kwpjv.webp","type":"image\/webp"}],"twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#article","isPartOf":{"@id":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/"},"author":{"name":"","@id":""},"headline":"Understanding Transformers Part 5: Queries, Keys, and Similarity","datePublished":"2026-04-11T19:43:27+00:00","dateModified":"2026-04-11T19:43:33+00:00","mainEntityOfPage":{"@id":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/"},"wordCount":434,"publisher":{"@id":"https:\/\/who-offers.site\/#organization"},"image":{"@id":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#primaryimage"},"thumbnailUrl":"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fiy5gd42djq4w3s9kwpjv.webp","keywords":["Article","Similarity","Transformers","Values","Word"],"articleSection":["Technology News"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/","url":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/","name":"Understanding Transformers Part 5: Queries, Keys, and Similarity - who-offers.site","isPartOf":{"@id":"https:\/\/who-offers.site\/#website"},"primaryImageOfPage":{"@id":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#primaryimage"},"image":{"@id":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#primaryimage"},"thumbnailUrl":"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fiy5gd42djq4w3s9kwpjv.webp","datePublished":"2026-04-11T19:43:27+00:00","dateModified":"2026-04-11T19:43:33+00:00","breadcrumb":{"@id":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#primaryimage","url":"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fiy5gd42djq4w3s9kwpjv.webp","contentUrl":"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/04\/https3A2F2Fdev-to-uploads.s3.amazonaws.com2Fuploads2Farticles2Fiy5gd42djq4w3s9kwpjv.webp","width":1200,"height":627},{"@type":"BreadcrumbList","@id":"https:\/\/who-offers.site\/index.php\/2026\/04\/11\/understanding-transformers-part-5-queries-keys-and-similarity\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/who-offers.site\/"},{"@type":"ListItem","position":2,"name":"Understanding Transformers Part 5: Queries, Keys, and Similarity"}]},{"@type":"WebSite","@id":"https:\/\/who-offers.site\/#website","url":"https:\/\/who-offers.site\/","name":"who-offers.site","description":"","publisher":{"@id":"https:\/\/who-offers.site\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/who-offers.site\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/who-offers.site\/#organization","name":"who-offers.site","url":"https:\/\/who-offers.site\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/who-offers.site\/#\/schema\/logo\/image\/","url":"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/01\/cropped-logo.png","contentUrl":"https:\/\/who-offers.site\/wp-content\/uploads\/2026\/01\/cropped-logo.png","width":50,"height":50,"caption":"who-offers.site"},"image":{"@id":"https:\/\/who-offers.site\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/who-offers.site\/index.php\/wp-json\/wp\/v2\/posts\/489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/who-offers.site\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/who-offers.site\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/who-offers.site\/index.php\/wp-json\/wp\/v2\/comments?post=489"}],"version-history":[{"count":1,"href":"https:\/\/who-offers.site\/index.php\/wp-json\/wp\/v2\/posts\/489\/revisions"}],"predecessor-version":[{"id":496,"href":"https:\/\/who-offers.site\/index.php\/wp-json\/wp\/v2\/posts\/489\/revisions\/496"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/who-offers.site\/index.php\/wp-json\/wp\/v2\/media\/490"}],"wp:attachment":[{"href":"https:\/\/who-offers.site\/index.php\/wp-json\/wp\/v2\/media?parent=489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/who-offers.site\/index.php\/wp-json\/wp\/v2\/categories?post=489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/who-offers.site\/index.php\/wp-json\/wp\/v2\/tags?post=489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}