Hacker Newsnew | past | comments | ask | show | jobs | submit | disambiguation's commentslogin

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

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


> "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.


>> 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.

SLD-Resolution with unification (Prolog's automated theorem proving algorithm) is the polar opposite of brute force: as the proof proceeds, the cardinality of the set of possible answers [1] decreases monotonically. Unification itself is nothing but a dirty hack to avoid having to ground the Herbrand base of a predicate before completing a proof; which is basically going from an NP-complete problem to a linear-time one (on average).

Besides which I find it very difficult to see how a language with an automated theorem prover for an interpreter "doesn't do reasoning". If automated theorem proving is not reasoning, what is?

___________________

[1] More precisely, the resolution closure.


> "as the proof proceeds, the cardinality of the set of possible answers [1] decreases"

In the sense that it cuts off part of the search tree where answers cannot be found?

    member(X, [1,2,3,4]),
    X > 5,
    slow_computation(X, 0.001).
will never do the slow_computation - but if it did, it would come up with the same result. How is that the polar opposite of brute force, rather than an optimization of brute-force?

If a language has tail call optimization then it can handle deeper recursive calls with less memory. Without TCO it would do the same thing and get the same result but using more memory, assuming it had enough memory. TCO and non-TCO aren't polar opposites, they are almost the same.


That's not what I mean. During a resolution-refutation proof, every time a new resolution step is taken, the number of possible subsequent resolution steps either gets smaller or stays the same (i.e. "decreases monotonically"). That's how we know for sure that if the proof is decidable there comes a point at which no more resolution steps are left, and either the empty clause is all that remains, or some non-empty clause remains that cannot be reduced further by resolution.

So basically Resolution gets rid of more and more irrelevant ...stuff as it goes. That's what I mean that it's "the polar opposite of brute force". Because it's actually pretty smart and it avoids doing the dumb thing of having to process all the things all the time before it can reach a conclusion.

Note that this is the case for Resolution, in the general sense, not just SLD-Resolution, so it does not depend on any particular search strategy.

I believe SLD-Resolution specifically (which is the kind of Resolution used in Prolog) goes much faster, first because it's "[L]inear" (i.e. it allows resolution only with the resolvents of the last step) and second because it's restricted to [D]efinite clauses and, as a result, there is only one resolvent at each new step and it's a single Horn goal so the search (of the SLD-Tree) branches in constant time.

Refs:

J. Alan Robinson, "A computer-oriented logic based on the Resolution principle"

https://dl.acm.org/doi/10.1145/321250.321253

2. Robert Kowalski, "Predicate Logic as a Programming Language"

https://www.researchgate.net/publication/221330242_Predicate...


I don't understand (the point of) your example. In all branches of the search `X > 5` will never be `true` so yeah `slow_computation` will not be reached. How does that relate to your point of it being "brute force"

>> but if it did, it would come up with the same result

Meaning either changing the condition or the order of the clauses. How do you expect Prolog to proceed to `slow_computation` when you have declared a statement (X > 5) that is always false before it.


Contrary to what everyone else is saying, I think you're completely correct. Using it for AI or "reasoning" is a hopeless dead end, even if people wish otherwise. However I've found that Prolog is an excellent language for expressing certain types of problems in a very concise way, like parsers, compilers, and assemblers (and many more). The whole concept of using a predicate in different modes is actually very useful in a pragmatic way for a lot of problems.

When you add in the constraint solving extensions (CLP(Z) and CLP(B) and so on) it becomes even more powerful, since you can essentially mix vanilla Prolog code with solver tools.


Prolog was introduced to capture natural language - in a logic/symbolic way that didn't prove as powerful as today's LLM for sure, but this still means there is a large corpus of direct English to Prolog mappings available for training, and also the mapping rules are much more straightforward by design. You can pretty much translate simple sentences 1:1 into Prolog clauses as in the classic boring example

    % "the boy eats the apple"
    eats(boy, apple).
This is being taken advantage of in Prolog code generation using LLMs. In the Quantum Prolog example, the LLM is also instructed not to generate search strategies/algorithms but just planning domain representation and action clauses for changing those domain state clauses which is natural enough in vanilla Prolog.

The results are quite a bit more powerful, close to end user problems, and upward in the food chain compared to the usual LLM coding tasks for Python and JavaScript such as boilerplate code generation and similarly idiosyncratic problems.


"large corpus" - large compared to the amount of Python on Github or the amount of JavaScript on all the webpages Google has ever indexed? Quantum Prolog doesn't have any relevant looking DuckDuckGo results, I found it in an old comment of yours here[1] but the link goes to a redirect which is blocked by uBlock rules and on to several more redirects beyond which I didn't get to a page. In your linked comment you write:

> "has convenient built-in recursive-decent parsing with backtracking built-in into the language semantics, but also has bottom-up parsing facilities for defining operator precedence parsers. That's why it's very convenient for building DSLs"

which I agree with, for humans. What I am arguing is that LLMs don't have the same notion of "convenient". Them dumping hundreds of lines of convoluted 'unreadable' Python (or C or Go or anything) to implement "half of Common Lisp" or "half of a Prolog engine" for a single task is fine, they don't have to read it, and it gets the same result. What would be different is if it got a significantly better result, which I would find interesting but haven't seen a good reason why it would.

[1] https://news.ycombinator.com/item?id=40523633


Its a Horn clause resolver...that's exactly the kind of reasoning that LLMs are bad at. I have no idea how to graft Prolog to an LLM but if you can graft any programming language to it, you can graft Prolog more easily.

Also, that you push Python and JavaScript makes me think you don't know many languages. Those are terrible languages to try to graft to anything. Just because you only know those 2 languages doesn't make them good choices for something like this. Learn a real language Physicist.


> Also, that you push Python and JavaScript

I didn't push them.

> Those are terrible languages to try to graft to anything.

Web browsers, Blender, LibreOffice and Excel all use those languages for embedded scripting. They're fine.

> Just because you only know those 2 languages doesn't make them good choices for something like this.

You misunderstood my claim and are refuting something different. I said there is more training data for LLMs to use to generate Python and JavaScript, than Prolog.


I'm not. Python and JS are scripting languages. And in this case, we want something that models formal logic. We are hammering in a nail, you picked up a screwdriver and I am telling you to use a claw hammer.

What does this comment even mean? A claw hammer? By formal definitions, all 3 languages are Turing complete and can express programs of the same computational complexity.

But we kinda don't use python for a database query over sql do we?

I use an ORM every day.

> Its a Horn clause resolver...that's exactly the kind of reasoning that LLMs are bad at. I have no idea how to graft Prolog to an LLM but if you can graft any programming language to it, you can graft Prolog more easily.

By grafting LLM into Prolog and not other way around ?


No call for talking down at people. No one has ever been convinced by being belittled.

We would begin by having a Prolog server of some kind (I have no idea if Prolog is parallelized but it should very well be if we're dealing with Horn Clauses).

There would be MCP bindings to said server, which would be accessible upon request. The LLM would provide a message, it could even formulate Prolog statements per a structured prompt, and then await the result, and then continue.


What makes you think your brain isn't also brute forcing potential solutions subconciously and only surfacing the useful results?

Because I can solve problems that would take the age of the universe to brute force, without waiting the age of the universe. So can you: start counting at 1, increment the counter up to 10^8000, then print the counter value.

Prolog: 1, 2, 3, 4, 5 ...

You and me instantly: 10^8000


There's a whole lot of undecidable (or effectively undecidable) edge cases that can be adequately covered. As a matter of fact, Decidability Logic is compatible with Prolog.

Can you try calculating 101 * 70 in your head?

I think therefore I am calculator?

I can absolutely try this. Doesn't mean i'll solve it. If i solve it there's no guarantee i'll be correct. Math gets way harder when i don't have a legitimate need to do it. This falls in the "no legit need" so my mind went right to "100 * 70, good enough."

Or you could do (100 + 1)*70 => 100*70 + 1*70

Very easy to solve, just like it is easy to solve many other ones once you know the tricks.

I recommend this book: https://www.amazon.com/Secrets-Mental-Math-Mathemagicians-Ca...


Completely missing the point on purpose?

Elaborate.

you don’t solve it by brute forcing possible solutions until one sticks

Yeah, read it in another comment. Why do you think doing calculations in your head is brute-forcing? Many people can do it flawlessly, without even knowing of these "tricks". They just know. Is that brute-force?

Um, 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?


I think it is very relevant, because no brute-forcing is involved in this solution.

That's not true, the 'brute force' part is searching for a shortcut that works.

The brute force got reduced down to fast heuristics, like Arthur Benjamin's Mathemagics.

It’s almost like you’re proving the point of his reply…

Just intuition ;)

human brains are insanely powerful pattern matching and shortcut-taking machines. There's very little brute forcing going on.

Your second sentence contradicts your first.

Pray tell how it contradicts the first.

Just note: human pattern matching is not Haskell/Erlang/ML pattern matching. It doesn't go [1] through all possible matches of every possible combination of all available criteria

[1] If it does, it's the most powerful computing device imaginable.


I 100% agree with nutjob :|

There are hundreds of trillions of synapses in the brain, and much of what they do (IANANS) could reasonably be described as pattern matching: mostly sitting idle waiting for patterns. (Since dendritic trees perform a lot of computation (for example, combining inputs at each branch), if you want to count the number of pattern matchers in the branch you can't just count neurons. A neuron can recognise more than one pattern.)

So yes, thanks to its insanely parallel architecture, the brain is also an insanely brute force pattern matcher, constantly matching against who knows how many trillions of previously seen patterns. (BTW IMHO this is why LLMs work so well)

(I do recognise the gap in my argument: are all those neurons actually receiving inputs to match against, or are they 'gated'? But we're really just arguing about semantics of applying "brute force", a CS term, to a neural architecture, where it has no definition.)


> [1] If it does, it's the most powerful computing device imaginable.

Well, my brain perhaps. Not sure about the rest of y'all.


Of course it does "reasoning", what do you think reasoning is? From a quick google: "the action of thinking about something in a logical, sensible way". Prolog searches through a space of logical proposition (constraints) and finds conditions that lead to solutions (if one exists).

(a) Trying adding another 100 or 1000 interlocking proposition to your problem. It will find solutions or tell you one doesn't exist. (b) You can verify the solutions yourself. You don't get that with imperative descriptions of problems. (b) Good luck sandboxing Python or JavaScript with the treat of prompt injection still unsolved.


Of course it doesn't "do reasoning", why do you think "following the instructions you gave it in the stupidest way imaginable" is 'obviously' reasoning? I think one definition of reasoning is being able to come up with any better-than-brute-force thing that you haven't been explicitly told to use on this problem.

Prolog isn't "thinking". Not about anything, not about your problem, your code, its implementation, or any background knowledge. Prolog cannot reason that your problem is isomorphic to another problem with a known solution. It cannot come up with an expression transform that hasn't been hard-coded into the interpreter which would reduce the amount of work involved in getting to a solution. It cannot look at your code, reason about it, and make a logical leap over some of the code without executing it (in a way that hasn't been hard-coded into it by the programmer/implementer). It cannot reason that your problem would be better solved with SLG resolution (tabling) instead of SLD resolution (depth first search). The point of my example being pseudo-Python was to make it clear that plain Prolog (meaning no constraint solver, no metaprogramming), is not reasoning. It's no more reasoning than that Python loop is reasoning.

If you ask me to find the largest Prime number between 1 and 1000, I might think to skip even numbers, I might think to search down from 1000 instead of up from 1. I might not come up with a good strategy but I will reason about the problem. Prolog will not. You code what it will do, and it will slavishly do what you coded. If you code counting 1-1000 it will do that. If you code Sieve of Eratosthenes it will do that instead.


The disagreement you have with the person you are relying to just boils down to a difference in the definition of "reasoning."

Its a Horn clause interpreter. Maybe lookup what that is before commenting on it. Clearly you don't have a good grasp of Computer Science concepts or math based upon your comments here. You also don't seem to understand the AI/ML definition of reasoning (which is based in formal logic, much like Prolog itself).

Python and Prolog are based upon completely different kinds of math. The only thing they share is that they are both Turing complete. But being Turing complete isn't a strong or complete mathematical definition of a programming language. This is especially true for Prolog which is very different from other languages, especially Python. You shouldn't even think of Prolog as a programming language, think of it as a type of logic system (or solver).


None of that is relevant.

Even in your example (which is obviously not correct representation of prolog), that code will work X orders magnitude faster and with 100% reliability compared to much more inferior LLM reasoning capabilities.

This is not the point though

Algorithmically there's nothing wrong with using BFS/DFS to do reasoning as long as the logic is correct and the search space is constrained sufficiently. The hard part has always been doing the constraining, which LLMs seem to be rather good at.

> This is not the point though

could you expand what is the point? That authors opinion without much justification is that this is not reasoning?


Everything you've written here is an invalid over-reduction, I presume because you aren't terribly well versed with Prolog. Your simplification is not only outright erroneous in a few places, but essentially excludes every single facet of Prolog that makes it a turing complete logic language. What you are essentially presenting Prolog as would be like presenting C as a language where all you can do is perform operations on constants, not even being able to define functions or preprocessor macros. To assert that's what C is would be completely and obviously ludicrous, but not so many people are familiar enough with Prolog or its underlying formalisms to call you out on this.

Firstly, we must set one thing straight: Prolog definitionally does reasoning. Formal reasoning. This isn't debatable, it's a simple fact. It implements resolution (a computationally friendly inference rule over computationally-friendly logical clauses) that's sound and refutation complete, and made practical through unification. Your example is not even remotely close to how Prolog actually works, and excludes much of the extra-logical aspects that Prolog implements. Stripping it of any of this effectively changes the language beyond recognition.

> Plain Prolog's way of solving reasoning problems is effectively:

No. There is no cognate to what you wrote anywhere in how Prolog works. What you have here doesn't even qualify as a forward chaining system, though that's what it's closest to given it's somewhat how top-down systems work with their ruleset. For it to even approach a weaker forward chaining system like CLIPS, that would have to be a list of rules which require arbitrary computation and may mutate the list of rules it's operating on. A simple iteration over a list testing for conditions doesn't even remotely cut it, and again that's still not Prolog even if we switch to a top-down approach by enabling tabling.

> You hard code some options

A Prolog knowledgebase is not hardcoded.

> write a logical condition with placeholders

A horn clause is not a "logical condition", and those "placeholders" are just normal variables.

> and Prolog brute-forces every option in every placeholder.

Absolutely not. It traverses a graph proving things, and when it cannot prove something it backtracks and tries a different route, or otherwise fails. This is of course without getting into impure Prolog, or the extra-logical aspects it implements. It's a fundamentally different foundation of computation which is entirely geared towards formal reasoning.

> And that might have been nice compared to Pascal in 1975, it's not so different to modern garbage collected high level scripting languages.

It is extremely different, and the only reason you believe this is because you don't understand Prolog in the slightest, as indicated by the unsoundness of essentially everything you wrote. Prolog is as different from something like Javascript as a neural network with memory is.


The original suggestion was that LLMs should emit Prolog code to test their ideas. My reply was that there is nothing magic in Prolog which would help them over any other language, but there is something in other languages which would help them over Prolog - namely more training data. My example was to illustrate that, not to say Prolog literally is Python. Of course it's simplified to the point of being inaccurate, it's three lines, how could it not be.

> "A Prolog knowledgebase is not hardcoded."

No, it can be asserted and retracted, or consult a SQL database or something, but it's only going to search the knowledge the LLM told it to - in that sense there is no benefit to an LLM to emit Prolog over Python since it could emit the facts/rules/test cases/test conditions in any format it likes, it doesn't have any attraction to concise, clean, clear, expressive, output.

> "those "placeholders" are just normal variables"

Yes, just normal variables - and not something magical or special that Prolog has that other languages don't have.

> "Absolutely not. It traverses a graph proving things,"

Yes, though, it traverses the code tree by depth first walk. If the tree has no infinite left-recursion coded in it, that is a brute force walk. It proves things by ordinary programmatic tests that exist in other languages - value equality, structure equality, membership, expression evaluation, expression comparison, user code execution - not by intuition, logical leaps, analogy, flashes of insight. That is, not particularly more useful than other languages which an LLM could emit.

> "Your example is not even remotely close to how Prolog actually works"

> "There is no cognate to what you wrote anywhere in how Prolog works"

> "It is extremely different"

Well:

    parent(timmy, sarah).
    person(brian).
    person(anna).
    person(sarah).
    person(john).

    ?- person(X), writeln(X), parent(timmy, X).

    brian
    anna
    sarah
    X = sarah
That's a loop over the people, filling in the variable X. Prolog is not looking at Ancestry.com to find who Timmy's parents are. It's not saying "ooh you have a SQLite database called family_tree I can look at". That it's doing it by a different computational foundation doesn't seem relevant when that's used to give it the same abilities.

My point is that Prolog is "just" a programming language, and not the magic that a lot of people feel like it is, and therefore is not going to add great new abilities to LLMs that haven't been discovered because of Prolog's obscurity. If adding code to an LLM would help, adding Python to it would help. If that's not true, that would be interesting - someone should make that case with details.

> "and the only reason you believe this is because you don't understand Prolog in the slightest"

This thread would be more interesting to everybody if you and hunterpayne would stop fantasizing about me, and instead explain why Prolog's fundamentally different foundation makes it a particularly good language for LLMs to emit to test their other output - given that they can emit virtually endless quantities of any language, custom writing any amount of task-specific code on the fly.


This is a philosophical argument.

The way to look at this is first to pin down what we mean when we say Human Commonsense Reasoning (https://en.wikipedia.org/wiki/Commonsense_reasoning). Obviously this is quite nebulous and cannot be defined precisely but OG AI researchers have a done a lot to identify and formalize subsets of Human Reasoning so that it can be automated by languages/machines.

See the section Successes in automated commonsense reasoning in the above wikipedia page - https://en.wikipedia.org/wiki/Commonsense_reasoning#Successe...

Prolog implements a language to logically interpret only within a formalized subset of human reasoning mentioned above. Now note that all our scientific advances have come from our ability to formalize and thus automate what was previously only heuristics. Thus if i were to move more of real-world heuristics (which is what a lot of human reasoning consists of) into some formal model then Prolog (or say LLMs) can be made to better reason about it.

See the paper Commonsense Reasoning in Prolog for some approaches - https://dl.acm.org/doi/10.1145/322917.322939

Note however the paper beautifully states at the end;

Prolog itself is all form and no content and contains no knowledge. All the tasks, such as choosing a vocabulary of symbols to represent concepts and formulating appropriate sentences to represent knowledge, are left to the users and are obviously domain-dependent. ... For each particular application, it will be necessary to provide some domain-dependent information to guide the program writing. This is true for any formal languages. Knowledge is power. Any formalism provides us with no help in identifying the right concepts and knowledge in the first place.

So Real-World Knowledge encoded into a formalism can be reasoned about by Prolog. LLMs claim to do the same on unstructured/non-formalized data which is untenable. A machine cannot do "magic" but can only interpret formalized/structured data according to some rules. Note that the set of rules can be dynamically increased by ML but ultimately they are just rules which interact with one another in unpredictable ways. Now you can see where Prolog might be useful with LLMs. You can impose structure on the view of the World seen by the LLM and also force it to confine itself only to the reasoning it can do within this world-view by asking it to do predominantly Prolog-like reasoning but you don't turn the LLM into just a Prolog interpreter. We don't know how it interacts with other heuristics/formal reasoning parts (eg. reinforcement learning) of LLMs but does seem to give better predictable and more correct output. This can then be iterated upon to get a final acceptable result.

PS: You might find the book Thinking and Deciding by Jonathan Baron useful for background knowledge - https://www.cambridge.org/highereducation/books/thinking-and...


We'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/8...


The next step is can in solve the Wicked Problems

https://en.wikipedia.org/wiki/Wicked_problem


There are people working on integration deep learning with symbolic AI (but I don't know more)

IIRC 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).

Not 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...


Please tell me that's approximately what Palantir Ontology is, because if it isn't, I've no idea what it could be.


Prolog 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.


It'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.

No 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).


That you haven’t met any webdevs using prolog probably is because 1) prolog is a very rare language among devs in general not just webdevs (unless you count people that did prolog in a course 20 years ago and remember nothing) 2) prolog just isn’t that focused on webdev (like saying ”not many embedded devs know react so I guess it is because react is too hard for them”)

Maybe they were, but these days everything must be in JS syntax. Even if it is longer than pure CSS, they want the CSS inside JS syntax. They are only ultimate polyglot as long as all the languages are actually JS.

(Of course this is an overgeneralization, since obviously, there are web developers, who do still remember how to do things in HTML, CSS and, of course JS.)


I have the complete opposite view of web developers. :)

Maybe the ones these days are different. I left the field probably 15 years ago.

>>Prolog doesn't look like javascript or python so:

Think of this way. In Python and Javascript you write code, and to test if its correct you write unit test cases.

A prolog program is basically a bunch of test cases/unit test cases, you write it, and then tell the Prolog compiler, 'write code, that passes these test cases'.

That is, you are writing the program specification, or tests that if pass would represent solution to the problem. The job of the compiler to write the code that passes these test cases.


As 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.

I 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


Related: LLMs trained on "A is B" fail to learn "B is A"

https://arxiv.org/abs/2309.12288


Wouldn’t that be like a special case of neuro-symbolic programming?! There are plenty of research going on

Can'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.

There'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.

I think prolog is the right format to codify expertise in Claude Skills. I just haven’t tested it yet.

If you are looking for AGI. And you understand what is going on inside of it - then it is obviously not AGI.

You 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/

@goblinqueen, you around?

@YeGoblynQueenne Dunno if it will ping the person

It doesn't, but I found the thread anyway :)

I think that's what these guys are doing

https://www.symbolica.ai/


YES! 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/ and see if it runs.

> LLMs are bad at counting the number of r's in strawberry.

This is a tokenization issue, not an LLM issue.



# Encrypt a file openssl enc -aes-256-cbc -salt -in secret.txt -out secret.enc

# Decrypt openssl enc -d -aes-256-cbc -in secret.enc -out secret.txt

Wow that was hard.


You may think you're being sarcastic, but you are just stating a true fact here. For about 99.9% of this planet's population, it's not just hard, it's something they'd never ever know how to do and have no intention to ever learn. Like it or hate it, but that's what it is.

And, for 99.9% of people who know how to do that, they'd still be too lazy to do it properly (hint: where do you keep secret.txt exactly? What happens if your dog eats it?) and will use some third-party solution instead.


> where do you keep secret.txt

Reminds me of using Ansible Vault and preciously encrypting every secret (so we can say that repos doesn't contain any secrets), then just putting ~/.vault_pass in plaintext on every Ansible controller to be taken by anyone with access to the servers.


The author of AGE has a great point in the below blog post [0]:

    If you use something like SOPS or just check age secrets into a git repository next to source code, you need an authentication story for the whole repository. Having authentication for the secrets will do nothing if the attacker can change the source code that decrypts and uses them.

    That story can simply be “we trust GitHub” like most projects. Encrypting secrets with age will keep them confidential even if the project is Open Source, and anyone wanting to replace them will have to make a PR even if they can generate a new valid age file.
0 - https://words.filippo.io/age-authentication/

>where do you keep secret.txt exactly?

Hidden. Encrypted. And the passphrase is: at 5,21 which is the 5th line on page 21 of your favorite book. Which you have more than one copy of, because you like it that much. And you need copies to lend. Or you have the PDF from Gutenberg.org?

And 5/21 might be the birthday of your first child, or your wedding day, or whatever?

It might be a favorite quote, like "Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety." Augmented by the above date if needed?


Hidden where? Are you writing it on a post-it and putting it on top of your screen? Are you keeping it in your wallet? In a safe? What if you lose it or your house is flooded?

> And 5/21 might be the birthday of your first child, or your wedding day, or whatever?

How sure are you that you'd remember all that scheme for 20 years? How about 50 years? Some documents may be relevant for a very long time. What about if you need more than one key? What about if you need to give access to one document to specific set of persons?

Once you consider all the scenarios that can happen through a lifetime, you start to understand why managing all those complexities correctly is not trivial. And that's why people pay third parties to do it for them. It's not because encrypting a bag of bytes is hard. It's because of all the things that surround it.


A post it with master password on the fridge seems much safer to me than simple repeatedly used passwords. Computer can get hacket but the post it on the fridge is harder to hack.

> And the passphrase is: at 5,21 which is the 5th line on page 21 of your favorite book

Yeah, it's one of those things that you'll forget in N years. That's exactly what prompted "where do you keep secret.txt" question.


Some people are lucky with memory that works extremely well with numbers. My memory is average but when it comes to numbers, I remember serial numbers of certain products, enrollment numbers etc from more than a decade ago.

HP-L170 (A monitor I bought) QW4HD-DQCRG-HM64M-6GJRK-8K83T (Windows XP key) 10396-9 (My enrollment number for board exam)

I remember a bunch of long-ago-abandoned phone numbers as well.


I could probably remember one or two things like that key, but retaining it over the years would be questionable... I used some of my favorite quotes as the passphrases for some of my crypto wallets, and once spent an annoying week when it turned out I misremembered one of them and lost access to some bitcoin. Not a huge value - it's about $1k worth now - but still unpleasant, and I had to spend quite some time figuring out how to recover it (fortunately, it worked). So since then I'm more careful about "I'll surely remember it" thing.

>>My memory is average but when it comes to numbers...

Where I live, memorizing a 25 char alphanumeric is not average. It's not more, either.


As of now I have to care for my (digital) backups, that is, I cannot ignore them for N years. I had to copy things from discettes to magnetic tape, from tape to hard drives, etc. I have to periodically check my backups if they are restorable. That's life.

It's the same for documents, as for secrets, which I have to transfer from one medium to another, I have to check that I remember secrets and passphrases. And places. As I already said, that's life.


You can also choose to let it die, or get forgotten.

> it's something they'd never ever know how to do

There are hundreds of millions of people who have memorized megabytes of baseball statistics, pop song lyrics, celebrity relationship trivia, vehicle model data, sitcom character biographies, comic book plots, makeup shades, travel routes, mixed drink recipes, MtG card modifiers, etc.

At a certain point, one has to realize that pulling the "normie card" is not a viable excuse, given the wide array of knowledge that humans routinely pack into their brains.


The double entendre occurred to me, I don't disagree.

But the relative ease does not merely apply to users, but to the barrier of entry for alt products as well.

Consider that the current paradigm is contingent on the "blind trust" users have held in tech for a long time. It's possible that a new kind of app will thrive in a different paradigm.

For example, is there any reason we couldn't have a simple "message wrapper" which only sends encrypted payloads via SMS or Email and decrypts on the fly in a secure sandbox? Easy for the user and hard to regulate.


I think that's what Silence was (for SMS): https://f-droid.org/packages/org.smssecure.smssecure/

I'm reminded of the infamous HN Dropbox comment.


Yeesh, this seems like a good example of the fact that a feature (encrypting a file) is not a product (an E2E encrypted storage solution.)

And you trust openssl to not have a backdoor or flaw because?

Nice.

Now explain how my mum can select that in settings of her phone, thx.


Re: rubber hose attack on cryptography.

Threat modeling is important of course. The UK government does have tools with which to punish people who don't turn over the cleartext of targeted documents once it's directly investigating them, but that's not scalable. The method the grandparent comment proposes greatly reduces one's exposure to mass surveillance, criminals, and abusive service providers.

Wow am I reading this correctly? To recap:

- They're going to run Zuck for president to beat the millennial socialist zeitgeist.

- They're going to use generational warfare to stage an institutional coup.

> we need to do better than simply dismiss them by saying that they are stupid or entitled or brainwashed

Classy.


I did not get him running for president from this. Which part made you think that?

Granted I'm taking creative liberties reading between the lines and mapping to other context. I'd give it low odds overall, but I'm gleaning a non-zero likelihood worthy of consideration:

1. "Mark Zuckerberg has been cast as the spokesman for the Millennial generation."

2. "I am the most well-known person of my generation"

3. "we'll even see a millennial president within the next few cycles by 2032."

4. The direct comparison to Pete Buttigieg.

5. He's signaled a presidential bid in the recent past.

https://www.buzzfeednews.com/article/alexkantrowitz/mark-zuc...

Some additional interpretation of mine from the exchange:

6. The expressed need to "win" in the policy arena in the next few years.

7. The imminent "transfer of value" (and power) from boomers to millennials, and the explicit urgency and intent to "position" themselves to capitalize on this "rapid shift."

Further real world context:

8. Thiel's track record of hands on political involvement with Trump, Vance, and Yarvin.

9. Thiel's recent "antichrist" lectures which articulates a fear of being "scapegoated."


Please point me to the above quotes in the emails.

https://fred.stlouisfed.org/series/LNS14000024

With the exception of COVID, nearly every small uptick is followed by a large uptick.


>nearly every small uptick is followed by a large uptick.

I'm not really seeing it aside from "there's a large uptick because there's eventually a recession".


To rephrase, the start of a large uptick looks like a small one in real time - like we see now.

Further, the graph is otherwise smooth. We don't really see small bumps - 1 or 2 exceptions not reassuring.


So the author just has to wait 4-9 years and everything will be OK?


I've only used it once before, not as unit testing, but as stress testing for a new customer facing api. I wanted to say with confidence "this will never throw an NPE". Also the logic was so complex (and the deadline so short) the only reasonable way to test was to generate large amounts of output data and review it manually for anomalies.

Yes, mainly because of upvotes.

Back when voting systems were fairly new to the social web, there was a lot of resistance for this reason. Now its become the norm.


I recently found this blog post about an effective DIY air filter - explicitly filters pm2.5

https://chillphysicsenjoyer.substack.com/p/measuring-my-diy-...

I built one (< $50) and I'm pretty happy with the results. As someone with a life long sensitivity to air quality, the air definitely feels cleaner.


You really don't need to DIY unless you really want to. My non-DIY mass produced air filter from Home Depot can filter PM2.5 too.

Different strokes. I've been disappointed by every commercial air purifier I've ever bought - expensive and unreliable.

The blog is persuasive and provides a full air quality analysis. It's cheap and effective, a potent combination.


Not my build and not coding, but I've seen some experimental builds (oss 20b on a 32gb mac mini) with Kiwix integration to make what is essentially a highly capable local private search engine.

Any resources you can share for these experimental builds? This is something I was looking into setting up at some point. I'd love to take a look at examples in the wild to gauge if it's worth my time / money.

An aside, if we ever reach a point where it's possible to run an OSS 20b model at reasonable inference on a Macbook Pro type of form factor, then the future is definitely here!


In reference to this post i saw a few weeks ago:

https://lemmy.zip/post/50193734

(Lemmy is a reddit style forum)

The author mainly demos their "custom tools" and doesn't elaborate further. But IMO is still an impressive showcase for an offline setup.

I think the big hint is "open webui" which supports native function calls.

Some more searching and i found this: https://pypi.org/project/llm-tools-kiwix/

It's possible the future is now.. assuming you have an M series with enough RAM. My sense is that you need ~1gb of RAM for every 1b paramters, so 32gb should in theory work here. I think macs also get a performance boost over other hardware due to unified memory.

Spit balling aside, I'm in the same boat, saving my money, waiting for the right time. If it isn't viable already its damn close.


It seems like the ecosystem around these tools has matured quite rapidly. I am somewhat familiar with Open WebUI, however, the last time I played around with it, I got the sense that it was merely a front-end to Ollama, the llm command line tool & it didn't have any capabilities outside of that.

I got spooked when the Ollama team started monetizing so I ended up doing more research into llama.cpp and realized it could do everything I wanted including serve up a web front end. Once I discovered this I sort of lost interest in Open WebUI.

I'll have to revisit all these tools again to see what's possible in the current moment.

> My sense is that you need ~1gb of RAM for every 1b paramters, so 32gb should in theory work here. I think macs also get a performance boost over other hardware due to unified memory.

This is a handy heuristic to work with, and the links you sent will keep me busy for the next little while. Thanks!


Surely the overlap between people with both the wealth and the preference for industrial machinery remote controlled by an underpaid worker from the Philippines in their house (around their children) over an organic house keeper is vanishingly thin, no?

The total addressable market for giant fighting robots on the other hand...


>by an underpaid worker from the Philippines in their house (around their children)

I think that it's hilarious (in a grim way) that we got this thing : a 30kg robot with no proven reliability performing dynamic/active balancing at all times and everyone jumps to the fear of 'The Scary Foreigner' rather than the fact that this actively power-damp'd mass is actively trying to fall backwards or forwards, being held together by whatever control loop, onto your toddler or pet.

A single non-redundant power-failure is orders of a scarier proposition to me than a foreigner with a bad attitude : you can fix that with management and action auditing , more than a single person in the loop, etc. You can't fix the future awaiting technical failure.

We still haven't fixed bad technicals in any industry yet -- we occasional get bad planes delivered to customers. We have technical failures in pacemakers.


Sorry that's not what i was trying to convey, but rather the elaborate loop hole to exploit cheap off shore labor over domestic workers. And yeah to your point about bad technical, plus my focus on the high powered hardware, all add up to legitimate safety concerns.


Gen x will never miss an opportunity to preach.


I cannot legally get a Philippine worker in my house at a price I could afford. Well I haven't checked on the exact immigration rules, but I don't have to bother to tell you that I can't get one that is enough underpaid that I could afford one. There evidence that elsewhere in the world people with similar wealth to mine have them, but they are not available in the US. I don't care who does the work so long as I can afford it and it is legal - which rules out slaves.

For purpose of this discussion I'm ignoring ethics (other than slaves and there I resorted to legal concerns to sidestep the issue) - If it was possible for me to get an affordable human in my house I would no longer be able to ignore those issues.


Yes, it is thin... and stop calling me Shirley.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: