H-5641: Probability Distributions in Petrinaut#8463
Draft
kube wants to merge 6 commits intocf/h-5839-create-an-lsp-and-re-use-in-monaco-editorfrom
Draft
H-5641: Probability Distributions in Petrinaut#8463kube wants to merge 6 commits intocf/h-5839-create-an-lsp-and-re-use-in-monaco-editorfrom
kube wants to merge 6 commits intocf/h-5839-create-an-lsp-and-re-use-in-monaco-editorfrom
Conversation
Extract `generateVirtualFiles` into its own module and add a global `sdcpn-lib.d.ts` virtual file exposing `DistributionGaussian` and `Distribution` types for use in transition kernel code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use a namespace pattern so additional distribution types can be added alongside Gaussian (e.g. Distribution.Uniform, Distribution.Exponential). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
3 tasks
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3 tasks
Add Distribution.Gaussian and Distribution.Uniform as runtime-available functions in transition kernel code. Distribution values in kernel output are sampled using the seeded RNG (Box-Muller for Gaussian) before being stored as token values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `.map(fn)` method to Distribution for deriving correlated values from a single sample (e.g. angle.map(Math.cos), angle.map(Math.sin)). Sampled values are cached on the distribution object so mapped siblings share one draw. Also add a probabilistic satellites launcher example. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix import sort order, remove unused eslint-disable directive, add no-param-reassign override for distribution caching, and replace .map() closure with imperative loop to avoid no-loop-func violation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Kapture.2026-02-21.at.03.40.43.mp4
🌟 What is the purpose of this PR?
Adds probability distribution support to Petrinaut transition kernels. Users can now return
Distribution.Gaussian(mean, deviation)orDistribution.Uniform(min, max)values from transition kernel code instead of plain numbers, enabling stochastic token generation.It allows to define Transition Kernels using
Distribution, like:🔗 Related links
🔍 What does this change?
generateVirtualFilesfromcreate-sdcpn-language-service.tsinto its own modulesdcpn-lib.d.tsvirtual file exposingDistributiontype andDistribution.Gaussian/Distribution.Uniformnamespace functions for type checkingProbabilistic<T>utility type so kernel output allowsnumber | Distributionfor numeric fieldsdistribution.tsruntime module with:RuntimeDistributiontagged union type for runtime detectiondistributionRuntimeCodeinjected into compiled user code contextsampleDistribution()using seeded RNG (Box-Muller transform for Gaussian)compile-user-code.tsto inject theDistributionnamespace into the execution environmentcompute-possible-transition.tsto resolve Distribution values in kernel output by sampling, threading RNG state through all samplesPre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🛡 What tests cover this?
❓ How to test this?
Distribution.Gaussian(0, 1)orDistribution.Uniform(0, 10)as a value in the returned output tokensDistributionwherenumberis expected in kernel output