I can’t believe programming is now at the stage where advice like "first have the computer give you totally wrong answers, then just find a function that maps the wrong answers to the correct ones!" is a thing.
> On two occasions I have been asked, – "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
He clearly didn't know enough about vector embeddings.
I was hoping a lossy semantic reasoning machine would put to bed words such as "right" and "wrong" outside of formal logic, but apparently this fight has just begun
Yeah they solved the main issue I had with Google. "I remember this exact thing, but not exactly how it was phrased..."
Except not as much as I'd like... they often also don't know what the hell I'm talking about, and it still takes them twenty minutes of Googling to find the right page!
I regularly ask Claude to find that one book, that one short story, that one meme, you know the one, it had the guy and the thing, no not quite like that...
I feel like I'm fighting a losing battle but I don't see why so many people consider LLMs innately non-deterministic, an LLM running on a CPU with greedy decoding would be 100% deterministic and still have the intelligence we associate with LLMs
> I feel like I'm fighting a losing battle but I don't see why so many people consider LLMs innately non-deterministic ...
Because LLMs are artificial neural networks[0] (ANN), which are statistical in nature, and thus intrinsically non-deterministic. Pretty much every AI algorithm has randomness involved in its definition and many (most?) incorporate probabilities.
Now that you mention it, I think "statistical" might be a good word choice as it probably closely matches what people mean when they say an LLM is nondeterministic. However, on a technical level, neural network inference truly is inherently deterministic. The only nondeterminism in LLMs is parallelism-dependency in the way floating point operations are carried out and in the decoding strategy
> The only nondeterminism in LLMs is parallelism-dependency in the way floating point operations are carried out and in the decoding strategy
This assertion is "oddly" similar to the GPT answer "neural network inference determinism" produced:
Neural network inference is often non-deterministic due to
factors like floating-point arithmetic and concurrent
execution, which can lead to variations in output even with
the same input.
Surely this is but a coincidence.
Regarding your previous statement:
> However, on a technical level, neural network inference truly is inherently deterministic.
This holds for a vanishingly small set of conditions, none of which include randomness, nor when context and transformers are involved, let alone underlying model evolution (thus making model use over time non-deterministic).
> This assertion is "oddly" similar to the GPT answer "neural network inference determinism" produced
My statement and GPT's statement are both correct answers to the same question, so I think it makes sense that they would be similar. Are you accusing me of having paraphrased an LLM in writing my answer? I did not, I just remembered having read Thinky's post on the subject [0], which GPT has probably read also.
> This holds for a vanishingly small set of conditions, none of which include randomness, nor when context and transformers are involved, let alone underlying model evolution (thus making model use over time non-deterministic).
There are plenty of ways to introduce nondeterminism into any system. By your standards, I doubt you could point to a single deterministic system in the world. print("hello, world") is only deterministic if your CPU is properly shielded from cosmic rays and your OS isn't out of memory etc. There are some inherently nondeterministic processes, like the stochastic methods used to train models or the random sampling used at inference time if you have temperature!=0, but inference under greedy decoding is conceptually deterministic.
only if you bias your "random sampling of the distributions it gives"
Fixing the seed is still intentional bias. Or you could force it to always take the one token with the highest probability, but that is still biased sampling. Deterministic, sure, but intentionally wrong just to avoid a technically
There's nothing inherently biased or intentionally wrong with greedy decoding. Why would there be? Let's say you're trying to predict what an expert doctor would say to a patient with cancer. You think there's a 99% chance the doctor would say "start chemotherapy" and a 1% chance the doctor would say "don't worry about it". If you have to pick one to output, you'll pick "start chemotherapy". It would be crazy to say the best thing to do is to roll a 100-sided die to determine your answer. A language model is literally in that exact situation.
Valid point, it’s why I included the word “traditional”, to try to qualify that.
What I meant is something more like explicitly programmed vs. learned. Intelligence can result from learned behavior, but not from explicit programming of rules by humans.
An aspect of this is that “learning” is unpredictable - we can’t predict in advance exactly how the resulting model will behave, except broadly. It seems non-deterministic if only by virtue of its complexity, which is beyond anything we’re able to predictively model.
I've worked on expert systems. I don't agree that they achieve "simulated intelligence". They're preprogrammed with a set of domain-specific rules that are trivially simple by comparison to even relatively simple and small neural networks.
> I don't agree that they achieve "simulated intelligence". They're preprogrammed with a set of domain-specific rules that are trivially simple by comparison to even relatively simple and small neural networks.
This position does not account for fuzzy logic[0] nor an expert system's ability to produce an answer of "I do not know and here is why", which neural networks are incapable of doing.
I am not saying expert systems are "better" than ANNs as both are algorithms having significant value for what they provide. What I am saying is neural networks are pattern-matching algorithms, quite useful in their own right, and do not possess the ability to identify the lack of existence.
No, fuzzy logic doesn't change what I said at all. In terms of intelligence, both of those technologies were at best limited and simplistic attempts at achieving what LLMs have actually achieved.
Comparing the two in 2026 seems like a bit of a joke to me. I'm not saying there's no role in future for traditional expert systems or fuzzy logic (or hand-written code, for that matter), but to claim they're "intelligence" or even "simulated intelligence" implies such a trivial definition of "intelligence" as to make it a useless term.
> an expert system's ability to produce an answer of "I do not know and here is why", which neural networks are incapable of doing.
Why do you believe that? Here's an excerpt from a response I received from Claude tonight:
> "I want to be honest about a limitation: I can't reliably confirm fine construction details — like exactly which sub-assembly is bolted to the spoke flange versus the fixed axle — from a marketing cutaway graphic at typical web resolution. Those images tend to be stylized/exploded-view illustrations meant to show 'there's a battery and a motor in here,' not engineering-accurate cross-sections with clear rotating/stationary boundaries marked."
This is after it examined two images I provided it with, and related it to the discussion we'd been having.
This demonstrates that it can indeed answer "I do not know and here is why", so your idea about what neural networks "are incapable of doing" is clearly incorrect.
And even if I grant your trivial threshold for intelligence, an interaction like that one clearly demonstrates a far superior degree of multi-modal intelligence, reasoning, and understanding that no expert system or fuzzy logic has ever even come close to achieving.
I've seen this debate several times and often there's a terminology issue, where the same word isn't being interpreted the same way by different sides.
Often it's a difference between repeatable versus predictable, or whether a system has chaotic aspects like the configurations of a double-pendulum or weather-forecasting.
Sometimes it's the difference between determinism in-theory versus in-practice, especially when various optimizations are being applied to save money.
Also, people seem to not realize that chaos can be 100% deterministic. Consider Mandelbrot or Conway's Game of Life.
The LLM inference process can be 100% deterministic but the weights can still make the end result quite chaotic. Just because temperature>0 improves results doesn't mean its an innate part of the mechanism. Just because scale-out architectures introduce jitter in communication doesn't mean that's an innate part of the mechanism.
This is so similar to human decision-making though. First I my innate experience to approximate to what I expect is right, then I map that to the truth.
It's the same for so many things:
- reading documentation (what do I expect this function to be called?)
- finding clothes in a shop (something long-sleeved and light)
- picking the fridge for dinner
- finding a book in the library...
so many analogues where I'm not coming cold to a choice.
If information is totally wrong then all you have to do is invert it to get the truth. What was it that Sherlock Holmes said? The problem ends up being that it often takes a tremendous number of counterexamples to eliminate everything that is impossible.
Worse is when you don't know whether the answers you have are totally wrong.
The entire problem of search is that the user has the wrong data and wants to use it to receive the correct data. That was the start, not the state we’ve ended up at - it is unironically how we got to LLMs.
“Hallucinate” is misleading here. In the given example, a classification is being done very successfully - it’s just that it requires an extra step to map it to an arbitrary predefined list of classifications.
If you can articulate why you think this isn’t a good approach, I’d be interested to hear it.
I can't believe people spend their lives finding lazier ways to classify a bunch of objects that will end up heaped in dormitory dumpsters across the US next spring.
A common case I have is when you don't have classifications to begin with. For example, you need to find what users complain about most. I take embeddings of all records, then cluster the embeddings into semantic groups, then ask an LLM to take a random sample from each clustered group and create a classification for that group.
This method is sensitive to the thresholds (what is the maximum distance between embeddings for them to be still considered part of the same semantic group), so I run it all in an agentic loop where an agent tries different thresholds and clustering algorithms until it's satisfied with the result, plus it may deduplicate some groups.
I run it all on self-hosted hardware, so it costs nothing to leave it running for, like, a night, and as a bonus, none of the corporate data leaves the office. I think a rigid set of manually created classifications may not capture all the possible classifications that can exist. Needs a review by a human, though.
The idea of distance thresholding models that are trained to satisfy an ordering constraint is a bit strange. The reason it's hard is that there isn't a threshold!
You can slice and dice it a ton of different ways, but the significance of groups is incidental.
It's a good starting point, but having done this a few times for a few companies it always seems like it needs substantial human review.
Nice trick. Couldn't you embed the query though, compare it to the embedding of the categories, then ship only categories that are close to it in the prompt to a smaller model?
It's basically a variation of HyDE (Hypothetical Document Embeddings), and the rationale is that the embedding of the query is not necessarily close to the embedding of the answer. If you generate a hallucinated answer, it can line up with the actual document better (in the embedding space, via BM25, or hybrid).
But honestly, it only works for common knowledge that's already in the LLM. If the target document contains very niche or private information, then the hallucinated answer's embedding can be even farther away than the query's.
I feel like querying for the smaller distance from the set of embeddings of both the query and a fake answer structure might solve that. If there's something very close to the query, it dominates, otherwise the fake answer is the guide. Plus, why not use an LLM to judge between them if we've got a token-burner all warmed up to start.
Even better is to search the corpus first with like naive BM25 / embedding search, aggregate over top N to get most representative categories, then have the LLM categorize in that set.
> In the notebook, I compute a MiniLM embedding of every real Wayfair classification. I compute the embedding of the fake, hypothetical embedding from the LLM. I then dot product the fake embedding into the real ones to find the most similar. Producing: [the right answer]
Isn't this begging the question that the hallucinated classification will be more selective with respect to the real schema than the query itself? What would the dot product of <E(search query), E(schema)> have given?
Even if that is too vague, smaller LLMs are capable rerankers; return the top N matching true categories and ask for a contextual ordering.
Yes what you're describing is a classic way of doing query understanding.
I've found, though, getting it in the language of the vocabulary has generally improved performance.
Further, when searching for "blue shoes" you want to separate the color from the item type. So its useful to have a dumb LLM do this for you. And with the LLM in the loop, its further useful to get it into the language of the taxonomy to improve embedding retrieval accuracy.
There are of course many ways to skin the cat here :)
Did you validate this by running a A/B test? Main question is were you able to classify back into your known categories correctly all the time, or did the errors compound from the llm hallucination plus embedding search
Using a Nano model, a tad worse than shipping a vocabulary to a larger OpenAI model. (And it’s an huge improvement on not classifying the queries at all).
But no classification is perfect. In search in particular, you will also want to have places for manual intervention for high priority queries.
I did something similar 10 years ago, but instead of llms I used word2vec to calculate a embeddings of product descriptions and map those to existing categories. The LLM approach is very likely better, but I'm curious what the cost difference is.
Prompt expansion of input to extra categories makes sense if your embedding isn’t working well. But on its own, why use the LLM at all? I think you could have demonstrated the original step first and then shown that it’s useful.
New embedding models support queries, so you don’t need to hallucinate a document before finding the nearest neighbor. Curious how it compares to this approach since you’d get to skip the LLM altogether.
What does it mean that an "embedding model supports queries"? An embedding model maps text to embedding vectors. You can always perform queries with such embedding vectors against a stored set of embeddings.
I would propose the following, query vector store for 10 closest categories based on a query, feed it to an LLM, in the prompt ask it to produce a single digit 0-9 representing the number of the most appropriate choice. Use plain text prompt, dont inflate token count with JSON.
There you go, you just drastically reduced the output pricing.
Additionally you could experiment with a reranker instead of an LLM or after reranking take top-3 results and then feed to LLM as input in order to reduce input token costs.
We have this running in production. Can get pretty expensive and slow. We are trying to replace this with cheaper and faster methods that don’t hammer our LLM and elastic search endpoints as much.
That's the whole problem. If you have tons (100s of thousands or more) of labels, then you have "structured" data, but how do you correctly classify that scraped item into the correct label?
Putting all the labels into the LLM is super expensive per call when you have millions of items to classify.
You can't reduce the number of labels becasue they are correctly organizes/structured. This class of problem exists in many different domains.
Smart trick, but assumes the “dumb” llm is smart enough not to derail into an article about the lives of South American red ants. Obvious exaggeration, the point being outcomes should stay strictly within topic, avoid unrelated bloat and hit the target.
I was in a project where we sent the whole taxonomy every request, 40k tokens + one article, ”plz classify”. This was before structured outputs. It was extremely expensive and still hallucinated. Good ol’ days.
Just this week I tried doing something similar with a nasty vibe-coded codebase I was trying to organize. I had Gemini Flash 3.6 classify each function/method in a similar way, giving a few plausible classifications for each (one agent per method).
It didn't end up being very useful - I ran a comparison where I just had a bigger agent do the organization in a more straightforward way, and that had better results.
I did find that Flash 3.6 High was >9x faster than Luna xhigh for this task, and got very similar results, though.
I’ve read a few different accounts, including OpenAI’s own admission, that Terra Medium or higher will likely produce better results than Luna xhigh and cost about the same or less.
Nice. I heard something similar years ago. Instead of doing a RAG search based on the question, first hallucinate a plausible answer, and then use that as the query...
This is awesome, it's literally harnessing llms for creativity. There's got to be a deeper angle here to develop llms in this direction explicitly: exploring possibility space and then mapping that into reality as post processing / tooling, in lieu of training so heavily around reality.
Interesting technique, but even if you're getting rid of hallucinations it seems there's still no guarantee of consistent classifications. If you need to do a semantic (embedding) search anyways, then how does this really help?
I don't know the exact syntax any more, but I expect this could be solved by a single sql query that uses "inexact but close" queries and a bunch of indexes (and perhaps tags) on each category.
They are already solving the problem with search engines, they're just using an LLM as a first pass to create better embeddings to run a similarity match on first. The difference in latency is likely made up for in accuracy.
LLMs aren't architected to handle filter-style comprehensive search without setting them up with additional tools.
Asking an LLM for a list of every county in the USA for example, or every county with a population of more than 100,000 people.
Even if those county names and their populations are mixed up in their weights, the nature of next-token-prediction does not lend them to effectively answering comprehensive, detailed questions like that.
An agent system build on top of an LLM can do it, if it has access to tools which can help access eg a table of counties and then filter them with SQL or Pandas or similar.
Because that's structured data and structured data is usually hidden away from users _and_ machines. Product rarely want to be honest, unless it's B2B in a very competitive market (and even then!). So, yeah, it's not that they are bad, it's that there are few good sources of information.
(Lets ignore for now that no one seems to agree to what should be the spec sheets)
With agentic commerce protocol / unified commerce protocol open ai and gemini are trying to solve this problem.
The idea is to make structured queries using these protocols which can be used to fetch top products matching the user needs instead of just relying on semantic search.
It gets worse: shopping agents are hostile adversaries to Amazon unless they're paying Amazon and they've agreed to be friendly agents. No agent that won't betray you to an Amazon pricing strategy is going to be allowed access to Amazon structured data. They might even be fed poisoned data to discredit them.
It can do that on run time, but it does not store data like that. The data is typically stored as embeddings in which it is hard to query data in a structured form. Example give me all products whose price is less than 200$ vs suggest me products for my spouse's birthday.
Instead: use an LLM to build a large (old-school) database of products with all their specifications. The LLM can also build the schema for that database as it finds more data.
Then use an LLM to query that database based on the user's specifications (+ add some intelligence to find nice suggestions for a birthday if wanted, but I'd consider that an extra).
Amazon Rufus has been mildly successful for me. I think the failures I've experienced with it are mostly because the product I'm looking for doesn't exist in the catalog.
It's been an absolute fucking disaster for me. It hallucinates endlessly and its searches are terrible. It even managed to confidently gaslight me about there being a VAT invoice available for a specific product.
I noticed yesterday when browsing on mobile that there used to be a box where I could search reviews and it got swapped with a Rufus box. I guess somebody needs to juice their engagement numbers for an investor briefing.
honestly, Amazon doesnt even need AI it just needs a better UI, more metadata for its products and to make reviews less scammy.
I asked a question once and now there is a effing alexa for shopping toolbar that takes a quarter of the screen that will not go away no matter how many times I close it, and the space remains taken even if I adblock it. Absolutely hostile implementation. I have words for this I cannot type out.
Because the data, in general, is not included in the LLM model and it needs to search/browse for external information. It cannot look indefinitely so it get the top results from lists, not "evrything".
In the past, people would post advice on how to do something clever and useful yourself. Now, people post suggestions on how to talk out the side of their mouth to coax ther magic-8-ball slop generator to say something useful.
Eh, maybe you should keep both paths. When LLMs eventually crawl the site to feed back to agentic shoppers, maybe they logically follow the more truncated less decorated path.
This is another riff on not embedding a full document, but doing a summarization of the document and embedding the summary for RAG. Nice usecase for high cardinality data!