This pull request restores and explicitly defines the optimal default top_p threshold (default=0.95) across key configuration classes in google/genai/types.py (GenerateContentConfig, GenerationConfig, Model, and LiveConnectConfig).
Motivation & Problem Statement
In recent updates, the omission of explicit default top_p nucleus sampling thresholds coupled with default temperature: 1.0 causes notable sampling entropy, particularly when using thinking models on lower/medium reasoning budgets (ThinkingLevel.MEDIUM).
Empirical testing on real-world multimodal benchmarks (fine-grained OCR under motion blur, complex regulatory logic, and noisy audio processing) demonstrated that:
When top_p is left unbounded at temperature: 1.0, the model occasionally samples low-probability tokens in initial reasoning steps, causing cascading hallucinations (e.g., misreading ambiguous digits or misinterpreting domain-specific rules).
Setting top_p=0.95 by default restores the deterministic stability previously experienced in earlier stable releases (such as the workflow prior to recent upstream schema changes), while still preserving creative exploration when explicitly requested by developers.
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
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.
Summary of Changes
This pull request restores and explicitly defines the optimal default top_p threshold (default=0.95) across key configuration classes in google/genai/types.py (GenerateContentConfig, GenerationConfig, Model, and LiveConnectConfig).
Motivation & Problem Statement
In recent updates, the omission of explicit default top_p nucleus sampling thresholds coupled with default temperature: 1.0 causes notable sampling entropy, particularly when using thinking models on lower/medium reasoning budgets (ThinkingLevel.MEDIUM).
Empirical testing on real-world multimodal benchmarks (fine-grained OCR under motion blur, complex regulatory logic, and noisy audio processing) demonstrated that:
Classes Updated
Verification & Testing