Skip to content

Samplers: Remove ability to specify "full-context windows" from history-based samplers - #26524

Merged
ggerganov merged 2 commits into
masterfrom
osimons/penalty_sampler_folllow_up_no2
Aug 4, 2026
Merged

Samplers: Remove ability to specify "full-context windows" from history-based samplers#26524
ggerganov merged 2 commits into
masterfrom
osimons/penalty_sampler_folllow_up_no2

Conversation

@ORippler

@ORippler ORippler commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Overview

  1. Because of backend-sampling we initialize samplers before the complete llama_context is there. Therefore, we cannot infer the resolved context length yet at the time we construct the samplers.
  2. Review of Add backend sampler for penalties sampler #25262 (comment) therefore suggested removing the ability to specify full-context for history-penalizers, and this PR implements it

Additional information

  • we reject penalty_last_n < 0 in all consumers, but clamp them to 0 when directly constructing samplers via libllama
  • used 64 as a shared default instead of the suggested 1024. Can adjust as needed as this PR is breaking anyways.
  • I did not evaluate whether this needs to be a stacked PR, just wanted to try out the feature

Requirements

@ORippler
ORippler requested review from a team, ggerganov and ngxson as code owners August 3, 2026 15:58
@github-actions github-actions Bot added documentation Improvements or additions to documentation testing Everything test related server mtmd Related to multimodal functionality (video/image/audio) server/ui labels Aug 3, 2026
@ggerganov
ggerganov force-pushed the osimons/penalty_sampler_folllow_up_no2 branch from 31f798a to 60abc26 Compare August 3, 2026 16:10
Base automatically changed from osimons/penalty_sampler_folllow_up to master August 4, 2026 06:02
@ggerganov
ggerganov requested a review from CISC as a code owner August 4, 2026 06:02
Because of backend-sampling we initialize samplers before the complete
llama_context is there. Therefore, we cannot infer the resolved context
length yet at the time we construct the samplers.
@ggerganov
ggerganov force-pushed the osimons/penalty_sampler_folllow_up_no2 branch from 60abc26 to eb75c42 Compare August 4, 2026 06:02
@ggerganov ggerganov added the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Aug 4, 2026
@ggerganov
ggerganov merged commit a6aa6f5 into master Aug 4, 2026
25 of 32 checks passed
smalinin pushed a commit to smalinin/llama.cpp that referenced this pull request Aug 4, 2026
…gml-org#26524)

* Resolve -1 to 1024 instead of ctx-len for samplers

Because of backend-sampling we initialize samplers before the complete
llama_context is there. Therefore, we cannot infer the resolved context
length yet at the time we construct the samplers.

* Shared default of 64 for history-based samplers, remove context_size
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 11, 2026
…gml-org#26524)

* Resolve -1 to 1024 instead of ctx-len for samplers

Because of backend-sampling we initialize samplers before the complete
llama_context is there. Therefore, we cannot infer the resolved context
length yet at the time we construct the samplers.

* Shared default of 64 for history-based samplers, remove context_size
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 12, 2026
…gml-org#26524)

* Resolve -1 to 1024 instead of ctx-len for samplers

Because of backend-sampling we initialize samplers before the complete
llama_context is there. Therefore, we cannot infer the resolved context
length yet at the time we construct the samplers.

* Shared default of 64 for history-based samplers, remove context_size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. mtmd Related to multimodal functionality (video/image/audio) server/ui server testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants