config: configurable max_new generation budget (default 16384) so CoT+answer are not truncated
This commit is contained in:
1 parent
862897fdbc
commit
4cdc4334d8
6 files changed
+70
-16
No files matched your search
@@ -77,6 +77,11 @@ pub struct Config {
|
||||
/// launcher's monkey-patch).
|
||||
#[serde(default)]
|
||||
pub reasoning_effort: Option<String>,
|
||||
/// Default generation budget (`max_new` tokens) when neither the request nor
|
||||
/// the session sets one. Reasoning + answer share it; the default is raised
|
||||
/// (16384) so chain-of-thought is not truncated mid-reasoning at the old 2048.
|
||||
#[serde(default)]
|
||||
pub max_new: Option<u32>,
|
||||
#[serde(default)]
|
||||
pub sampling: SamplingDefaults,
|
||||
|
||||
@@ -263,6 +268,12 @@ impl Config {
|
||||
self.language.clone().unwrap_or_else(|| "it".to_string())
|
||||
}
|
||||
|
||||
/// Effective default generation budget: config `max_new` > 16384. This is the
|
||||
/// ceiling on reasoning + answer tokens when a request/session sets none.
|
||||
pub fn max_new_default(&self) -> u32 {
|
||||
self.max_new.unwrap_or(16384)
|
||||
}
|
||||
|
||||
/// The top-level keys present in the file that we are not acting on —
|
||||
/// reported by `--check` so the shared-file contract stays visible.
|
||||
pub fn ignored_keys(&self) -> Vec<&str> {
|
||||
@@ -395,6 +406,14 @@ mod tests {
|
||||
assert_eq!(keys, " temperature=1.0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn max_new_default_and_override() {
|
||||
let cfg = Config::parse(REAL, "test").unwrap();
|
||||
assert_eq!(cfg.max_new_default(), 16384); // absent -> raised default
|
||||
let cfg2 = Config::parse(r#"{"exe":"/x/e","max_new":8192}"#, "test").unwrap();
|
||||
assert_eq!(cfg2.max_new_default(), 8192);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn timeouts_default_and_override() {
|
||||
let cfg = Config::parse(REAL, "test").unwrap();
|
||||
|
||||
Reference in new issue
Block a user