To check that your squared_pairwise_distances_vectorized function works correctly, you want to see if a simpler implementation using for-loops will give the same answer. I have written a program to check the answer of your function against my function that uses for-loop and output "Success!" if all the answer matches up.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence