HN
Today

NoiseLang: Where N = 5 is a Dirac delta

NoiseLang is a novel programming language where every value is a probability distribution, enabling intuitive Monte Carlo simulations for complex probabilistic problems. The author, having conceived it years ago, finally brought it to life with the aid of modern AI tools, sparking discussion on its unique design and its place among existing probabilistic programming tools. It's a fascinating blend of theoretical elegance and practical, high-performance implementation.

27
Score
13
Comments
#9
Highest Rank
7h
on Front Page
First Seen
Jul 8, 11:00 AM
Last Seen
Jul 8, 5:00 PM
Rank Over Time
2210109111314

The Lowdown

NoiseLang is an innovative domain-specific language designed to simplify working with probability distributions, born from the author's frustration with writing probabilistic calculations by hand. Its core tenet is that "every value is a probability distribution," treating even constants as Dirac delta functions. This allows for a concise syntax where operators map distributions to distributions, facilitating complex Monte Carlo simulations with a few lines of code.

  • Unified Value Representation: All values, from constants to random variables, are probability distributions. A constant 5 is a Dirac delta, while X ~ unif_int(1, 6) defines a uniform discrete distribution.
  • Intuitive Operations: Operators like + convolve distributions, clearly illustrating concepts like the Central Limit Theorem.
  • Lazy Evaluation & Monte Carlo: Nothing executes until a query (e.g., P(X + Y < 10)) is made, triggering millions of simulations to estimate results with standard errors.
  • High-Performance Backend: Despite its conceptual simplicity, NoiseLang boasts a sophisticated Rust-based backend, utilizing a Cranelift JIT, WASM emitter, and a columnar batch interpreter for performance and correctness.
  • AI-Assisted Development: The author credits AI agents for enabling the completion of the runtime, numerical parts, and JIT, while he focused on language design.
  • Practical Demos: Examples include the birthday paradox, estimating Pi, and a compelling demonstration of why FM radio is more robust to noise than AM.
  • Purpose & Limitations: NoiseLang is positioned as a "whiteboard stage" tool for rapid prototyping and understanding probabilistic problems, excelling where quick answers are needed over precise, data-intensive posterior fitting like Stan or PyMC. It's not intended for large-scale, continuous data analysis or stateful simulations.

In essence, NoiseLang offers a powerful, accessible way to explore probabilistic ideas and perform Monte Carlo simulations, bridging the gap between mathematical notation and computational execution, particularly useful for educational or conceptual exploration.

The Gossip

Probabilistic Programming Parallels

Discussion frequently compared NoiseLang to existing probabilistic programming languages (PPLs) and libraries. Commenters pointed to Haskell's `monad-bayes`, `Stan`, `webppl`, `Anglican`, and `PyMC`, suggesting the author might find these relevant or consider mentioning them. While some appreciated NoiseLang's unique approach, others questioned the need for a new language over a Python library for lazy evaluation. The author acknowledged the Haskell comparison.

AI's Enabling Role

The author's candid admission that AI agents helped him complete the ambitious project after nine years sparked interest. He clarified that AI excelled at runtime, numerical, and JIT components but struggled with language design, which he handled. One commenter humorously warned that this disclosure might attract criticism from those averse to AI.

Technical Design and Analogies

The technical sophistication of NoiseLang's implementation, including its JIT, WASM backend, and Monte Carlo optimizations, was appreciated. A particularly insightful comment drew parallels to shading languages in computer graphics, explaining how techniques like `smoothstep` (analogous to softening Dirac deltas) are used to turn discrete programming into continuous, well-behaved functions, especially relevant for AI training and gradient descent.