This:
Numbers in step 1 don’t have to be between -1 to 1.
Step 2 is apparently missed out from the code in the screenshots that you have shared. After step 2, numbers in the resulting matrics will be between -1 to 1.
Step 4 to step 6 show how a matmul becomes some dot products
With normalized vectors (embeddings), numbers in step 7 will always be between -1 and 1 and are called cosine similarity ( as explained by @Netwolf’s post). Since 0.59 is the largest, it is the highest similarity among all Q&A pairs’.
If your example was meant for understanding matmul (as your title said), then the problem is, unlike what the code in your screenshot has, none of your a, b, c, d is matrix. If you would like to, you might repeat my steps with your own matrics (i.e. combine your a and c as my Q, and combine your b and d as my A).
Cheers,
Raymond


