Skip to content

increased rolling window size for gemma4#593

Merged
HenryNdubuaku merged 1 commit intomainfrom
karen/handoff_tweaks
Apr 17, 2026
Merged

increased rolling window size for gemma4#593
HenryNdubuaku merged 1 commit intomainfrom
karen/handoff_tweaks

Conversation

@kar-m
Copy link
Copy Markdown
Collaborator

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

No description provided.

Copilot AI review requested due to automatic review settings April 17, 2026 04:06
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

Adjusts the cloud handoff “entropy spike” detection behavior by making the rolling-entropy window configurable and increasing the default window size for GEMMA4 models.

Changes:

  • Introduces Config::default_rolling_entropy_window and uses it to parameterize EntropyState’s rolling window size.
  • Sets GEMMA4’s default rolling window to 16 (up from the previous fixed 10).
  • Renames the previous fixed constant to DEFAULT_ROLLING_ENTROPY_WINDOW and uses it as a fallback default in the FFI completion path.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
cactus/ffi/cactus_complete.cpp Uses a per-model config value to size the rolling entropy window used for handoff detection.
cactus/engine/engine_model.cpp Sets GEMMA4’s default rolling entropy window to 16 during config initialization.
cactus/engine/engine.h Adds default_rolling_entropy_window to the public Config struct.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cactus/engine/engine.h
Comment on lines 154 to 158
size_t default_top_k = 20;
float default_max_tps = -1.0f;
float default_cloud_handoff_threshold = 0.0f;
size_t default_rolling_entropy_window = 10;

Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

Config is included from cactus/cactus.h and is therefore part of the public C++ API surface. Adding a new data member changes the struct layout/ABI; inserting it here also shifts offsets of all subsequent members. If ABI compatibility matters, consider appending new members at the end of Config (or versioning the config struct / using accessors) to avoid breaking existing compiled clients.

Copilot uses AI. Check for mistakes.
using namespace cactus::ffi;

static constexpr size_t ROLLING_ENTROPY_WINDOW = 10;
static constexpr size_t DEFAULT_ROLLING_ENTROPY_WINDOW = 10;
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

DEFAULT_ROLLING_ENTROPY_WINDOW duplicates the default value now also stored in Config::default_rolling_entropy_window. To avoid the defaults drifting over time, consider deriving the EntropyState default directly from the model config (or defining the default in a single shared location) rather than keeping two separate 10s.

Suggested change
static constexpr size_t DEFAULT_ROLLING_ENTROPY_WINDOW = 10;
static constexpr size_t DEFAULT_ROLLING_ENTROPY_WINDOW = Config::default_rolling_entropy_window;

Copilot uses AI. Check for mistakes.
@HenryNdubuaku HenryNdubuaku merged commit d6b5efb into main Apr 17, 2026
10 of 14 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