Skip to main content

GgufModelConfig

Struct GgufModelConfig 

Source
pub struct GgufModelConfig {
    pub model_id: String,
    pub files: Vec<String>,
    pub tok_model_id: Option<String>,
    pub display_name: String,
    pub approx_memory: String,
    pub chat_template: Option<String>,
}
Expand description

Configuration for loading a GGUF model via mistral.rs.

This is the primary model format for on-device mobile/desktop inference because GGUF files are pre-quantized and load at their compressed size, avoiding the large memory spike of in-situ quantization.

Fields§

§model_id: String

HuggingFace model repository ID, e.g. "bartowski/Qwen2.5-1.5B-Instruct-GGUF".

§files: Vec<String>

GGUF filename(s) within the repository, e.g. ["Qwen2.5-1.5B-Instruct-Q4_K_M.gguf"].

§tok_model_id: Option<String>

Optional: explicit tokenizer model ID (required on Android where GGUF embedded tokenizers are not supported by the candle backend).

§display_name: String

Human-friendly display name, e.g. "Qwen 2.5 1.5B".

§approx_memory: String

Approximate memory footprint description, e.g. "~941 MB (GGUF Q4_K_M)".

§chat_template: Option<String>

Optional Jinja chat template string. When set, this overrides the template embedded in the GGUF file (if any). Required for older GGUF files that don’t embed a chat template (e.g. TheBloke models).

Implementations§

Source§

impl GgufModelConfig

Convenience constructors for common GGUF model configurations.

These mirror the constants in super::models but return a ready-to-use GgufModelConfig.

Source

pub fn from_supported_model_id(model_id: &str) -> Option<GgufModelConfig>

Resolve a model-management ID (a Hugging Face repository from SUPPORTED_MODELS, such as bartowski/Qwen_Qwen3-4B-Instruct-2507-GGUF) to the same configuration used by the inference engine. Keeping this mapping in one place prevents download and load support from drifting apart. None for an ID Onde doesn’t support.

Source

pub fn qwen25_0_5b() -> GgufModelConfig

Qwen 2.5 0.5B Instruct (GGUF Q4_K_M), ~380 MB.

Smallest option. Used on tvOS (Apple TV) where the memory limit is 2 GB.

Source

pub fn qwen25_1_5b() -> GgufModelConfig

Qwen 2.5 1.5B Instruct (GGUF Q4_K_M) — ~941 MB.

Lightest option, ideal for iOS and memory-constrained Android devices.

Source

pub fn qwen25_3b() -> GgufModelConfig

Qwen 2.5 3B Instruct (GGUF Q4_K_M) — ~1.93 GB.

Balanced quality/size for macOS desktops and high-RAM Android devices. Not recommended for iOS (OOM on 8 GB devices).

Source

pub fn qwen25_coder_1_5b() -> GgufModelConfig

Qwen 2.5 Coder 1.5B Instruct (GGUF Q4_K_M) — ~941 MB.

Dedicated coding model fine-tuned on 5.5T tokens of code and math data. Same qwen2 GGUF architecture as the general 1.5B — loads via the existing quantized_qwen.rs path without any mistral.rs changes. Same memory footprint as the general 1.5B but dramatically better at code generation, explanation, and debugging.

Preferred default for iOS, Android, and any coding-focused deployment.

Source

pub fn qwen25_coder_3b() -> GgufModelConfig

Qwen 2.5 Coder 3B Instruct (GGUF Q4_K_M) — ~1.93 GB.

Best on-device coding quality for macOS desktop. Fine-tuned on 5.5T tokens of code and math. Same qwen2 architecture as the general 3B. Not recommended for iOS due to memory constraints.

Source

pub fn qwen25_coder_7b() -> GgufModelConfig

Qwen 2.5 Coder 7B Instruct (GGUF Q4_K_M) — ~4.4 GB.

Strong coding model with tool/function calling support via the Qwen2.5 chat template. Uses the qwen2 architecture. Requires 8+ GB RAM.

Source

pub fn qwen3_0_6b() -> GgufModelConfig

Qwen 3 0.6B (GGUF Q4_K_M) — smallest Qwen 3 variant, ~0.5 GB.

Lightest tool-capable Qwen 3 model; fits tvOS and the most memory-constrained mobile devices. Extended thinking mode — load with max_tokens ≥ 4096.

Source

pub fn qwen3_1_7b() -> GgufModelConfig

Qwen 3 1.7B (GGUF Q4_K_M) — lightweight tool-calling, ~1.3 GB.

Source

pub fn qwen3_4b() -> GgufModelConfig

Qwen 3 4B (GGUF Q4_K_M) — ~2.7 GB.

Full OpenAI-compatible tool calling with extended thinking mode. Always load with max_tokens ≥ 4096; the <think>…</think> block can consume 300–400 tokens before the real response begins.

Source

pub fn qwen3_8b() -> GgufModelConfig

Strong tool-calling model with extended thinking. Best balance of quality and memory for macOS with 24+ GB RAM.

Source

pub fn qwen3_14b() -> GgufModelConfig

Qwen 3 14B (GGUF Q4_K_M) — ~8.4 GB.

Strong reasoning and tool-calling model with extended thinking. Best all-around model for macOS with 16+ GB RAM.

Source

pub fn qwen3_32b() -> GgufModelConfig

Qwen 3 32B (GGUF Q4_K_M) — largest dense Qwen 3, ~19.8 GB.

Highest-quality dense Qwen 3 variant. Requires a high-memory desktop (32+ GB RAM / unified memory). Extended thinking and full tool calling.

