Soft-Trust: konfidenz-gewichtetes Stations-Trust schliesst den Nemesis-Rest

Leak 2 war mit dem 0.45-Aggressions-Tor grob gefixt (classify liest den
aggressiven Vielfalter als Regular, nicht Station). Die CMA-ES gegen die
reparierte Engine fand aber nemesis-2 knapp unter dem Tor (aggr 0.41) ->
voll getrustete Station -> -87.63 bb/100.

Wurzel: das binaere earned_trust (1.0/0.0) gibt einem Grenzfall den vollen
Exploit oder gar keinen. read_gate nennt die Loesung selbst - ein f64 fuer
"partial, confidence-weighted trust". station_trust() ist jetzt eine Rampe:
1.0 fuer echte passive Station (bit-identisch zu vorher, keine Regression),
linear auf 0 Richtung 0.45-Grenze.

Vier gemessene Kanaele, die das Stations-Profil lesen, je per toward_blind
mit dem Trust skaliert (bit-identisch bei c=1): adjust (Schwellen), style_rung
(Boden-Sprosse), range_model (Band-Stretch), fold_chance (Fold-Equity, der
dominante). nemesis-2 Memory -87.63 -> +83.72 bb/100 (Blind-Decke +114.01).

Beweis: Zwillings-Tor Gate::passes (OFFENSE +50.58, Boden gto -23.93 und
Exploitability 77.03 bit-identisch), Boden-Archetypen unregressiert,
101 Lib-Tests gruen. Der neue Worst-Case nemesis-3 (-26.59) ist read-invariant
(Oracle=Blind=Memory, classify Regular) - ein vorbestehendes River-Overbet-
Defense-Loch fuer den River-Solver, von diesem Fix unberuehrt.

