Some small tips from superficially reading the code: https://github.com/arunsupe/semantic-grep/blob/b7dcc82a7cbab... You can read the vector all at once. See e.g.: https://github.com/danieldk/go2vec/blob/ee0e8720a8f518315f35... --- https://github.com/arunsupe/semantic-grep/blob/b7dcc82a7cbab... You can compute the similarity much faster by using BLAS. Good BLAS libraries have SIMD-optimized implementations. Or if you…
Show HN: Semantic Grep – A Word2Vec-powered search tool
41–50 of 58 posts
Re: Show HN: Semantic Grep – A Word2Vec-powered search tool
#42The model of a word to a vector breaks down really quickly one you introduce the context and complexity of human language. That's why we went to contextual embeddings, but even they have issues. Curious would it handle negation of trained keywords, e.g "not urgent"?
Something like SBERT addresses this.
Re: Show HN: Semantic Grep – A Word2Vec-powered search tool
#43document search, an llm use-case almost all companies want for their white-collar workers, currently follows creation of a RAG. vector search is the first step of the process, and i argue that getting top n results and letting the user process them is probably the best of both worlds without involving "AI". this can be enhanced with multilingual support based on the encoder used. but building the index is still an ex…
Re: Show HN: Semantic Grep – A Word2Vec-powered search tool
#44Some small tips from superficially reading the code: https://github.com/arunsupe/semantic-grep/blob/b7dcc82a7cbab... You can read the vector all at once. See e.g.: https://github.com/danieldk/go2vec/blob/ee0e8720a8f518315f35... --- https://github.com/arunsupe/semantic-grep/blob/b7dcc82a7cbab... You can compute the similarity much faster by using BLAS. Good BLAS libraries have SIMD-optimized implementations. Or if you…
SIMD situation in Go is still rather abysmal, it’s likely easier to just FFI (though FFI is very slow so I guess you're stuck with ugly go asm if you are using short vectors). As usual, there's a particular high-level language that does it very well, and has standard vector similarity function nowadays...
Re: Show HN: Semantic Grep – A Word2Vec-powered search tool
#45Re: Show HN: Semantic Grep – A Word2Vec-powered search tool
#46Earlier quoted context omitted.
SIMD situation in Go is still rather abysmal, it’s likely easier to just FFI (though FFI is very slow so I guess you're stuck with ugly go asm if you are using short vectors). As usual, there's a particular high-level language that does it very well, and has standard vector similarity function nowadays...
Go ahead and share the language, it is good etiquette for HN :)
C#: https://github.com/dotnet/runtime/blob/main/docs/coding-guid... (and full family of other types: Vector2/3/4, Matrix3x2/4x4 and upcoming Tensor), vector similarity I was talking about is this: https://learn.microsoft.com/en-us/dotnet/api/system.numerics..., it uses a highly optimized SIMD kernel, for DotProduct just use an adjacent method
Swift: https://developer.apple.com/documentation/swift/simd-vector-... it is also a competent language at portable SIMD by virtue of using LLVM and offering almost the same operators-based API (e.g. masked = vec1 & ~vec2) like C#
Mojo: https://docs.modular.com/mojo/stdlib/builtin/simd which follows the above two, it too targets LLVM so expect good SIMD codegen as long the lowering strategy does it in an LLVM-friendly way, which I have not looked at yet.
Re: Show HN: Semantic Grep – A Word2Vec-powered search tool
#47The model of a word to a vector breaks down really quickly one you introduce the context and complexity of human language. That's why we went to contextual embeddings, but even they have issues. Curious would it handle negation of trained keywords, e.g "not urgent"?
For the drawbacks:
Word embeddings are only good at similarity search style queries - stuff like paraphrasing.
Negation they'll necessarily struggle with. Since word embeddings are generally summed or averaged into a sentence embedding, a negation won't shift the sentence vector space around the way it would in a LM embedding.
Also things like homonyms are issues, but this is massively overblown as a reason to use LM embeddings (at least for latin/germanic languages).
Most people use LM embeddings because they've been told it's the best thing by other people rather than benchmarking accuracy and performance for their usecase.
1. https://github.com/oborchers/Fast_Sentence_Embeddings
2. https://www.sbert.net/docs/sentence_transformer/pretrained_m...
Re: Show HN: Semantic Grep – A Word2Vec-powered search tool
#48Earlier quoted context omitted.
Mistral has published large language models, not embedding models? sgrep uses Google's Word2Vec to generate embeddings of the corpus and perform similarity searches on it, given a user query.
No I got that I asked because wouldn’t embedding generated by fine tuned transformer based LLMs be more context aware? Idk much about the internals so apologies if this was a dumb thing to say
Re: Show HN: Semantic Grep – A Word2Vec-powered search tool
#49Earlier quoted context omitted.
Go ahead and share the language, it is good etiquette for HN :)
Actually, there's three: C#: https://github.com/dotnet/runtime/blob/main/docs/coding-guid... (and full family of other types: Vector2/3/4, Matrix3x2/4x4 and upcoming Tensor ), vector similarity I was talking about is this: https://learn.microsoft.com/en-us/dotnet/api/system.numerics... , it uses a highly optimized SIMD kernel, for DotProduct just use an adjacent method Swift: https://developer.apple.com/documentation…
Re: Show HN: Semantic Grep – A Word2Vec-powered search tool
#50Earlier quoted context omitted.
Actually, there's three: C#: https://github.com/dotnet/runtime/blob/main/docs/coding-guid... (and full family of other types: Vector2/3/4, Matrix3x2/4x4 and upcoming Tensor ), vector similarity I was talking about is this: https://learn.microsoft.com/en-us/dotnet/api/system.numerics... , it uses a highly optimized SIMD kernel, for DotProduct just use an adjacent method Swift: https://developer.apple.com/documentation…
Not Julia?
Mojo team's blog posts do indicate they care about optimal compiler output, and it seems to have ambitions for a wider domain of application which is why it is mentioned.