* Returns a warning string if speculative decoding appears to be HURTING * throughput (draft-on median meaningfully below draft-off median), else null. * Warns at most once per session to avoid nagging.
()
| 160 | * Warns at most once per session to avoid nagging. |
| 161 | */ |
| 162 | checkRegression(): string | null { |
| 163 | if (this.warned) return null; |
| 164 | const on = this.median(this.withDraft); |
| 165 | const off = this.median(this.withoutDraft); |
| 166 | if (on === null || off === null) return null; |
| 167 | // 10% slower with the draft on → it's not helping for this workload. |
| 168 | if (on < off * 0.9) { |
| 169 | this.warned = true; |
| 170 | return `Speculative decoding looks counterproductive here: ~${on.toFixed(1)} tok/s with the draft vs ~${off.toFixed(1)} without. ` + |
| 171 | `Acceptance is likely low for this task. Consider a smaller/faster draft model, or disable it.`; |
| 172 | } |
| 173 | return null; |
| 174 | } |
| 175 | |
| 176 | stats(): { withDraftTps: number | null; withoutDraftTps: number | null } { |
| 177 | return { withDraftTps: this.median(this.withDraft), withoutDraftTps: this.median(this.withoutDraft) }; |
no test coverage detected