Befunde: BEFUND-nemesis-soft-trust.md, BEFUND-nemesis-station-fehllabel.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 19:58:59 +01:00
co-authored by Claude Opus 4.8
parent efcff2b2fb
commit b360796d2e
11 changed files with 876 additions and 24 deletions
+11 -5
View File
@@ -1,6 +1,6 @@
use super::fold_equity_scale::{MAX_SCALE, MIN_SCALE};
use super::profile::Profile;
use super::style::classify;
use super::style::{classify, station_trust, Style};
use super::style_shift::shift_for;
use super::thresholds::Thresholds;
@@ -19,13 +19,19 @@ fn bounded(x: f64, (low, high): (f64, f64)) -> f64 {
}
/// `base` as seen against one profile; `None` when the profile says nothing.
///
/// A `CallingStation` shift is scaled by `station_trust`: a misclassified aggressive "station"
/// (loose width but postflop-aggressive — nemesis-2) gets a fraction of the value-bet-thinner shift,
/// not all of it. Every other style, and a genuine station (trust 1.0), is bit-identical to before.
fn against(base: Thresholds, profile: &Profile) -> Option<Thresholds> {
shift_for(classify(profile)).map(|shift| Thresholds {
call_margin: bounded(base.call_margin + shift.call_margin, CALL_MARGIN),
value_raise: bounded(base.value_raise + shift.value_raise, VALUE_RAISE),
let style = classify(profile);
let c = if style == Style::CallingStation { station_trust(profile) } else { 1.0 };
shift_for(style).map(|shift| Thresholds {
call_margin: bounded(base.call_margin + shift.call_margin * c, CALL_MARGIN),
value_raise: bounded(base.value_raise + shift.value_raise * c, VALUE_RAISE),
abstain_band: bounded(base.abstain_band, ABSTAIN_BAND),
fold_equity_scale: base.fold_equity_scale.clamp(MIN_SCALE, MAX_SCALE),
range_width_scale: bounded(base.range_width_scale * shift.range_width, RANGE_WIDTH),
range_width_scale: bounded(base.range_width_scale * (1.0 + (shift.range_width - 1.0) * c), RANGE_WIDTH),
})
}
+17 -5
View File
@@ -11,7 +11,7 @@
//! (`table_fold::pressure_ratio`).
use super::profile::Profile;
use super::style::{classify, Style};
use super::style::{classify, station_trust, Style};
/// Bet size (pot fraction) at which foldToBet is taken to be measured.
pub const REFERENCE_RATIO: f64 = 0.66;
@@ -32,13 +32,25 @@ fn style_default(style: Style) -> f64 {
}
/// The opponent's fold-to-bet at the reference size.
///
/// A `CallingStation` read is trust-weighted (`station_trust`): a misclassified aggressive "station"
/// (nemesis-2, fold-to-bet 0.56 read, aggr 0.41) only partly trusts its high fold frequency, so hero
/// does not over-barrel into a light-raising range whose multi-street cost the single-street bluff-EV
/// never models. A genuine station (trust 1.0) is bit-identical to the raw read.
pub fn fold_base(profile: Option<&Profile>) -> f64 {
match profile {
None => DEFAULT_FOLD_TO_BET,
Some(p) => match p.fold_to_bet.filter(|f| !f.is_nan()) {
Some(f) => f.clamp(0.0, 1.0),
None => style_default(classify(p)),
},
Some(p) => {
let raw = match p.fold_to_bet.filter(|f| !f.is_nan()) {
Some(f) => f.clamp(0.0, 1.0),
None => style_default(classify(p)),
};
if classify(p) == Style::CallingStation {
DEFAULT_FOLD_TO_BET + station_trust(p) * (raw - DEFAULT_FOLD_TO_BET)
} else {
raw
}
}
}
}
+27 -3
View File
@@ -5,24 +5,48 @@ use super::range_spec::RangeSpec;
use super::role_band::role_band;
use super::role_from_history::role_of;
use super::street_continuation::continuations;
use super::style::{classify, station_trust, Style};
use crate::game::{Spot, Villain};
use crate::preflop::seat_position::seat_position;
/// Without a readable preflop role the band is the plain vpip share.
/// Confidence weight for how much this villain's read may widen the modeled range: `1.0` for every
/// non-station and every genuine station (bit-identical to the binary gate), a fraction for a
/// misclassified aggressive "station" (loose width but postflop-aggressive — the CMA-ES nemesis-2,
/// aggr 0.41 → 0.16). A wide `vpip` read only widens the modeled betting range as far as the read is
/// trusted, so a wide-preflop-but-TIGHT-betting opponent is no longer modeled as an over-weak range
/// the engine then over-calls. See `station_trust` and BEFUND-nemesis-soft-trust.
fn range_trust(villain: &Villain) -> f64 {
match villain.profile.as_ref() {
Some(p) if classify(p) == Style::CallingStation => station_trust(p),
_ => 1.0,
}
}
/// Pull a read-driven value `x` toward its blind baseline by trust `c`: full read at `c = 1`, pure
/// blind at `c = 0`.
fn toward_blind(blind: f64, x: f64, c: f64) -> f64 {
blind + c * (x - blind)
}
/// Without a readable preflop role the band is the plain vpip share — trust-blended toward the
/// default (blind) vpip so a low-trust station does not over-widen the band.
fn unknown_role_band(villain: &Villain) -> (f64, f64) {
let vpip = villain
.profile
.and_then(|p| p.vpip)
.filter(|v| !v.is_nan())
.map_or(DEFAULT_VPIP, |v| v.clamp(0.02, 1.0));
(0.0, vpip)
(0.0, toward_blind(DEFAULT_VPIP, vpip, range_trust(villain)))
}
fn preflop_band(spot: &Spot, villain: &Villain) -> (f64, f64) {
match role_of(&spot.history, villain.seat) {
Some(role) => {
let (lo, hi) = role_band(spot, role, seat_position(spot, villain.seat));
stretched(lo, hi, stretch(role, villain.profile))
// The read stretches the band by the villain's looseness; blind stretch is 1.0. Trust
// scales how far the band is stretched, so a misread station's wide vpip barely widens it.
let factor = toward_blind(1.0, stretch(role, villain.profile), range_trust(villain));
stretched(lo, hi, factor)
}
None => unknown_role_band(villain),
}
+137 -4
View File
@@ -24,25 +24,47 @@ const NIT_FOLD_TO_BET: f64 = 0.65;
const NIT_MAX_VPIP_WITH_FOLDS: f64 = 0.25;
const STATION_FOLD_TO_BET: f64 = 0.30;
const STATION_MIN_VPIP: f64 = 0.28;
/// A calling station is loose AND postflop-passive. Above this postflop aggression frequency a
/// loose-but-not-raising player is not a station — it only looks loose preflop. Sits between the
/// reg archetype's measured 0.31 and the maniac's ~0.49; the CMA-ES nemesis measures 0.62. See the
/// `an_aggressive_loose_folder_is_not_a_station` regression test and BEFUND-nemesis-station-fehllabel.
const STATION_MAX_AGGRESSION: f64 = 0.45;
/// At or below this postflop aggression a loose-path station is trusted in FULL (`station_trust`
/// 1.0). Between here and `STATION_MAX_AGGRESSION` the station exploit is scaled down linearly — a
/// confidence ramp, not a cliff. Set above the real stations (fish 0.11, oracle 0.02) so they stay
/// bit-identical, and below the reg archetype (0.31) so a misread aggressive "station" (nemesis-2
/// aggr 0.41 → trust 0.16) barely exploits. See `station_trust` and BEFUND-nemesis-soft-trust.
const STATION_FULL_TRUST_AGGRESSION: f64 = 0.20;
/// A frequency in `[0, 1]`; NaN means "not known".
fn frequency(x: Option<f64>) -> Option<f64> {
x.filter(|v| !v.is_nan()).map(|v| v.clamp(0.0, 1.0))
}
/// Thresholds (vpip/pfr/foldToBet are all clamped to `[0, 1]` first, NaN counts as missing):
/// Thresholds (vpip/pfr/foldToBet/aggression are all clamped to `[0, 1]` first, NaN counts as missing):
/// - all missing: `Unknown`
/// - vpip >= 35 % and pfr >= 20 %: `LooseAggressive`
/// - vpip >= 35 % otherwise, or foldToBet <= 30 % with vpip >= 28 % (or unknown): `CallingStation`
/// - (vpip >= 35 % AND aggression < 45 % or unknown), or foldToBet <= 30 % with vpip >= 28 % (or
/// unknown): `CallingStation`
/// - vpip <= 15 %, or foldToBet >= 65 % with vpip <= 25 % (or unknown): `Nit`
/// - else `Regular`
///
/// A station is loose AND passive: the `loose` → `CallingStation` path is gated on postflop
/// aggression (`STATION_MAX_AGGRESSION`) so a loose-preflop but aggression-heavy frequent-folder
/// (the CMA-ES nemesis: vpip 0.53, pfr 0.14, foldToBet 0.65, aggression 0.62) reads `Regular` — gated
/// to blind by `read_gate`, the proven-safe baseline — instead of being handed `earned_trust 1.0`
/// and the station exploit it then bled −448 bb/100 to. The `sticky` path (fold ≤ 30 %) is a real
/// non-folder and stays a station regardless of aggression.
pub fn classify(profile: &Profile) -> Style {
let (vpip, pfr, fold) = (
let (vpip, pfr, fold, aggr) = (
frequency(profile.vpip),
frequency(profile.pfr),
frequency(profile.fold_to_bet),
frequency(profile.aggression),
);
let loose = vpip.is_some_and(|v| v >= LOOSE_VPIP);
// Postflop-passive: a station does not fire back. Unknown aggression keeps the old behaviour.
let passive = aggr.is_none_or(|a| a < STATION_MAX_AGGRESSION);
let sticky = fold.is_some_and(|b| b <= STATION_FOLD_TO_BET)
&& vpip.is_none_or(|v| v >= STATION_MIN_VPIP);
let tight = vpip.is_some_and(|v| v <= NIT_VPIP)
@@ -52,7 +74,7 @@ pub fn classify(profile: &Profile) -> Style {
Style::Unknown
} else if loose && pfr.is_some_and(|f| f >= AGGRESSIVE_PFR) {
Style::LooseAggressive
} else if loose || sticky {
} else if (loose && passive) || sticky {
Style::CallingStation
} else if tight {
Style::Nit
@@ -60,3 +82,114 @@ pub fn classify(profile: &Profile) -> Style {
Style::Regular
}
}
/// How much to trust a `CallingStation` read, in `[0, 1]` — the confidence-weighted generalization
/// of the binary `earned_trust` gate (`engine::read_gate` keeps a station's profile or drops it; this
/// says HOW MUCH of the station exploit to apply to what it keeps). Only meaningful for a profile
/// that already classifies `CallingStation`; the station-exploit channels (`adjust`'s value shift,
/// `style_rung`'s made-floor rung) scale their deviation from blind by this weight.
///
/// A station earns full trust on either signal: it does not fold (sticky, `fold_to_bet` ≤ 30 %) —
/// value-betting it thin is always right — OR it is postflop-passive (low `aggression`). The
/// aggression ramp governs only the loose-WIDTH path, where a high `vpip` alone made the old binary
/// gate hand full trust to aggressive frequent-folders (the CMA-ES nemesis-2, aggr 0.41, folds 56 %)
/// that then bled to the over-call. Unknown aggression keeps the old full trust (no postflop sample
/// to doubt). A genuine station (fish, oracle) returns exactly `1.0` → bit-identical to the old gate.
pub fn station_trust(profile: &Profile) -> f64 {
// A real non-folder is a station on the strongest signal; aggression does not weaken that.
if frequency(profile.fold_to_bet).is_some_and(|b| b <= STATION_FOLD_TO_BET) {
return 1.0;
}
match frequency(profile.aggression) {
None => 1.0,
Some(a) => ((STATION_MAX_AGGRESSION - a)
/ (STATION_MAX_AGGRESSION - STATION_FULL_TRUST_AGGRESSION))
.clamp(0.0, 1.0),
}
}
#[cfg(test)]
mod tests {
use super::*;
fn profile(vpip: f64, pfr: f64, fold: f64, aggr: f64) -> Profile {
Profile {
vpip: Some(vpip),
pfr: Some(pfr),
fold_to_bet: Some(fold),
aggression: Some(aggr),
..Profile::default()
}
}
/// The CMA-ES nemesis read: loose preflop (vpip 0.53) but a hyper-aggressive frequent-folder
/// (aggression 0.62, foldToBet 0.65). Width alone made the old `loose` path label it a station,
/// handing it earned_trust and the station exploit it bled −448 bb/100 to. It must read `Regular`
/// (gated to blind), not `CallingStation`.
#[test]
fn an_aggressive_loose_folder_is_not_a_station() {
let p = profile(0.53, 0.14, 0.65, 0.62);
assert_eq!(classify(&p), Style::Regular);
}
/// A genuinely loose-passive opponent (low aggression) is still a `CallingStation` — the fix
/// gates on aggression, not on preflop width, so the real station is untouched.
#[test]
fn a_loose_passive_opponent_is_still_a_station() {
let p = profile(0.70, 0.05, 0.25, 0.10);
assert_eq!(classify(&p), Style::CallingStation);
}
/// A sticky non-folder (foldToBet ≤ 30 %) stays a station regardless of aggression — not folding
/// is itself the station signal; the aggression gate applies only to the `loose` path.
#[test]
fn a_sticky_non_folder_stays_a_station_even_if_aggressive() {
let p = profile(0.40, 0.10, 0.20, 0.60);
assert_eq!(classify(&p), Style::CallingStation);
}
/// Aggression unknown (not yet measured) keeps the old width-based station read, so nothing
/// regresses for profiles without a postflop sample.
#[test]
fn unknown_aggression_keeps_the_width_based_station() {
let p = Profile { vpip: Some(0.50), pfr: Some(0.10), fold_to_bet: Some(0.45), ..Profile::default() };
assert_eq!(classify(&p), Style::CallingStation);
}
/// A genuine passive station (fish: aggr 0.11) and a non-folder earn FULL trust — the soft gate
/// is bit-identical to the old binary gate for the stations that were always right to exploit.
#[test]
fn a_passive_station_earns_full_trust() {
let fish = profile(0.55, 0.08, 0.40, 0.11); // loose path (folds 40 %), very passive
assert_eq!(station_trust(&fish), 1.0);
let non_folder = profile(0.40, 0.10, 0.20, 0.60); // sticky: never folds → full trust despite aggression
assert_eq!(station_trust(&non_folder), 1.0);
}
/// A misclassified aggressive loose "station" (nemesis-2: loose width, folds 56 %, aggr 0.41)
/// earns only a sliver of trust, so the station exploit barely fires on it.
#[test]
fn a_misread_aggressive_station_earns_little_trust() {
let nemesis2 = profile(0.65, 0.15, 0.56, 0.41);
let c = station_trust(&nemesis2);
assert!(c > 0.0 && c < 0.25, "expected a small trust, got {c}");
}
/// Trust falls monotonically as the loose-path station gets more aggressive, reaching 0 at the
/// classify boundary — a smooth handoff to `Regular` (gated blind), no cliff.
#[test]
fn loose_station_trust_ramps_down_with_aggression() {
let at = |a: f64| station_trust(&profile(0.55, 0.10, 0.50, a));
assert_eq!(at(0.20), 1.0);
assert!((at(0.325) - 0.5).abs() < 1e-9);
assert_eq!(at(0.45), 0.0);
assert!(at(0.25) > at(0.35));
}
/// Unknown aggression keeps full trust: no postflop sample is no reason to doubt the read.
#[test]
fn unknown_aggression_keeps_full_station_trust() {
let p = Profile { vpip: Some(0.50), pfr: Some(0.10), fold_to_bet: Some(0.45), ..Profile::default() };
assert_eq!(station_trust(&p), 1.0);
}
}
+11 -4
View File
@@ -1,12 +1,19 @@
use super::style::{classify, Style};
use super::style::{classify, station_trust, Style};
use crate::game::Villain;
/// How a villain's style moves a made-hand floor on `made_ladder`: looser styles
/// (calling station, loose-aggressive) one rung down, the nit one up.
///
/// The station's `-1` rung (model its bets one rung weaker → bluff-catch wider) is confidence-gated:
/// it fires only for a genuinely passive station (`station_trust` ≥ 0.5). A misclassified aggressive
/// "station" (nemesis-2, aggr 0.41 → trust 0.16) keeps the blind made-floor and is not over-called.
/// A genuine passive station / non-folder (trust 1.0) rounds to `-1`, bit-identical to before.
pub fn style_rung(villain: &Villain) -> i32 {
match villain.profile.map(|p| classify(&p)) {
Some(Style::CallingStation | Style::LooseAggressive) => -1,
Some(Style::Nit) => 1,
let Some(profile) = villain.profile.as_ref() else { return 0 };
match classify(profile) {
Style::CallingStation => -(station_trust(profile).round() as i32),
Style::LooseAggressive => -1,
Style::Nit => 1,
_ => 0,
}
}