Reduce likelyhood that thinking model will go into infinite loop
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Fri, 13 Jun 2025 14:08:58 +0000 (17:08 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Fri, 13 Jun 2025 14:08:58 +0000 (17:08 +0300)
src/main/java/eu/svjatoslav/alyverkko_cli/AiTask.java

index 530e114..925284d 100644 (file)
@@ -229,20 +229,50 @@ public class AiTask {
                 "--model " + mailQuery.model.filesystemPath,
                 "--threads " + configuration.getThreadCount(),
                 "--threads-batch " + configuration.getBatchThreadCount(),
-                "--mirostat 2",
-                "--flash-attn",
+                "--top-k 40",
+                "--top-p 0.95",
+                "--min-p 0.1",
+                "--repeat-penalty 1.1",
+                "--dry-multiplier 0.5",
+                "--presence-penalty 0.1",
+                "--mirostat 0",
+                "--samplers 'top_k;top_p;min_p;temperature;dry;typ_p;xtc'",
                 "--cache-type-k q8_0",
                 "--cache-type-v q8_0",
                 "--no-display-prompt",
                 "--no-warmup",
-                "--temp " + temperature,
+                "--flash-attn",
+                "--temp 0.6",
                 "--ctx-size " + mailQuery.model.contextSizeTokens,
                 "--batch-size 8",
                 "--no-conversation",
                 "-n -1",
-                "--repeat_penalty 1.1",
                 "--file " + inputFile
         );
+
+// Old solution that sometimes went into an infinite loop, for backup purposes:
+//
+//        return join(" ",
+//                "nice", "-n", Integer.toString(niceValue),
+//                executablePath,
+//                "--model " + mailQuery.model.filesystemPath,
+//                "--threads " + configuration.getThreadCount(),
+//                "--threads-batch " + configuration.getBatchThreadCount(),
+//                "--mirostat 2",
+//                "--flash-attn",
+//                "--cache-type-k q8_0",
+//                "--cache-type-v q8_0",
+//                "--no-display-prompt",
+//                "--no-warmup",
+//                "--temp " + temperature,
+//                "--ctx-size " + mailQuery.model.contextSizeTokens,
+//                "--batch-size 8",
+//                "--no-conversation",
+//                "-n -1",
+//                "--repeat_penalty 1.1",
+//                "--file " + inputFile
+//        );
+
     }
 
     /**