Tighten the tolerances

This commit is contained in:
Aaron Fenyes 2025-09-19 12:35:11 -07:00
parent bc17d71f4a
commit b74cbf10c1
2 changed files with 3 additions and 3 deletions

View file

@ -414,7 +414,7 @@ pub fn realize_gram(
let tol = scale_adjustment * scaled_tol;
// set up constants and variables related to minimizing the soft loss
const GRAD_TOL: f64 = 1e-9;
const GRAD_TOL: f64 = 1e-12;
let mut grad_size = f64::INFINITY;
let mut softness = 1.0;
@ -515,7 +515,7 @@ pub fn realize_gram(
// if we're near a minimum of the total loss, but the hard loss still
// isn't tolerably low, make the soft constraints softer
const SOFTNESS_BACKOFF_THRESHOLD: f64 = 1e-6;
const SOFTNESS_BACKOFF: f64 = 0.9;
const SOFTNESS_BACKOFF: f64 = 0.95;
if state.loss_hard >= tol && grad_size < softness * SOFTNESS_BACKOFF_THRESHOLD {
softness *= SOFTNESS_BACKOFF;
state = SearchState::from_config(gram, soft, softness, state.config);