Gemma3nModelMetadata

data class Gemma3nModelMetadata(val architecture: String, val embeddingLength: Int, val perLayerEmbeddingLength: Int, val contextLength: Int, val blockCount: Int, val headCount: Int, val kvHeadCount: Int, val feedForwardLengths: List<Int>, val headDim: Int, val vocabSize: Int, val slidingWindow: Int, val ropeBaseLocal: Float, val ropeBaseGlobal: Float, val kvSharedLayers: Int, val layerPattern: List<String>)(source)

Metadata for Gemma 3n models extracted from GGUF files.

Gemma 3n has several unique characteristics:

  • Variable intermediate (FFN) sizes per layer (MatFormer architecture)

  • Hybrid attention pattern (4 local sliding-window + 1 global)

  • Per-layer embeddings (optional)

  • KV cache sharing for the last N layers

Constructors

Link copied to clipboard
constructor(architecture: String, embeddingLength: Int, perLayerEmbeddingLength: Int, contextLength: Int, blockCount: Int, headCount: Int, kvHeadCount: Int, feedForwardLengths: List<Int>, headDim: Int, vocabSize: Int, slidingWindow: Int, ropeBaseLocal: Float, ropeBaseGlobal: Float, kvSharedLayers: Int, layerPattern: List<String>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun getCacheLayerIndex(layerIdx: Int): Int

Returns the cache layer index for the given layer. Shared layers map to a single cache slot.

Link copied to clipboard
fun getEffectiveWindow(layerIdx: Int): Int

Returns the effective attention window size for the given layer. Sliding layers use slidingWindow, global layers use contextLength.

Link copied to clipboard
fun getFeedForwardLength(layerIdx: Int): Int

Returns the feed-forward dimension for the given layer.

Link copied to clipboard
fun getLayerType(layerIdx: Int): LayerType

Returns the layer type at the given layer index. Pattern repeats: "sliding", "sliding", "sliding", "sliding", "full"

Link copied to clipboard
fun getRopeBase(layerIdx: Int): Float

Returns the RoPE base frequency for the given layer. Local/sliding layers use ropeBaseLocal (10k), global layers use ropeBaseGlobal (1M).

Link copied to clipboard
fun isKvShared(layerIdx: Int): Boolean

Returns whether the given layer shares its KV cache with another layer. The last kvSharedLayers layers share their KV cache.