open-standards/eoc/eoc-rs/crates/eoc-spec-decode/src/error.rs
Transaction Science 3fe109d58f ingest batch 4: 9 crates · table-stakes completers across all three workspaces
OpenPay (3 crates, ~13k LOC, 175 tests)
  op-connect           sub-merchant onboarding + KYB + split-payments + payouts + 1099-K
  op-3ds2              3DS2.3 SCA processor (AReq/ARes/CReq/CRes/RReq/RRes + exemptions)
  op-tax               US/EU/UK/AU/CA/IN tax with Avalara/Stripe/CCH/Vertex/TaxJar adapters

Smart Byte (3 crates, ~7k LOC, 57 tests)
  smart-byte-libp2p    libp2p transport (kad/gossipsub/mdns/autonat/relay/dcutr/identify/ping/req_resp)
  smart-byte-crdt      LWW/GCounter/PnCounter/OrSet/LwwMap/RgaList/2P-Set + HLC + vector clock + Automerge/Yjs interop
  smart-byte-keri-witness  KERI key-rotation cycle + witness layer + watchers + recovery + delegation

EOC (3 crates, ~8k LOC, 108 tests)
  eoc-tools            function-calling across Anthropic/OpenAI/Google/Mistral/Cohere + parallel exec + sandbox
  eoc-multimodal       vision (CLIP/SigLIP/ColPali) + audio (Whisper/MMS) + video sampling + modality router
  eoc-spec-decode      vanilla + SpS-with-temp + lookahead speculative decoding + EAGLE/Medusa stubs

All three workspaces compile cleanly. Forbidden-unsafe, no unwrap outside tests.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-24 04:00:04 -04:00

54 lines
1.8 KiB
Rust

//! Typed errors for the speculative-decoding pipeline.
use thiserror::Error;
/// Errors raised by draft / target / orchestrator paths.
#[derive(Debug, Error)]
pub enum SpecDecodeError {
/// A draft model returned an empty proposal even though a non-zero
/// `k` was requested. Almost always a backend bug; the orchestrator
/// gives up rather than silently degrading to non-speculative
/// generation.
#[error("draft proposal was empty (k = {requested})")]
EmptyDraft {
/// The `k` the orchestrator asked for.
requested: usize,
},
/// A target backend returned no logits / no tokens, so verification
/// can't proceed.
#[error("target verification produced no output")]
EmptyVerification,
/// The draft model's logit width didn't match the target's
/// vocabulary; speculative decoding requires both to share a
/// vocabulary.
#[error("vocabulary mismatch: draft={draft}, target={target}")]
VocabMismatch {
/// Draft vocabulary size.
draft: usize,
/// Target vocabulary size.
target: usize,
},
/// A sampler rejected its input (empty / NaN logits, etc.).
#[error("sampler error: {0}")]
Sampling(String),
/// A backend invocation failed.
#[error("backend error: {0}")]
Backend(String),
/// Configuration is internally inconsistent (e.g. `k == 0`,
/// `max_new_tokens == 0`).
#[error("invalid configuration: {0}")]
Config(String),
/// Stub algorithm that requires a real backend implementation was
/// invoked. Carries the algorithm name for diagnostics.
#[error("algorithm '{0}' is a documented stub — see module docs")]
StubAlgorithm(&'static str),
}
/// Result alias for the crate.
pub type SpecDecodeResult<T> = std::result::Result<T, SpecDecodeError>;