Source-linked AI summary
Mutual Debiasing via Dual-Seed Comparison for Probabilistic Sampling in Large Language Models
Zihao Guo, Hongtao Lv, Chaoli Zhang, Laiguo Yin, Lei Liu, Yonghui Xu, Lizhen Cui
TL;DR
LLMs exhibit systematic biases when sampling random variables, and single-seed methods inherit those biases. DSC compares two generated strings to construct comparison bits, normalizes them into a pseudo-uniform variate, and maps that variate through the inverse CDF. It achieves the best KS statistic in 24 of 25 model-distribution conditions and improves downstream attribute control.
Problem
LLMs struggle with high-fidelity probabilistic sampling, while single-seed methods rely on character sources that are not unbiased.
Method
DSC compares two independently generated strings position by position, converts ordinal comparisons into bits and a pseudo-uniform variate, then applies inverse-CDF sampling without external tools.
Results
DSC achieves the lowest KS statistic in 24 of 25 model-distribution conditions and improves distributional fidelity in MCQ and attribute-constrained prompt generation.
Takeaways & Limitations
Position-wise comparison provides a transparent intermediate representation for sampling target distributions and adapting distributional control to downstream generation tasks.
Takeaways & Limitations
DSC depends on strong arithmetic and reasoning abilities and may degrade on obscure or highly complex distributions requiring difficult quantile evaluations.
Abstract
from arXiv · showhide
Although Large Language Models (LLMs) demonstrate remarkable capabilities in reasoning and decision-making, high-fidelity probabilistic sampling remains a persistent challenge. When generating random variables, LLMs consistently exhibit systematic biases that warp the target probability distributions. Current approaches often rely on a single, self-generated seed, which inherits model-specific biases. To overcome this vulnerability, we introduce Dual-Seed Comparison (DSC), a transparent, tool-free protocol that utilizes two independent LLM-generated seeds to neutralize bias. DSC compares the character-level ordinal values of the two seeds to construct a bit sequence, converts and normalizes this sequence into a pseudo-uniform variate, and then maps the variate to the target distribution through the inverse cumulative distribution function (CDF). Empirical results show that DSC substantially outperforms existing methods across 96\% of evaluated settings. Beyond direct sampling, task-adapted variants based on the DSC comparison operator improve distributional control in MCQ generation and attribute-constrained text-to-image prompting.
1 Introduction
LLMs struggle to execute high-fidelity probabilistic sampling, while existing single-seed and tool-based approaches leave model biases or intrinsic limitations unresolved. DSC compares two generated seeds to produce an auditable pseudo-uniform variate for target-distribution sampling.
- LLMs can describe target distributions yet fail to sample from them stochastically, creating a cognition–behavior gap.
- External libraries and code-execution environments bypass stochastic sampling rather than resolving the underlying generative limitation.
- SSoT relies on an unbiased single generated string, but repeated prefixes and character-level preferences can correlate and bias its outputs.
- DSC compares two independently generated strings character by character, using relative ordinal ordering to mitigate shared marginal character biases.
- DSC normalizes comparison bits into a pseudo-uniform u ∈[0, 1) and maps it to the target distribution through the inverse CDF in one inference call.
- DSC achieves the lowest KS statistic in 24 of 25 conditions across five models and five distributions, while improving downstream distributional control.
2 Related Work
Prior work documents broad LLM sampling failures and explores tool-based or intrinsic mitigations, but continuous sampling remains largely unresolved. DSC addresses this gap by converting two generated strings into a pseudo-uniform variate and then into continuous samples.
- LLMs show systematic deviations in discrete stochastic tasks, including uniform integers, dice rolls, coin flips, and Rock-Paper-Scissors.
- Autoregressive output probabilities are poorly calibrated, and models may describe target distributions accurately while failing to sample from them.
- Code execution can delegate randomization and calculation, but such tool use does not provide an intrinsic sampling mechanism.
- Continuous sampling is an especially severe gap: 10 of 11 audited models failed across every tested distribution under independent stateless requests.
- DSC bridges this gap by converting two LLM-generated character strings into a pseudo-uniform variate and mapping it through the quantile function.
3 Preliminaries
The paper evaluates distributional fidelity with continuous and discrete goodness-of-fit measures and tests whether LLM-generated character strings satisfy uniformity assumptions. These tests reveal systematic, model-dependent character biases.
- 3.1 Statistical Tests for Distributional Fidelity: Empirical CDFs are compared with target distributions using goodness-of-fit measures for distributional fidelity.
- 3.1 Statistical Tests for Distributional Fidelity: The KS statistic reports maximum deviation from the target CDF, with lower D_n indicating closer agreement.
- 3.1 Statistical Tests for Distributional Fidelity: Wasserstein distance integrates discrepancies across the support and is sensitive to systematic low-magnitude biases; lower W1 indicates closer adherence.
- 3.1 Statistical Tests for Distributional Fidelity: For discrete tasks, chi-square directly measures mismatch between observed category frequencies and target probabilities.
- 3.2 LLM-Generated Seeds Are Not Random: Across six LLMs, character frequencies deviate from the ideal 1/95 baseline, with favored characters and nearly absent characters.
- 3.2 LLM-Generated Seeds Are Not Random: All tested models reject character-level uniformity, with mean KS statistics from .082 to .197 and p < .001; vocabulary coverage ranges from 29 to 94 characters.
4 Proposed Method
Dual-Seed Comparison (DSC) extracts randomness by comparing two independently generated character strings, reducing reliance on any single biased seed. It converts comparison bits into a pseudo-uniform variate and transforms that variate into samples from target distributions.
- Dual-seed generation: DSC uses two independently generated character sequences instead of interpreting a single LLM-generated string directly.The protocol is tool-free and uses no external random source.
- Ordinal comparison: At each position, DSC compares characters by their fixed-alphabet ordinal values to produce one binary comparison bit.Ties are deterministically mapped to 0, while greater-than and less-than outcomes have equal probability under independent identical marginals.
- Bias suppression: Ordinal comparison approaches fair Bernoulli behavior when character collisions are rare, even when the underlying character distribution is non-uniform.The comparison probability depends on relative ordering rather than absolute character frequencies.
- Normalization: The resulting L-bit sequence is interpreted as an unsigned integer and normalized into a unit-interval variate with 2^L possible values.For L bits, the resolution is Δu = 2^-L.
- Target transformation: For non-uniform targets, DSC maps the pseudo-uniform variate to the requested distribution through an inverse-transform or quantile computation.The model performs the transformation using closed-form or approximated quantiles within the protocol.
5 Experiments
The experiments evaluate DSC against direct prompting and SSoT across five models, five continuous distributions, and downstream categorical generation tasks. DSC achieves the lowest error in nearly all distribution-sampling comparisons and improves distributional control in MCQ and attribute-constrained prompting.
- Experimental setup: The study compares Direct, SSoT, and DSC across five language models and five continuous target distributions.The evaluation covers uniform, symmetric, skewed, bounded, and shape-scale distributions, using 16-character seeds where applicable.
- Distribution sampling: DSC achieves the lowest mean error in 48 of 50 metric-specific comparisons and reduces error by a median of 58.5% against the stronger baseline.The comparison uses the better of Direct and SSoT for each metric-specific model-distribution pair.
- Distribution sampling: For Qwen3.5-9B on Beta(2, 5), DSC reduces the KS statistic from .248 to .053 and W1 from .072 to .017 against SSoT.These correspond to reductions of 78.6% for KS and 76.4% for W1.
- Pipeline diagnostics: In 20 of 25 model-distribution settings, final-stage Dn differs from its Stage 2 value by at most 0.02.The diagnostics indicate that much distributional deviation is already present after seed generation and comparison-bit construction.
- Downstream applications: In MCQ generation, DSC produces near-uniform answer frequencies with χ2 = 2.9 and p = 0.458, unlike Direct and SSoT.Direct prompting concentrates 63.9% of selections on option C and 3.3% on option A, while SSoT remains significantly non-uniform with χ2 = 34.3, p < .001.
- Downstream applications: For coat color, DSC achieves the lowest chi-square value, 33.5, while distributing selections more evenly across seven categories.The attribute-constrained task applies DSC-based sampling across multiple requested attributes.
6 Conclusion
The paper presents DSC as a tool-free protocol for native probabilistic sampling in LLMs. It reports strong distributional fidelity across model-distribution conditions and improved attribute control in downstream generation tasks.
- Conclusion: DSC enables LLMs to sample natively from target distributions using pseudo-uniform variates derived from position-wise string comparisons.The protocol is presented as tool-free.
- Conclusion: DSC achieves the best KS statistic in 24 of 25 model-distribution conditions.The conclusion also reports closer-to-ideal attribute distributions in MCQ and attribute-constrained prompt generation.
- Future directions: Future work may explore attention masking or decoupled prompts to enforce mutual independence of seed pairs more strictly.This is proposed as an extension for advancing native probabilistic sampling.
Limitations
DSC improves distributional fidelity without external tools but has practical limitations involving arithmetic reliability, distribution knowledge, and inference cost.
- Arithmetic capabilities: DSC requires multi-step arithmetic operations, including ordinal comparison, binary-to-integer conversion, and floating-point division.Errors can compound across intermediate stages and make final sampling unreliable.
- Arithmetic capabilities: DSC is best suited for foundation models with strong reasoning and mathematical capabilities.
- Distribution knowledge: For non-uniform targets, DSC depends on evaluating or approximating the corresponding quantile function and converting the pseudo-uniform variate.Accuracy may degrade for obscure or highly complex distributions.
- Inference overhead: DSC generates substantial intermediate output, including two seeds, comparison bits, and arithmetic steps, for one valid sample.This overhead may limit latency-sensitive or cost-constrained real-time applications.
Ethical Considerations
The paper frames DSC as a tool-free approach to probabilistic sampling while distinguishing statistical distributional fidelity from security-critical randomness.
- Scope and security: DSC is not a cryptographically secure pseudo-random number generator and must not be deployed in security-critical contexts.The stated boundary includes cryptographic key generation, secure token issuance, and applications involving direct financial stakes.
- Analytical assumptions: The comparison-bit analysis models characters as independent draws from a marginal distribution Pc over an alphabet A.
- Analytical assumptions: The formal framework assumes the two seed strings are independent and identically distributed draws from the same string distribution.This requirement is local to the two seeds within one DSC invocation.
- Analytical assumptions: The theoretical treatment assumes comparison outcomes at different positions are mutually independent, despite possible local dependencies in autoregressive generation.
A.2 Bias of the Comparison Bit
The comparison bit’s bias and entropy are governed by character collisions: deterministic tie-breaking shifts it toward 0, while diffuse character distributions yield nearly fair, high-entropy bits.
- Bias: Under Assumption 1, the comparison bit’s deviation from a fair coin is determined by the character collision probability γ(Pc).
- Bias: For a uniform distribution over K = 95 printable ASCII characters, γ(Pc) = 1/95 and the deviation is 1/190 ≈ 0.0053.
- Bias: Deterministic tie-breaking maps ties to 0 and introduces a bias toward 0 of magnitude γ(Pc)/2.Stochastic tie-breaking could remove this residual bias but would require an external randomness source.
- Entropy: The comparison bit’s Shannon entropy is governed by γ(Pc), approaching one bit when the character distribution is diffuse and ties are rare.For K = 95 uniform printable ASCII characters, H(b) ≈ 1 bit.
- Entropy: For an L-bit comparison sequence, joint entropy reaches the standard independent-outcome bound only when comparison outcomes are independent across positions.Local positional dependencies can reduce actual joint entropy below this theoretical upper bound.
- Interpretation: DSC does not require uniform marginal character distributions; it requires paired characters to be sufficiently independent and unlikely to coincide.
Appendix B DSC Pipeline Diagnostics and Seed Ablation
The diagnostics separate execution errors from distributional distortion and show that seed-derived comparison bits usually establish most final deviation. Seed-source ablation further identifies LLM seed generation as a major residual-error source.
- Pipeline diagnostics: Stage-wise analysis isolates errors introduced at each pipeline stage by recomputing outputs from the preceding model-reported result.The audit conditions each stage on the preceding output and reports stage-wise execution accuracy.
- Model-specific execution patterns: Claude Opus 4.6 is reliable at Stage 3 but weaker in ordinal comparison, normalization, and Beta quantile transformation.Stage 3 accuracy is 92.9%–96.5%, while Stage 2 is 69.2%–84.2%, Stage 4 is 59.2%–68.2%, and Beta Stage 5 falls to 66.3%.
- Model-specific execution patterns: 97.7% accuracy is exceeded by Gemini 3.1 Pro at Stages 2–4 for every distribution, while Gamma transformation is its main failure point.Gamma Stage 5 accuracy drops to 85.2%.
- Model-specific execution patterns: Qwen3.5-27B is the most consistently reliable model, with Stage 2 accuracy at least 95.0% and later stages above 94.2% across distributions.
- Stage-wise distributional fidelity: 20 of 25 model-distribution settings have final-stage Dn within 0.02 of Stage 2, indicating that comparison-bit bias usually dominates later computation.For MiniMax-M2.5, Stage 2-to-final Dn differences are .002, .006, .015, and .017 across four listed distributions despite low execution accuracy.
- Stage-wise distributional fidelity: Nonlinear target transformations can add distortion: for Beta sampling, Claude Opus 4.6 increases Dn from .120 to .216, while Qwen3.5-9B decreases it from .123 to .053.The decrease reflects arithmetic errors partially offsetting existing bias rather than improved execution accuracy.
- Seed-source ablation: Shuffling reduces seed-ordering bias, but program-generated seeds produce the lowest KS statistic in every model-distribution setting and keep Dn below the critical threshold.For Claude Opus 4.6, program-generated seeds yield Dn .055 on Uniform and .049 on Exponential sampling.
Appendix C Diagnosing Seed Assumptions in DSC
The seed diagnostics find measurable departures from the i.i.d. assumptions, while shuffled seeds produce near-balanced aggregate comparison bits and reduce positional structure. Shuffling therefore mitigates, but does not eliminate, seed-related violations.
- Assumptions and diagnostics: The theoretical bias-suppression property of ordinal comparison is conditional on paired seeds behaving as i.i.d. draws from a common distribution.
- Assumptions and diagnostics: The diagnostics audit comparison-bit balance, ties, collision probability, seed overlap, and repeated prefixes across DSC trials.They use the same trials as the main experiments and aggregate across five target distributions.
- Findings: LLM-generated seeds are imperfect but sufficient for near-balanced comparison bits, despite measurable departures from the idealized i.i.d. model.
- Findings: The pooled marginal collision estimate ranges from .020 to .023, above the uniform printable-ASCII baseline of 1/95 ≈.0105.This indicates concentration on particular characters.
- Findings: After shuffling, aggregate ˆp1 ranges from .485 to .494 and Bitbias remains below .017 for all models.These values support substantial aggregate suppression of character-level bias.
- Findings: Shuffling reduces repeated-prefix structure and improves balance, but does not make paired seeds independent or alter their character distributions.For Claude Opus 4.6, Dup−4 drops from .534 to .053 and Dup−8 from .264 to .003.
- Conclusion: The conclusion attributes improved shuffled-seed performance to disrupted repeated prefixes and more balanced comparison bits.
Appendix E Prompt Used in Downstream Task
The downstream prompts adapt DSC to control sampled outputs in medical MCQ generation and attribute-constrained text-to-image prompting. They specify seed comparison, conversion, mapping, and strict output requirements.
- Medical MCQ generation: The MCQ prompt requires one medically valuable question, four plausible options, exactly one correct answer, and the sampled correct-answer position.
- Medical MCQ generation: The medical DSC prompt generates two independent 16-character printable-ASCII seeds and compares corresponding characters to form 16 bits.A comparison yields 1 when seed1[i] > seed2[i], and 0 otherwise.
- Medical MCQ generation: Two distant bits, bit[0] and bit[8], are combined into a 2-bit code that selects answer positions A, B, C, or D.The mapping assigns the four bit pairs to A, B, C, and D.
- Attribute-constrained prompting: The attribute prompt generates four independent seed pairs for gender, race or ethnicity, height, and coat color.Each pair contains two independent 16-character printable-ASCII strings.
- Attribute-constrained prompting: Each 16-bit comparison string is converted to N and normalized as u = N/65536, producing four variates ua, ub, uc, and ud in [0, 1).
- Attribute-constrained prompting: The four variates are mapped to attributes using cumulative thresholds, including specified gender and race categories, a normal height transform, and seven equal coat-color bins.Height uses 169.0 + 10.0 × Φ^-1(uc) and is rounded to an integer.
Appendix F Reproducibility and Raw Output Logging
The experiments retain raw model responses alongside parsed outputs and verification results. This logging supports reproducibility and auditing of both distributional outcomes and intermediate failures.
- Experiment logging: Main experiments use five requested model identifiers through an OpenAI-compatible chat-completions endpoint.Unless otherwise specified, runs use temperature = 1.0, n = 200 trials per repeat, and five repeats per model-distribution condition.
- Experiment logging: Each DSC trial record stores raw response text, original and shuffled seeds, comparison bits, N, u, final sample, parsing validity, and stage-wise verification results.
- Experiment logging: Downstream-task records similarly store raw responses, parsed task attributes, and parsed output labels.
- Experiment logging: The retained logs allow auditing of distributional outcomes and intermediate arithmetic failures.An example raw-output excerpt is shown, while full responses remain in experiment logs.