Source

pub fn qwen3_4b_instruct_2507() -> GgufModelConfig

Qwen 3 4B Instruct 2507 (GGUF Q4_K_M) — latest non-thinking 4B, ~2.5 GB.

Updated instruction-tuned checkpoint that does not emit a <think> block, making it faster and more predictable for chat and tool use. Recommended general-purpose Qwen 3 model.

Source

pub fn qwen3_4b_thinking_2507() -> GgufModelConfig

Qwen 3 4B Thinking 2507 (GGUF Q4_K_M) — latest reasoning 4B, ~2.5 GB.

Updated thinking-only checkpoint with stronger reasoning and tool-use accuracy. Always emits a <think> block — load with max_tokens ≥ 4096.

Source

pub fn qwen3_30b_a3b_instruct_2507() -> GgufModelConfig

Qwen 3 30B-A3B Instruct 2507 (GGUF Q4_K_M) — flagship MoE, ~18.6 GB.

Mixture-of-experts model: 30B total parameters, ~3B active per token, so inference is far cheaper than a 30B dense model while quality rivals it. Loads via the qwen3moe GGUF architecture. Requires 32+ GB RAM.

Source

pub fn deepseek_coder_6_7b() -> GgufModelConfig

DeepSeek Coder v1 6.7B Instruct (GGUF Q4_K_M) — ~3.8 GB.

Strong code generation model using the llama GGUF architecture. Requires 8+ GB RAM; recommended for macOS desktops and Linux.

Source

pub fn platform_default() -> GgufModelConfig

Return the platform-appropriate default coding model config.

  • iOS / Android → Qwen 2.5 Coder 1.5B (~941 MB, fits mobile memory budgets)
  • macOS / Windows / Linux → Qwen 2.5 Coder 3B (~1.93 GB, best desktop quality)

Both are dedicated coding models (trained on 5.5T code + math tokens) and use the qwen2 GGUF architecture supported by mistral.rs.

Trait Implementations§

Source§

impl Clone for GgufModelConfig

Source§

fn clone(&self) -> GgufModelConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<UT> ConvertError<UT> for GgufModelConfig

Source§

impl Debug for GgufModelConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for GgufModelConfig

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<GgufModelConfig, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<UT> FfiConverter<UT> for GgufModelConfig

Source§

const TYPE_ID_META: MetadataBuffer

Type ID metadata, serialized into a MetadataBuffer.
Source§

type FfiType = RustBuffer

The low-level type used for passing values of this type over the FFI. Read more
Source§

fn lower(v: GgufModelConfig) -> RustBuffer

Lower a rust value of the target type, into an FFI value of type Self::FfiType. Read more
Source§

fn try_lift(buf: RustBuffer) -> Result<GgufModelConfig, Error>

Lift a rust value of the target type, from an FFI value of type Self::FfiType. Read more
Source§

fn write(obj: GgufModelConfig, buf: &mut Vec<u8>)

Write a rust value into a buffer, to send over the FFI in serialized form. Read more
Source§

fn try_read(buf: &mut &[u8]) -> Result<GgufModelConfig, Error>

Read a rust value from a buffer, received over the FFI in serialized form. Read more
Source§

impl<UT> Lift<UT> for GgufModelConfig

Source§

impl<UT> LiftRef<UT> for GgufModelConfig

Source§

impl<UT> LiftReturn<UT> for GgufModelConfig

Source§

type ReturnType = <GgufModelConfig as Lift<UT>>::FfiType

FFI return type for trait interfaces
Source§

fn try_lift_successful_return( v: <GgufModelConfig as LiftReturn<UT>>::ReturnType, ) -> Result<GgufModelConfig, Error>

Lift a successfully returned value from a trait interface
Source§

fn lift_foreign_return( ffi_return: Self::ReturnType, call_status: RustCallStatus, ) -> Self

Lift a foreign returned value from a trait interface Read more
Source§

fn lift_error(_buf: RustBuffer) -> Self

Lift a Rust value for a callback interface method error result Read more
Source§

fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self

Lift a Rust value for an unexpected callback interface error Read more
Source§

impl<UT> Lower<UT> for GgufModelConfig

Source§

impl<UT> LowerError<UT> for GgufModelConfig

Source§

fn lower_error(obj: GgufModelConfig) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for GgufModelConfig

Source§

type ReturnType = <GgufModelConfig as Lower<UT>>::FfiType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return( v: GgufModelConfig, ) -> Result<<GgufModelConfig as LowerReturn<UT>>::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
Source§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl Serialize for GgufModelConfig

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<UT> TypeId<UT> for GgufModelConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Source§

fn type_name(&self) -> &'static str

Gets the type name of self
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CompatExt for T

Source§

fn compat(self) -> Compat<T> ⓘ
where T: Sized,

Applies the Compat adapter by value. Read more
Source§

fn compat_ref(&self) -> Compat<&T> ⓘ

Applies the Compat adapter by shared reference. Read more
Source§

fn compat_mut(&mut self) -> Compat<&mut T> ⓘ

Applies the Compat adapter by mutable reference. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Downcast for T
where T: AsAny + ?Sized,

Source§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
Source§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ

Consume a handle, getting back the initial Arc<> Read more
Source§

unsafe fn get_arc(handle: Handle) -> Arc<Self> ⓘ

Get a clone of the Arc<> using a “borrowed” handle. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSync for T
where T: Sync + ?Sized,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SpeculativeProposePreparation for T
where T: Any + Send,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryClone for T
where T: Clone,

Source§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more