Principle:Ollama Ollama Hyperparameter Extraction
| Knowledge Sources | |
|---|---|
| Domains | Model_Architecture, Format_Conversion |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
A metadata extraction mechanism that maps model hyperparameters from HuggingFace config.json fields to GGUF key-value metadata entries.
Description
Hyperparameter Extraction converts architecture-specific configuration fields (hidden_size, num_attention_heads, num_hidden_layers, intermediate_size, rope_theta, etc.) from HuggingFace's JSON config format into GGUF's key-value metadata format.
Each architecture has different config field names and may require computed values. For example, LLaMA models need to compute the GQA key-value head count from num_key_value_heads, and RoPE parameters may need to be derived from rope_scaling configuration.
Usage
Use this principle when converting model configuration between different ML framework formats. The extraction must be architecture-aware since different model families use different config field names and conventions.
Theoretical Basis
The extraction maps config.json fields to GGUF KV entries:
| HuggingFace (config.json) | GGUF Key |
|---|---|
| hidden_size | {arch}.embedding_length |
| num_hidden_layers | {arch}.block_count |
| num_attention_heads | {arch}.attention.head_count |
| num_key_value_heads | {arch}.attention.head_count_kv |
| intermediate_size | {arch}.feed_forward_length |
| rms_norm_eps | {arch}.attention.layer_norm_rms_epsilon |
| rope_theta | {arch}.rope.freq_base |
| vocab_size | tokenizer.ggml.tokens (array) |