{"slug": "pluck-probabilistic-programming-with-lazy-inference", "title": "Pluck: Probabilistic Programming With Lazy Inference", "summary": "Researchers released Pluck, a probabilistic programming language that uses lazy knowledge compilation for efficient exact inference. It supports higher-order functions, recursion, and can compute exact probability distributions and posterior samples for discrete random programs.", "body_md": "# Pluck\n\nPluck is a probabilistic programming language with efficient inference based on [lazy knowledge compilation](https://dl.acm.org/doi/10.1145/3729325). It supports higher-order functions, many recursive programs, and recursive types.\n\n## Quick Start\n\nInstall Pluck and run your first program:\n\n```\n# In your shell:\ngit clone --recurse-submodules https://github.com/mlb2251/Pluck.jl.git\ncd Pluck.jl\n\n# Compile the rsdd library (required for Pluck)\ncd src/RSDD/rsdd\ncargo build --release --features ffi\ncd ../../..\n\n# In Julia:\nusing Pkg\nPkg.activate(\".\")\nPkg.instantiate()\nusing Pluck\nload_pluck_file(\"programs/simple_example.pluck\");\n```\n\n### Expressive, Lazy, Functional Programs\n\nPluck programs are expressive functional programs, that can also make (discrete) random choices. It supports lazy algebraic data types, higher-order functions, and recursion.\n\n```\n(define-type tree (Leaf) (Node nat tree tree))\n\n(define (random-tree)\n  (if (flip 0.6)\n    (Leaf)\n    (let ((left  (random-tree))\n          (right (random-tree)))\n      (Node (geom 0.5) left right))))\nNode 2 (Leaf) (Node 0 (Leaf) (Leaf))\nLeaf\nNode 1 (Leaf) (Leaf)\n```\n\n### Exact Inference\n\nPluck can compute the exact probability distributions of many expressions.\n\n```\n;; What is the probability that a random tree has fewer than 4 nodes?\n(query tree-size-small\n  (Marginal (< (length (nodes (random-tree))) 4)))\ntree-size-small:\n  true   0.855\n  false  0.145\n```\n\n### Bayesian Conditioning\n\nPluck can also compute the exact conditional (i.e., posterior) distribution of an expression, given some Boolean condition.\n\n```\n(query bst-given-size8-bounded\n  (let ((t (random-tree)))\n    (Posterior\n      (isBST t)\n      (and (== (size t) 8) (all-nodes-between t 0 10)))))\nbst-given-size8-bounded:\n  false   0.9999999999998865\n  true    1.1346479311669095e-13\n```\n\n### Posterior Sampling\n\nPluck can draw exact samples from posterior distributions, even in infinite spaces.\n\n```\n(query tree-samples-given-size8-bst-bounded\n  (let ((t (random-tree)))\n    (PosteriorSamples\n      t\n      (and (== (size t) 8)\n           (all-nodes-between t 0 10)\n           (isBST t))\n      5)))\n(Node 9 (Node 7 (Node 6 (Node 4 (Node 3 (Node 2 (Node 1 (Leaf) (Leaf)) (Leaf)) (Leaf)) (Node 5 (Leaf) (Leaf))) (Leaf)) (Leaf)) (Leaf))\n(Node 8 (Node 5 (Node 4 (Node 2 (Node 1 (Leaf) (Leaf)) (Node 3 (Leaf) (Leaf))) (Leaf)) (Node 6 (Leaf) (Leaf))) (Node 9 (Leaf) (Leaf)))\n(Node 8 (Node 7 (Node 5 (Node 1 (Leaf) (Node 4 (Node 2 (Leaf) (Node 3 (Leaf) (Leaf))) (Leaf))) (Node 6 (Leaf) (Leaf))) (Leaf)) (Leaf))\n(Node 8 (Node 6 (Node 3 (Node 1 (Leaf) (Node 2 (Leaf) (Leaf))) (Node 4 (Leaf) (Node 5 (Leaf) (Leaf)))) (Node 7 (Leaf) (Leaf))) (Leaf))\n(Node 8 (Node 7 (Node 6 (Node 1 (Leaf) (Node 3 (Node 2 (Leaf) (Leaf)) (Node 5 (Node 4 (Leaf) (Leaf)) (Leaf)))) (Leaf)) (Leaf)) (Leaf))\n```\n\n", "url": "https://wpnews.pro/news/pluck-probabilistic-programming-with-lazy-inference", "canonical_source": "https://pluck-lang.github.io/", "published_at": "2026-06-15 14:22:40+00:00", "updated_at": "2026-06-15 14:38:35.488317+00:00", "lang": "en", "topics": ["machine-learning", "artificial-intelligence"], "entities": ["Pluck", "Julia"], "alternates": {"html": "https://wpnews.pro/news/pluck-probabilistic-programming-with-lazy-inference", "markdown": "https://wpnews.pro/news/pluck-probabilistic-programming-with-lazy-inference.md", "text": "https://wpnews.pro/news/pluck-probabilistic-programming-with-lazy-inference.txt", "jsonld": "https://wpnews.pro/news/pluck-probabilistic-programming-with-lazy-inference.jsonld"}}