skills/llm/exhaustive-permutation-early-stopping/SKILL.md
Enumerate all factorial permutations in batches with LLM scoring, tracking the running best and early-stopping when score crosses a known optimality threshold
npx skillsauth add wenmin-wu/ds-skills llm-exhaustive-permutation-early-stoppingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
For short sequences (up to 10-12 elements where n! is tractable), enumerate all permutations, score them in batches via a fast LLM scorer, and track the global best. Early-stop when the score drops below a known threshold (e.g., from leaderboard or theoretical bound). Batched evaluation makes this surprisingly fast — 10! = 3.6M permutations at batch_size=256 takes ~14K forward passes.
import itertools
import math
import numpy as np
def exhaustive_search(words, scorer, batch_size=256, threshold=None):
best_score = float('inf')
best_text = None
total = math.factorial(len(words))
batch = []
for i, perm in enumerate(itertools.permutations(words)):
batch.append(' '.join(perm))
if len(batch) == batch_size or i == total - 1:
scores = scorer.score(batch, batch_size=batch_size)
min_idx = np.argmin(scores)
if scores[min_idx] < best_score:
best_score = scores[min_idx]
best_text = batch[min_idx]
batch = []
if threshold and best_score < threshold:
break
return best_text, best_score
result, score = exhaustive_search(
text.split(), scorer, batch_size=256, threshold=475)
itertools.permutationsdata-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF