added default confidence and wired that for vlm#591
Merged
HenryNdubuaku merged 2 commits intomainfrom Apr 16, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces model-driven defaults for the cloud-handoff confidence threshold (notably for GEMMA4/VLM), allowing callers to omit confidence_threshold and have it resolved from model config with a fallback.
Changes:
- Change
InferenceOptions::confidence_thresholddefault from0.7fto-1.0f(sentinel for “unset”). - In
prepare_prompt(), ifconfidence_thresholdis unset, populate it fromConfig::default_cloud_handoff_threshold(else fallback to0.7f). - Set
default_cloud_handoff_threshold = 0.92fforModelType::GEMMA4in config defaults.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| cactus/ffi/cactus_utils.h | Switches confidence_threshold default to an “unset” sentinel value. |
| cactus/ffi/cactus_complete.cpp | Resolves unset confidence_threshold using model config / fallback during prompt preparation. |
| cactus/engine/engine_model.cpp | Adds a GEMMA4-specific default cloud handoff threshold (0.92). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+405
to
406
| float confidence_threshold = -1.0f; | ||
| size_t top_k = 0; |
Comment on lines
+521
to
+524
| if (prompt.options.confidence_threshold < 0.0f) { | ||
| float model_default = handle->model->get_config().default_cloud_handoff_threshold; | ||
| prompt.options.confidence_threshold = (model_default > 0.0f) ? model_default : 0.7f; | ||
| } |
Comment on lines
+521
to
+524
| if (prompt.options.confidence_threshold < 0.0f) { | ||
| float model_default = handle->model->get_config().default_cloud_handoff_threshold; | ||
| prompt.options.confidence_threshold = (model_default > 0.0f) ? model_default : 0.7f; | ||
| } |
| default_temperature = 1.0f; | ||
| default_top_p = 0.95f; | ||
| default_top_k = 64; | ||
| if (model_type == ModelType::GEMMA4) default_cloud_handoff_threshold = 0.92f; |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.