Model Registry

ModelFamily

llm-core/src/commonMain/kotlin/sk/ainet/apps/llm/ModelRegistry.kt
enum class ModelFamily(
    val id: String,
    val displayName: String,
    val supportsToolCalling: Boolean,
    val chatTemplateFamily: String?
)
Family Display Name Tool Calling Template GGUF Architectures

LLAMA

LLaMA / Mistral

Yes

llama3

llama, mistral

QWEN

Qwen

Yes

qwen

qwen2, qwen3, qwen35

GEMMA

Gemma

Yes

gemma

gemma, gemma2, gemma3, gemma3n

APERTUS

Apertus

No

chatml

apertus

BERT

BERT

No

 — 

bert

VOXTRAL

Voxtral TTS

No

 — 

voxtral

ModelRegistry

object ModelRegistry {
    fun detect(architecture: String): ModelFamily
    fun detect(architecture: String, chatTemplate: String?): ModelFamily
}

Detects model family from the GGUF general.architecture field.

UnifiedModelLoader

llm-core/src/commonMain/kotlin/sk/ainet/apps/llm/UnifiedModelLoader.kt
object UnifiedModelLoader {
    fun peek(sourceProvider: () -> RandomAccessSource): GGUFModelInfo
}

Extracts model info without loading weights:

data class GGUFModelInfo(
    val architecture: String,    // e.g., "qwen3"
    val family: ModelFamily,     // e.g., ModelFamily.QWEN
    val contextLength: Int,
    val vocabSize: Int,
    val blockCount: Int,
    val embeddingLength: Int,
    val fields: Map<String, Any?>
)

Usage

val info = UnifiedModelLoader.peek {
    JvmRandomAccessSource.open(modelPath)
}
println("${info.family.displayName}: ${info.blockCount} layers, ${info.vocabSize} vocab")
// "Qwen: 36 layers, 151936 vocab"