Skip to content

added default confidence and wired that for vlm#591

Merged
HenryNdubuaku merged 2 commits intomainfrom
karen/gemma-cloud
Apr 16, 2026
Merged

added default confidence and wired that for vlm#591
HenryNdubuaku merged 2 commits intomainfrom
karen/gemma-cloud

Conversation

@kar-m
Copy link
Copy Markdown
Collaborator

@kar-m kar-m commented Apr 16, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 16, 2026 06:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_threshold default from 0.7f to -1.0f (sentinel for “unset”).
  • In prepare_prompt(), if confidence_threshold is unset, populate it from Config::default_cloud_handoff_threshold (else fallback to 0.7f).
  • Set default_cloud_handoff_threshold = 0.92f for ModelType::GEMMA4 in 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 thread cactus/ffi/cactus_utils.h
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;
@HenryNdubuaku HenryNdubuaku merged commit e1b0a20 into main Apr 16, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants