tsfrm/unity-embed
09
1---2license: mit3language:4- en5tags:6- ridiculous-models7---8 9# unity-embed10 11An embedding model where every input maps to the same vector.12 13384 parameters, one per dimension, all equal to 1/sqrt(384) so that v has unit14norm. There is no tokenizer and no encoder, embed(x) = v for any x. Any language15works, identically.16 17## Property18 19For all sentences s and t:20 21```22cosine(embed(s), embed(t)) = 1.00000023```24 25similarity.py checks this against a few pairs and exits nonzero if it ever fails.26So far it has never failed.27 28```29cosine('i love you' , 'i hate you' ) = 1.00000030cosine('the ocean is beautiful', '2 + 2 = 4' ) = 1.00000031cosine('hamlet: to be or not' , 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' ) = 1.00000032```33 34## Notes35 36- Semantic search always returns everything at rank 1. Recall and precision both37 100%, along with everything else.38- Clustering yields one cluster. Silhouette score is fine.39- Corpus deduplication reduces your corpus to one document, which deduplicates further.40- For comparison, all-MiniLM-L6-v2 uses 22.7M parameters to produce a wide variety41 of vectors. This uses 384 and produces one.42 43## Usage44 45```bash46python3 encode.py "hello world"47python3 encode.py "goodnight moon" "war and peace"48python3 similarity.py49```50 51`model.safetensors` is 1,634 bytes.52 