]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
common : revert reasoning budget +inf logit bias (#22740)
authorAldehir Rojas <redacted>
Fri, 8 May 2026 15:46:43 +0000 (10:46 -0500)
committerGitHub <redacted>
Fri, 8 May 2026 15:46:43 +0000 (17:46 +0200)
common/reasoning-budget.cpp
tests/test-reasoning-budget.cpp

index 8c1f72fc2a12ba2a85901379cec2c193381378f0..c6e1f86c91e96eaba7c86d6926e3ce46e46f5080 100644 (file)
@@ -158,8 +158,6 @@ static void common_reasoning_budget_apply(struct llama_sampler * smpl, llama_tok
     for (size_t i = 0; i < cur_p->size; i++) {
         if (cur_p->data[i].id != forced) {
             cur_p->data[i].logit = -INFINITY;
-        } else {
-            cur_p->data[i].logit = +INFINITY; // force the token
         }
     }
 }
index 747d246448f84c61239de252ec79c91a6bdf1faa..f7a60178996695305c37c9391491fa9c57a89f45 100644 (file)
@@ -70,20 +70,20 @@ static void test_reasoning_budget(
         llama_sampler_apply(sampler, &cur_p);
 
         // Check if forcing is active (all logits except one should be -INFINITY)
-        size_t not_neg_inf = 0;
-        llama_token not_neg_inf_token = -1;
+        size_t finite_count = 0;
+        llama_token finite_token = -1;
         for (size_t j = 0; j < cur.size(); j++) {
-            if (std::isfinite(cur[j].logit) || cur[j].logit > 0) { // +INFINITY
-                not_neg_inf++;
-                not_neg_inf_token = cur[j].id;
+            if (std::isfinite(cur[j].logit)) {
+                finite_count++;
+                finite_token = cur[j].id;
             }
         }
 
         llama_sampler_accept(sampler, sequence[i]);
 
-        fprintf(stderr, "    i=%zu: token=%d, not_neg_inf_count=%zu, not_neg_inf_token=%d\n", i, (int)sequence[i], not_neg_inf, (int)not_neg_inf_token);
+        fprintf(stderr, "    i=%zu: token=%d, finite_count=%zu, finite_token=%d\n", i, (int)sequence[i], finite_count, (int)finite_token);
 
-        if (not_neg_inf == 1) {
+        if (finite_count == 1) {
             if (actual_force_start == SIZE_MAX) {
                 actual_force_start = i;
             }