6 ms·
I am once again shilling the idea that someone should find a way to glue Prolog and LLMs together for better reasoning agents. https://news.ycombinator.com/con
by disambiguation 10mo ago
I am once again shilling the idea that someone should find a way to glue Prolog and LLMs together for better reasoning agents.
https://news.ycombinator.com/context?id=43948657 https://news.ycombinator.com/context?id=43948657
Thesis:
1. LLMs are bad at counting the number of r's in strawberry.
2. LLMs are good at writing code that counts letters in a string.
3. LLMs are bad at solving reasoning problems.
4. Prolog is good at solving reasoning problems.
5. ???
6. LLMs are good at writing prolog that solves reasoning problems.
Common replies:
1. The bitter lesson.
2. There are better solvers, ex. Z3.
3. Someone smart must have already tried and ruled it out.
Successful experiments:
1. https://quantumprolog.sgml.net/llm-demo/part1.html https://quantumprolog.sgml.net/llm-demo/part1.html
- jnpnj 10mo agoCan't find the links right now, but there were some papers on llm generating prolog facts and queries to ground the reasoning part. Somebody else might have them around.
- AlanYx 10mo agoThere's a lot of work in this area. See e.g., the LoRP paper by Di et al. There's also a decent amount of work on the other side too, i.e., using LLMs to convert Prolog reasoning chains back into natural language.
- schmuhblaster 10mo agoThis is my own recent attempt at this: https://news.ycombinator.com/item?id=45937480 https://news.ycombinator.com/item?id=45937480 The core idea of DeepClause is to use a custom Prolog-based DSL together with a metainterpreter implemented in Prolog that can keep track of execution state and implicitly manage conversational memory for an LLM. The DSL itself comes with special predicates that are interpreted by an LLM. "Vague" parts of the reasoning chain can thus be handed off to a (reasonably) advanced LLM. Would love to collect some feedback and interesting ideas for possible applications.
- naasking 10mo ago> LLMs are bad at counting the number of r's in strawberry. This is a tokenization issue, not an LLM issue.
- f1shy 10mo agoWouldn’t that be like a special case of neuro-symbolic programming?! There are plenty of research going on
- jodrellblank 10mo ago> "4. Prolog is good at solving reasoning problems." Plain Prolog's way of solving reasoning problems is effectively: for person in [martha, brian, sarah, tyrone]: if timmy.parent == person: print "solved!" You hard code some options, write a logical condition with placeholders, and Prolog brute-forces every option in every placeholder. It doesn't do reasoning. Arguably it lets a human express reasoning problems better than other languages by letting you write high level code in a declarative way, instead of allocating memory and choosing data types and initializing linked lists and so on, so you can focus on the reasoning, but that is no benefit to an LLM which can output any language as easily as any other. And that might have been nice compared to Pascal in 1975, it's not so different to modern garbage collected high level scripting languages. Arguably Python or JavaScript will benefit an LLM most because there are so many training examples inside it, compared to almost any other langauge.
- disambiguation 10mo agoThis sparked a really fascinating discussion, I don't know if anyone will see this but thanks everyone for sharing your thoughts :) I understand your point - to an LLM there's no meaningful difference between once turing complete language and another. I'll concede that I don't have a counter argument, and perhaps it doesn't need to be prolog - though my hunch is that LLM's tend to give better results when using purpose built tools for a given type of problem. The only loose end I want to address is the idea of "doing reasoning." This isn't an AGI proposal (I was careful to say "good at writing prolog") just an augmentation that (as a user) I haven't yet seen applied in practice. But neither have I seen it convincingly dismissed. The idea is the LLM would act like an NLP parser that gradually populates a prolog ontology, like building a logic jail one brick at a time. The result would be a living breathing knowledge base which constrains and informs the LLM's outputs. The punchline is that I don't even know any prolog myself, I just think it's a neat idea.
- nuc1e0n 10mo agoWhat makes you think your brain isn't also brute forcing potential solutions subconciously and only surfacing the useful results?
- lynndotpy 10mo agoAs someone who did deep learning research 2017-2023, I agree. "Neurosymbolic AI" seems very obvious, but funding has just been getting tighter and more restrictive towards the direction of figuring out things that can be done with LLMs. It's like we collectively forgot that there's more than just txt2txt in the world.
- rramadass 10mo agoYou might find Eugene Asahara's detailed Prolog in the LLM Era series of about a dozen blog posts very useful - https://eugeneasahara.com/category/prolog-in-the-llm-era/ https://eugeneasahara.com/category/prolog-in-the-llm-era/
- hacker_homie 10mo agoProlog doesn't look like javascript or python so: 1. web devs are scared of it. 2. not enough training data? I do remember having to wrestle to get prolog to do what I wanted but I haven't written any in ~10 years.
- jm4 10mo agoIt's been a while since I have done web dev, but web devs back then were certainly not scared of any language. Web devs are like the ultimate polyglots. Or at least they were. I was regularly bouncing around between a half dozen languages when I was doing pro web dev. It was web devs who popularized numerous different languages to begin with simply because delivering apps through a browser allowed us a wide variety of options.
- johnisgood 10mo agoI have the complete opposite view of web developers. :)
- jm4 10mo agoMaybe the ones these days are different. I left the field probably 15 years ago.
- hunterpayne 10mo agoNo web dev I have ever met could use Prolog well. I think your statement about web devs being polyglots is based upon the fact that web devs chase every industry fad. I think that has a lot to do with the nature and economics of web dev work (I'm not blaming the web devs for this). I mean the best way to succeed as a webdev is to write your own version of a framework that does the same thing as the last 10 frameworks but with better buzzword marketing. Generally speaking, all the languages they know are pretty similar to each other. Bolting on lambdas isn't the same as doing pure FP. Also, anytime a problem comes up where you would actually need a weird language based upon different math, those problems will be assigned to some other kind of developer (probably one with a really strong CS background).
- Avicebron 10mo ago@goblinqueen, you around?
- lkuty 10mo ago@YeGoblynQueenne Dunno if it will ping the person
- YeGoblynQueenne 10mo agoIt doesn't, but I found the thread anyway :)
- nextos 10mo agoWe've done this, and it works. Our setup is to have some agents that synthesize Prolog and other types of symbolic and/or probabilistic models. We then use these models to increase our confidence in LLM reasoning and iterate if there is some mismatch. Making synthesis work reliably on a massive set of queries is tricky, though. Imagine a medical doctor or a lawyer. At the end of the day, their entire reasoning process can be abstracted into some probabilistic logic program which they synthesize on-the-fly using prior knowledge, access to their domain-specific literature, and observed case evidence. There is a growing body of publications exploring various aspects of synthesis, e.g. references included in [1] are a good starting point. [1] https://proceedings.neurips.cc/paper_files/paper/2024/file/820c61a0cd419163ccbd2c33b268816e-Paper-Conference.pdf https://proceedings.neurips.cc/paper_files/paper/2024/file/8...
- whattheheckheck 10mo agoThe next step is can in solve the Wicked Problems https://en.wikipedia.org/wiki/Wicked_problem https://en.wikipedia.org/wiki/Wicked_problem
- marcelr 10mo agoyes
- bobbylarrybobby 10mo agoIIRC IBM’s Watson (the one that played Jeopardy) used primitive NLP (imagine!) to form a tree of factual relations and then passed this tree to construct Prolog queries that would produce an answer to a question. One could imagine that by swapping out the NLP part with an LLM, the model would have 1. a more thorough factual basis against which to write Prolog queries and 2. a better understanding of the queries it should write to get at answers (for instance, it may exploit more tenuous relations between facts than primitive NLP).
- baq 10mo agoPlease tell me that's approximately what Palantir Ontology is, because if it isn't, I've no idea what it could be.
- UltraSane 10mo agohttps://www.palantir.com/docs/foundry/ontology/overview/ https://www.palantir.com/docs/foundry/ontology/overview/
- YeGoblynQueenne 10mo agoNot so "primitive" NLP. Watson started with what its team called a "shallow parse" of a sentence using a dependency grammar and then matched the parse to an ontology consisting of good, old fashioned frames [1]. That's not as "advanced" as an LLM but far more reliable. I believe the ontology was indeed implemented in Prolog but I forget the architecture details. ______________ [1] https://en.wikipedia.org/wiki/Frame_(artificial_intelligence) https://en.wikipedia.org/wiki/Frame_(artificial_intelligence...
- mindcrime 10mo agoI am once again shilling the idea that someone should find a way to glue Prolog and LLMs together for better reasoning agents. There are definitely people researching ideas here. For my own part, I've been doing a lot of work with Jason[1], a very Prolog like logic language / agent environment with an eye towards how to integrate that with LLMs (and "other"). Nothing specific / exciting to share yet, but just thought I'd point out that there are people out there who see potential value in this sort of thing and are investigating it. [1]: https://github.com/jason-lang/jason https://github.com/jason-lang/jason
- Gormisdomai 10mo agoRelated: LLMs trained on "A is B" fail to learn "B is A" https://arxiv.org/abs/2309.12288 https://arxiv.org/abs/2309.12288
- cpill 10mo agoYES! I've run a few experiments on classical logic problems and an LLM can spit out Prolog programs to solve the puzzel. Try it yourself, ask an LLM to write some prolog to solve some problem and then copy paste it to https://swish.swi-prolog.org/ https://swish.swi-prolog.org/ and see if it runs.
- chvid 10mo agoIf you are looking for AGI. And you understand what is going on inside of it - then it is obviously not AGI.
- IshKebab 10mo agoI think that's what these guys are doing https://www.symbolica.ai/ https://www.symbolica.ai/
- fudged71 10mo agoI think prolog is the right format to codify expertise in Claude Skills. I just haven’t tested it yet.
- poulpy123 10mo agoThere are people working on integration deep learning with symbolic AI (but I don't know more)
- alfonsodev 10mo agoI've been thinking a lot about this, and I want to build the following experiment, in case anyone is interested: The experiment is about putting an LLM to play plman[0] with and without prolog help. plman is a pacman like game for learning prolog, it was written by profesor Francisco J. Gallego from Alicante University to teach logic subject in computer science. Basically you write solution in prolog for a map, and plman executes it step by step so you can see visually the pacman (plman) moving around the maze eating and avoiding ghost and other traps. There is an interesting dynamic about finding keys for doors and timing based traps. There are different levels of complexity, and you can also write easily your maps, since they are just ascii characters in a text file. I though this was the perfect project to visually explain my coworkers the limit of LLM "reasoning" and what is symbolic reasoning. So far I hooked ChatGPT API to try to solve scenarios, and it fails even with substancial amount of retries. That's what I was expecting. The next thing would be to write a mcp tool so that the LLM can navigate the problem by using the tool, but here is where I need guidance. I'm not sure about the best dynamic to prove the usefulness of prolog in a way that goes beyond what context retrieval or db query could do. I'm not sure if the LLM should write the prolog solution. I want to avoid to build something trivial like the LLM asking for the steps, already solved, so my intuition is telling me that I need some sort of virtual joystick mcp to hide prolog from the LLM, so the LLM could have access to the current state of the screen, and questions like what would be my position if I move up ? What's the position of the ghost in next move ? where is the door relative to my current position ? I don't have academic background to design this experiment properly. Would be great if anyone is interested to work together on this, or give me some advice. Prior work pending on my reading list: - LoRP: LLM-based Logical Reasoning via Prolog [1] - A Pipeline of Neural-Symbolic Integration to Enhance Spatial Reasoning in Large Language Models [2] - [0] https://github.com/Matematicas1UA/plman/blob/master/README.md https://github.com/Matematicas1UA/plman/blob/master/README.m... - [1] https://www.sciencedirect.com/science/article/abs/pii/S0950705125011815 https://www.sciencedirect.com/science/article/abs/pii/S09507... - [2] https://arxiv.org/html/2411.18564v1 https://arxiv.org/html/2411.18564v1