# US 2025/0147865 A1 · Template Generation For Exploring Models With Discrete Random Variable Distributions

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0147865 A1
- Document ID: US20250147865A1
- Status: Published application
- Kind: A1
- Application number: 18/770,238
- Filed: 2024-07-11
- Published: 2025-05-08
- Earliest claimed: 2023-11-08
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: Daniel Goodman
- Web page: https://patentgrep.com/patent/US20250147865A1

## CPC

- G06F 11/3636: {by tracing the execution of the program}
- G06F 8/30: Creation or generation of source code
- G06F 8/41: Compilation
- G06F 8/427: {Parsing}
- G06F 8/433: {Dependency analysis; Data or control flow analysis}
- G06F 8/447: {Target code generation}
- G06F 8/452: {Loops}
- G06F 8/75: Structural analysis for program understanding
- G06F 11/3684: {for test design, e.g. generating new test cases}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Templates may be generated for exploring models with discrete random variable distributions. Models may be received at a compiler that includes a description or translates to a Directed Acyclical Graph (DAG) that represents a probabilistic model, including one or more random variables. Traces starting from the one or more random variables and leading to a node in the DAG may be generated to convert into a set of groups of traces. Individual traces may be sorted in the groups of traces according to dependencies between traces in the groups of traces and code templates generated that explore a state space of possible sample values drawn from the one or more random variables.

## Claims

### Claim 1

A system, comprising:
at least one processor;
a memory, comprising program instructions that when executed by the at least one processor cause the at least one processor to:
receive code specified in a first programming language, wherein the code comprises a description of a Directed Acyclic Graph (DAG) that represents a probabilistic model, wherein the DAG comprises at least one random variable, and wherein the code further comprises a statement that instructs an analysis with respect to the random variable;
generate the DAG according to the code;
generate a first set of traces starting from the at least one random variable and leading to a node in the DAG;
based on the first set of traces, convert the set of traces into a second set of groups of traces, wherein the converting ensures that at most one group of the groups of traces will contain traces that are valid for a given configuration of the model;
respectively sort individual traces in the groups of traces according to dependencies between traces in a group of traces; and
respectively generate code templates that explore a state space of possible sample values drawn from the at least one random variable starting the first set of traces in a second programming language, for performing the instructed analysis for individual traces in the groups of traces according to the sorting of the individual traces in the groups.

### Claim 2 (depends on 1)

The system of claim 1, wherein the first programming language is a probabilistic programming language and wherein the second programming language is a non-probabilistic programming language.

### Claim 3 (depends on 1)

The system of claim 1, wherein the node in the DAG is a sample task with a fixed sample value.

### Claim 4 (depends on 1)

The system of claim 1, wherein the node in the DAG is a sample task with a sample value that has already been constructed for an earlier trace.

### Claim 5 (depends on 1)

The system of claim 1, wherein the node in the DAG is a sample task that is not fixed and has not already been constructed for an earlier trace and wherein at least one of the respectively generated code templates comprises a loop to consider a plurality of possible values and corresponding probabilities.

### Claim 6 (depends on 1)

The system of claim 1, wherein to respectively sort the individual traces in the groups of traces according to dependencies between the traces in the group of traces, the programming instructions cause the at least one processor to sort the individual traces into pre traces or post traces.

### Claim 7 (depends on 1)

The system of claim 1, wherein the code specified in the first programming language is received via an interface of a compiler.

### Claim 8

A method, comprising:
receiving code specified in a first programming language, wherein the code comprises a description of a Directed Acyclic Graph (DAG) that represents a probabilistic model, wherein the DAG comprises at least one random variable, and wherein the code further comprises a statement that instructs an analysis with respect to the random variable;
generating the DAG according to the code;
generating a first set of traces starting from the at least one random variable and leading to a node in the DAG;
based on the first set of traces, converting the set of traces into a second set of groups of traces, wherein the converting ensures that at most one group of the groups of traces will contain traces that are valid for a given configuration of the model;
respectively sorting individual traces in the groups of traces according to dependencies between traces in a group of traces; and
respectively generating code templates that explore a state space of possible sample values drawn from the at least one random variable starting the first set of traces in a second programming language, for performing the instructed analysis for individual traces in the groups of traces according to the sorting of the individual traces in the groups.

### Claim 9 (depends on 8)

The method of claim 8, wherein the first programming language is a probabilistic programming language and wherein the second programming language is a non-probabilistic programming language.

### Claim 10 (depends on 8)

The method of claim 8, wherein the node in the DAG is a sample task with a fixed sample value.

### Claim 11 (depends on 8)

The method of claim 8, wherein the node in the DAG is a sample task with a sample value that has already been constructed for an earlier trace.

### Claim 12 (depends on 8)

The method of claim 8, wherein the node in the DAG is a sample task that is not fixed and has not already been constructed for an earlier trace and wherein at least one of the respectively generated code templates comprises a loop to consider a plurality of possible values and corresponding probabilities.

### Claim 13 (depends on 8)

The method of claim 8, wherein to respectively sort the individual traces in the groups of traces according to dependencies between the traces in the group of traces, the programming instructions cause the at least one processor to sort the individual traces into pre traces or post traces.

### Claim 14 (depends on 8)

The method of claim 8, wherein the code specified in the first programming language is received via an interface of a compiler.

### Claim 15

One or more, non-transitory, computer-readable storage media, storing program instructions that when executed on or across one or more computing devices, cause the one or more computing devices to implement:
receiving code specified in a first programming language, wherein the code comprises a description of a Directed Acyclic Graph (DAG) that represents a probabilistic model, wherein the DAG comprises at least one random variable, and wherein the code further comprises a statement that instructs an analysis with respect to the random variable;
generating the DAG according to the code;
generating a first set of traces starting from the at least one random variable and leading to a node in the DAG;
based on the first set of traces, converting the set of traces into a second set of groups of traces, wherein the converting ensures that at most one group of the groups of traces will contain traces that are valid for a given configuration of the model;
respectively sorting individual traces in the groups of traces according to dependencies between traces in a group of traces; and
respectively generating code templates that explore a state space of possible sample values drawn from the at least one random variable starting the first set of traces in a second programming language, for performing the instructed analysis for individual traces in the groups of traces according to the sorting of the individual traces in the groups.

### Claim 16 (depends on 15)

The one or more non-transitory, computer-readable storage media of claim 15, wherein the first programming language is a probabilistic programming language and wherein the second programming language is a non-probabilistic programming language.

### Claim 17 (depends on 15)

The one or more non-transitory, computer-readable storage media of claim 15, wherein the node in the DAG is a sample task with a fixed sample value.

### Claim 18 (depends on 15)

The one or more non-transitory, computer-readable storage media of claim 15, wherein the node in the DAG is a sample task with a sample value that has already been constructed for an earlier trace.

### Claim 19 (depends on 15)

The one or more non-transitory, computer-readable storage media of claim 15, wherein the node in the DAG is a sample task that is not fixed and has not already been constructed for an earlier trace and wherein at least one of the respectively generated code templates comprises a loop to consider a plurality of possible values and corresponding probabilities.

### Claim 20 (depends on 15)

The one or more non-transitory, computer-readable storage media of claim 15, wherein the code specified in the first programming language is received via an interface of a compiler.
