Is naming things hard? Sometimes absolutely! Should you off load that cognitive load to AI? Only if you want to get worse at writing and maintaining code.
Good lord, let’s waste more energy and destroy more communities because now naming things is too hard? I hope this is a joke.
Why does everything need to be done with an LLM?
because there needs to be a justification for the absurd situation this country is in where all the GDP is based on LLMs
Naturally, the LLM can generate interpretations and probabilities which are not correct. Yet, we believe that an LLM is a good-enough measure of semantic ambiguity for our needs.
You’re asking an LLM to invent a probability distribution over meanings. Embedding models are explicitly trained to represent semantic similarity geometrically. Why not use the right tool for the job over “slop”?
- Download you an embedding model — you can run it on garbage, or pay for an API if you want.
- Embed the identifier
- Embed the symbol’s implementation summary (or docstring)
- cosine(name_embedding, description_embedding)
- Have LLM suggest alternatives and repeat
- Rank names by semantic similarity.
ETA:
I present: https://gitlab.com/MagickShel/namer
It doesn’t generate the list of names to test, though. I leave that to the imagination of the user.
ETAA:
There is a class of naming it doesn’t work great on. I probably overstepped and was a bit of an ass. This just gave me the inspiration to do basically the thing you did here, the way I have told myself for months it should be done.
Also, there is a class of naming - jargon and acronyms - where your approach works better. I still prefer something more deterministic, but credit where credit is due.
Hey, absolute props for replying to my code by making a counter-code of your own!
I don’t have the time to look into this right now, but wanted to say that this is the best I could hope of posting my random projects here: Having someone else tell you what they would do instead.
And for context, this was a weekend experiment. I wanted to try building “agentic stuff,” and exploring the not-so-promising intersection of information theory, LLMs, and code quality.
Will edit later after I read yours.
This is how RAG pipelines work. You chunk up text and then embed it, which gives you a vector representation of the text. You store that in a database keys in the vector Then when you want to inject relevant information for a prompt, you embed the prompt to get a vector, and then dump the a handful of most similar chunks into context to provide additional information.
So this semantic similarity question has been in my mind for a while to answer the question of what names would be the most “intuitive” for an LLM.
Does it work? shrug I guess we’ll find out.




