17 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 11mo 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
- naasking 11mo ago> LLMs are bad at counting the number of r's in strawberry. This is a tokenization issue, not an LLM issue.
- f1shy 11mo agoWouldn’t that be like a special case of neuro-symbolic programming?! There are plenty of research going on
- jodrellblank 11mo 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.
- nuc1e0n 11mo agoWhat makes you think your brain isn't also brute forcing potential solutions subconciously and only surfacing the useful results?
- mkirsten 11mo agoCan you try calculating 101 * 70 in your head?
- hacker_homie 11mo agoI think therefore I am calculator?
- ang_cire 11mo agoUm, that's really easy to do in your head, there's no carrying or anything? 7,070 7 * 101 = 707 * 10 = 7,070 And computers don't brute-force multiplication either, so I'm not sure how this is relevant to the comment above?
- polotics 11mo agoI think it is very relevant, because no brute-forcing is involved in this solution.
- nutjob2 11mo agoThat's not true, the 'brute force' part is searching for a shortcut that works.
- numpy-thagoras 11mo agoThe brute force got reduced down to fast heuristics, like Arthur Benjamin's Mathemagics.
- jabbywocker 11mo ago
- lynndotpy 11mo 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.
- hacker_homie 11mo 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 11mo 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 11mo agoI have the complete opposite view of web developers. :)
- jm4 11mo agoMaybe the ones these days are different. I left the field probably 15 years ago.
- hunterpayne 11mo 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).
- rramadass 11mo 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/
- Avicebron 11mo ago@goblinqueen, you around?
- lkuty 11mo ago@YeGoblynQueenne Dunno if it will ping the person
- YeGoblynQueenne 11mo agoIt doesn't, but I found the thread anyway :)
- nextos 11mo 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 11mo 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 11mo agoyes
- bobbylarrybobby 11mo 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 11mo agoPlease tell me that's approximately what Palantir Ontology is, because if it isn't, I've no idea what it could be.
- UltraSane 11mo agohttps://www.palantir.com/docs/foundry/ontology/overview/ https://www.palantir.com/docs/foundry/ontology/overview/
- YeGoblynQueenne 11mo 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...
- jnpnj 11mo 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 11mo 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.
- mindcrime 11mo 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 11mo 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 11mo 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 11mo agoIf you are looking for AGI. And you understand what is going on inside of it - then it is obviously not AGI.
- IshKebab 11mo agoI think that's what these guys are doing https://www.symbolica.ai/ https://www.symbolica.ai/
- fudged71 11mo agoI think prolog is the right format to codify expertise in Claude Skills. I just haven’t tested it yet.
- poulpy123 11mo agoThere are people working on integration deep learning with symbolic AI (but I don't know more)
- alfonsodev 11mo 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
- schmuhblaster 11mo 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.