Scallop – A Language for Neurosymbolic Programming

scallop-lang.org

229 points by andsoitis a month ago


versteegen - a month ago

Wow, I'm currently reading the Scallop paper, so funny to see it posted here!

I really love the concept. This isn't just differentiable neurosymbolic declarative probabilistic programming; Scallop has the flexibility of letting you use various (18 included) or custom provenance semirings to e.g. track "proofs" why a relational fact holds, not just assign it a probability. Sounds cool but I'm still trying to figure out the practicality.

Also worth pointing out that it seems that a lot of serious engineering work has been done on Scallop. It has an interpreter and a JIT compiler down to Rust compiled and dynamically loaded as a Python module.

Because a Scallop program (can be) differentiable it can be used anywhere in an end-to-end learning system, it doesn't have to take input data from a NN and produce your final outputs, as in all the examples they give (as far as I can see). For example you probably could create a hybrid transformer which runs some Scallop code in an internal layer, reading/writing to the residual stream. A simpler/more realistic example is to compute features fed into a NN e.g. an agent's policy function.

The limitation of Scallop is that the programs themselves are human-coded, not learnt, although they can implement interpreters/evaluators (e.g. the example of evaluating expressions).

FloorEgg - a month ago

Ever since I learned about category theory and its relationship with symbolic reasoning I've suspected that AGI will come from elegantly combining symbolic reasoning and probabilistic reasoning. This is the first project I've seen that seems to be positioned that way. Very cool.

xabush - a month ago

How does Scallop scale on large knowledge bases (KBs) for doing probabilistic reasoning? I'm currently working on large KB with ~ 12M facts and trying to do probabilistic inference on it. So far I've been using [cplint](https://friguzzi.github.io/cplint/_build/html/index.html) which is based on SWI-Prolog. It works fine for toy examples, however, it doesn't finish running for the large KB - even after waiting for it for more than a week. Does know any Probabilistic Logic Programming (PLP) libraries that are fast and scale to large KBs? Preferably in Prolog ecosystem, but not a hard requirement.

VinLucero - a month ago

If you like scallop, you are gonna love lobster:

https://liby99.github.io/res/papers/lobster.pdf

light_hue_1 - a month ago

The problem with scallop is that no one has ever shown a single program that wasn't easier to write without it. Their papers usually contain also no examples, and the ones that do are a heck of a lot more complicated than asking the model to do it directly. The programming languages world let's them get away with this because they're excited to be relevant in the LLM universe. But I wouldn't accept any of this work if I was their reviewer; they need to write real programs and compare against baselines. Many of them. And show that their language provides any value.

Just look at the examples on their website. All 3 are lame and far easier without their language.

It's like publishing that you have a new high performance systems language and never including any benchmark. They would be rejected for that. Things just haven't caught up in the ML+PL world.

mark_l_watson - a month ago

I looked at Scallop a year ago and decided that it was not a replacement for Prolog - for me.

I may re-evaluate now, thinking of smoother LLM integration as well as differentiability.

Has anyone here used Scallop for a large application? I ask because in the 1980s I wrote a medium large application in Prolog and it was a nice developer experience.

slopeloaf - a month ago

Love to see this! I’m a huge fan of Neurosymbolic methods, but more advanced examples might be needed to help convince folks to adopt or try Scallop. The three on the page feel very toy. An example rooted in NLP or working with an LLM front and centered might help

Very pleasant branding though. Great work! :)

hnax - a month ago

How does Scallop compare to PyReason (https://neurosymbolic.asu.edu/pyreason/)? Are they by and large the same, or tailored towards different use cases?

- a month ago
[deleted]
JFingleton - a month ago

A bit over my head - but can't Prolog achieve similar results?

meltyness - a month ago

The SCC example is interesting, I wonder what behavior that gens to. Reminds me of Lean, have to suspect it may make the processor quite spicy, like Lean. Also don't see clear indication that this benefits from heterogeneous compute resources.

Oh, boy, it's written in Rust!

LoganDark - a month ago

I wish this website explained what neurosymbolic means.

johnisgood - a month ago

I love its logo (the color scheme, too).

By the way I wish there were more real-life examples, both basic and advanced to show what it may be especially useful for, maybe even compare it to other languages like Prolog. I expected the tutorial to have examples for what "neurosymbolic" means, because I am not entirely sure what it means in practice.

adultSwim - a month ago

Previous discussion a few years ago: https://news.ycombinator.com/item?id=31060265

- a month ago
[deleted]
revalo - a month ago

This is amazing. I've been looking forward to such a thing for a while now.

gregjw - a month ago

I honestly have no idea what any of this means.

It seems like schizo ramblings to me. But I'm sure there's some merit to it.

awestroke - a month ago

Icky name

tempodox - a month ago

The tutorial claims that fib(0) = 1, which is wrong.

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

This one was easy to spot and would have been easy to get right. Makes me wonder…

Xmd5a - a month ago

If you encode a business on top of this, you get differentiable management. Metrics disappear behind obscure activation vectors/embeddings, cargo cult is not possible anymore, everything traced back to measured economic efficiency.

noduerme - a month ago

I'm really confused. Is this metaprogramming in the sense that, add_relation and add_rule are using an LLM to make an educated guess about what to do based on what went before it? Or is it using some deterministic method or heuristic to evaluate those terms?