HackerTrans
TopNewTrendsCommentsPastAskShowJobs

kenerwin88

no profile record

Submissions

Show HN: LogicPearl – Synthesizing deterministic executable logic from traces

github.com
4 points·by kenerwin88·3개월 전·4 comments

comments

kenerwin88
·3개월 전·discuss
This is such weird timing, for the last few weeks I’ve been messing around with Z3 and other solvers for the first time and they’re so cool. In many ways more magical than LLMs to me in some ways. Great intro!
kenerwin88
·3개월 전·discuss
thank you very much!! :). Let me know if you run into any issues if you test it out on anything!
kenerwin88
·3개월 전·discuss
TLDR: If you take the inputs and outputs of a system, pass them to LogicPearl, it will figure out the logic & rules automatically, giving you a deterministic, more easily human readable, replacement executable artifact. You can use it to distill the behavior of legacy codebases, or replace probabilistic LLM prompts with a 0-token, very fast portable WASM artifact (or native binary, or if someone wants a diff format tell me, but it’s still going to be a bitmask underneath).

It works really well for systems where the inputs are known, the possible outcomes are known, and given an input, you want to always get the same result AND know why. Which isn’t every system, but I think it’s a lot more than I even realize.

Oddly it doesn’t depend on AI, which is an odd thing to build at the moment. However, aside from existing systems, it also seems to work really well when you couple it with an LLM to generate synthetic traces (or ingesting data that you’d normally store in a RAG). From those, you distill the logic into something deterministic, repeatable, and improvable. And the nicest part is once you have the logic saved, you can reuse it without ever needing to call the LLM again. The behavior itself is stored in very human readable rules, so if you want to change it, the diff is very easy to understand.

It’s kind of hard to explain without an example. The best one I have is a real life use case. One of my friends/mentors unfortunately was recently diagnosed with a Glioblastoma, and over the last month or so I’ve learned that cancer is so unique per person in a ton of different ways. He had his removed, the genome of it mapped, and I asked him if I could try to help find medical trials for him. It turns out EVERY clinical trial is available via API (which is amazing!!), so I downloaded them (579,831, counting completed trials not just open, and 67,918 research papers). The next step normally I’d grep, filter, write a bunch of code etc. Instead, I used 25 features (the unique inputs, in this case that’s the genomics, demographics, HLA type, methylation type, medications, history, etc.), and ran it through logicpearl so it could generate the optimal rules for the best outcome for his specific variables. Because of the counterfactuals, for studies that looked ALMOST perfect but didn’t match, we could see exactly why (it turns out there are a ton of ways to be disqualified for a study). But it gave him several that DO look like perfect fits, one of which he only had one more week left that he could apply (because it had a cutoff for X days from surgery date). He told his doctors, none of them had known about it (they had found several other clinical trials), but they agreed it was probably the best one for him to try to get into. Sorry for the long novel, but the part that was unique, was that yes I had to write the logic to pull all the data down, parse a PDF he had with the genome data, but finding the optimal rules to map to the best trial I didn’t have to do anything other than get the data.

Ok, how it works:

Input data (CSV or JSON) -> ingested as decision traces -> infer feature schema -> generates simple candidate predicates -> scores candidates against observed decisions -> selects a compact rule set using greedy and/or solver-backed search (z3 so far has worked best) -> emit an intermediate representation -> evaluates that artifact deterministically at runtime -> returns stable JSON with matched rules and explanation metadata -> supports semantic diffs between artifact versions. The rules are stored as a bitmask and evaluated simultaneously (which is why it’s often faster than whatever the original system is), and the best part is it tells us exactly what did or didn’t flip. Meaning we get counterfactuals, so you don’t just get the answer but the why (this part is what makes it really helpful).

Thank you for reading!! Everything is open source (MIT), I’d love to get any feedback!
kenerwin88
·4년 전·discuss
Super cool, ty for sharing! Will definitely be trying this asap.
kenerwin88
·5년 전·discuss
Hi! Love it, really neat work. Thanks for sharing!!
kenerwin88
·5년 전·discuss
As a former AWS employee, Terraform is MUCH better at scale for AWS resources than Cloudformation or even AWS CDK. CDKs reliance on CloudFormation underneath means being limited to the exact same problems that are mentioned in the article, as well as managing resources at enormous scale incredibly painful.
kenerwin88
·5년 전·discuss
Hmm, as a former AWS employee who has used both heavily, my experience has been the opposite.

Terraform’s AWS provider calls the APIs directly, whereas CDK generates Cloudformation, an abstraction on top of the AWS APIs. For me, using Terraform was significantly faster than applying the same stack via CDK.

Or do you mean you’re able to iterate faster writing CDK vs TF?