Skip to content

Main content

Random Beam Search Pruning Challenge Generator

Grow a bounded scored tree and delegate beam traces, comparing the result with exhaustive best paths at the same depth to expose pruning losses.

Loading tool…

Description

Grow a bounded scored tree and delegate beam traces, comparing the result with exhaustive best paths at the same depth to expose pruning losses.

A graph uses vertices and edges to represent relationships. Direction, duplicate handling, indexing, and traversal order affect its interpretation; returning a constructed graph together with a witness or calculated answer helps verify an algorithm.

Grow a bounded scored tree and delegate beam traces, comparing the result with exhaustive best paths at the same depth to expose pruning losses.

When to use this tool

Use this generator to create reproducible beam search pruning challenge cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply branchingFactor, treeDepth, searchDepth, width, minimumScore, maximumScore in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read nodes, beam, comparison, convention. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.

Draw a complete scored tree and run beam search to searchDepth. Exhaustively enumerate all paths to that same depth, compare cumulative scores, and return the optimality gap and whether the beam score matches the exhaustive best.1

Delegated operations used for this result: beam search. Their calculation or parsing conventions apply to the corresponding result fields.2

Input fieldMeaning and unitsAccepted input
branchingFactorBranching FactorRequired. Safe integer; minimum 2; maximum 4.
treeDepthTree DepthRequired. Safe integer; minimum 1; maximum 5.
searchDepthSearch DepthRequired. Safe integer; minimum 1; maximum 5.
widthWidthRequired. Safe integer; minimum 1; maximum 16.
minimumScoreMinimum ScoreRequired. Safe integer.
maximumScoreMaximum ScoreRequired. Safe integer.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
nodesNodesRequired. Array of Object; no unknown keys.; minimum items 3; maximum items 341.
nodes[].labelSupplied display label.Required. Text; minimum UTF-16 length 1; maximum UTF-16 length 64.
nodes[].parentParentRequired. Text; minimum UTF-16 length 1; maximum UTF-16 length 64. or Null.
nodes[].depthDepthRequired. Safe integer; minimum 0; maximum 5.
nodes[].scoreScoreRequired. Safe integer.
beamBeamRequired. Object; no unknown keys.
beam.bestPathBest PathRequired. Array of Text; minimum UTF-16 length 1; maximum UTF-16 length 64.; minimum items 1; maximum items 6.
beam.bestScoreBest ScoreRequired. Finite number.
beam.levelsLevelsRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 5.
beam.levels[].keptKeptRequired. Array of Text.; minimum items 1; maximum items 16.
beam.levels[].prunedPrunedRequired. Array of Text.; minimum items 0; maximum items 64.
comparisonComparisonRequired. Object; no unknown keys.
comparison.depthDepthRequired. Safe integer; minimum 1; maximum 5.
comparison.exhaustivePathCountExhaustive Path CountRequired. Safe integer; minimum 2; maximum 256.
comparison.exhaustiveBestPathExhaustive Best PathRequired. Array of Text; minimum UTF-16 length 1; maximum UTF-16 length 64.; minimum items 1; maximum items 6.
comparison.exhaustiveBestScoreExhaustive Best ScoreRequired. Finite number.
comparison.gapGapRequired. Finite number.
comparison.beamIsOptimalBeam Is OptimalRequired. Boolean.
conventionConventionRequired. Text.
randomnessReplay source and normalized 32-bit seed, or null seed for an advancing context source.Required. Object; no unknown keys.
randomness.seedOptional safe-integer replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "branchingFactor": 2,
    "treeDepth": 2,
    "searchDepth": 2,
    "width": 1,
    "minimumScore": -5,
    "maximumScore": 5,
    "seed": 42
  },
  "output": {
    "nodes": [
      {
        "label": "n000",
        "parent": null,
        "depth": 0,
        "score": 0
      },
      {
        "label": "n001",
        "parent": "n000",
        "depth": 1,
        "score": 1
      },
      {
        "label": "n002",
        "parent": "n001",
        "depth": 2,
        "score": -1
      },
      {
        "label": "n003",
        "parent": "n001",
        "depth": 2,
        "score": 4
      },
      {
        "label": "n004",
        "parent": "n000",
        "depth": 1,
        "score": 2
      },
      {
        "label": "n005",
        "parent": "n004",
        "depth": 2,
        "score": -4
      },
      {
        "label": "n006",
        "parent": "n004",
        "depth": 2,
        "score": 0
      }
    ],
    "beam": {
      "bestPath": [
        "n000",
        "n004",
        "n006"
      ],
      "bestScore": 2,
      "levels": [
        {
          "kept": [
            "n000 > n004"
          ],
          "pruned": [
            "n000 > n001"
          ]
        },
        {
          "kept": [
            "n000 > n004 > n006"
          ],
          "pruned": [
            "n000 > n004 > n005"
          ]
        }
      ]
    },
    "comparison": {
      "depth": 2,
      "exhaustivePathCount": 4,
      "exhaustiveBestPath": [
        "n000",
        "n001",
        "n003"
      ],
      "exhaustiveBestScore": 5,
      "gap": 3,
      "beamIsOptimal": false
    },
    "convention": "Scores are cumulative node increments from a zero-score root. Compare paths at the same depth; ties use the core's ascending path-label convention. Beam pruning may discard the exhaustive optimum.",
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • The root contributes zero and other scores are node increments. Narrow beams can discard the optimum. Equal-score paths follow the stated label convention; the tree and arithmetic budgets bound exhaustive comparison.
  • A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random Beam Search Pruning Challenge Generator — tool.io

  2. Calculation or validation: search/beam-search — tool.io

Similar or alternative tools

  • Strongly Connected Components Finder

    Partition a bounded directed graph into canonical strongly connected components and return vertex memberships plus its deduplicated condensation edges using iterative Kosaraju–Sharir searches.

  • Random Clique Instance Generator

    Generate a simple graph with a planted clique and independent Bernoulli background edges; the witness is not claimed to be maximum.