Model Description

Mellum-4b-sft-kotlin is a fine-tuned version of JetBrains' first open-source large language model (LLM) optimized for code-related tasks.

Pre-trained on over 4 trillion tokens with a context window of 8192 tokens across multiple programming languages, and then fine-tuned, Mellum-4b-sft-kotlin is tailored specifically for code completion in Kotlin. The model follows a LLaMA-style architecture with 4 billion parameters, making it efficient for both cloud inference (e.g., via vLLM) and local deployment (e.g., using llama.cpp or Ollama).

Mellum was trained using Automatic Mixed Precision (AMP) with bf16 precision. The uploaded version on Hugging Face retains the bf16 format for public use.

Designed for integration into professional developer tooling (e.g., intelligent code suggestions in IDEs), AI-powered coding assistants, and research on code understanding and generation, Mellum is also well-suited for educational applications and fine-tuning experiments.

Limitations

  • Biases: May reflect biases present in public codebases. For example it will likely produce code which is similar in style to the open-source repositories.
  • Security: Code suggestions should not be assumed to be secure or free of vulnerabilities.

Sample Usage

Here is an example of how to run and sample from the model with additional files context and fill in the middle.

Fill in the middle with additional files as context generation

import json
from transformers import AutoTokenizer, AutoModelForCausalLM

example = """
<filename>Utils.kt
package utils

fun multiply(x: Int, y: Int): Int {
    return x * y
}

<filename>Config.kt
package config

object Config {
    const val DEBUG = true
    const val MAX_VALUE = 100
}

<filename>Example.kt
<fim_suffix>
fun main() {
    val result = calculateSum(5, 10)
    println(result)
}
<fim_prefix>fun calculateSum(a: Int, b: Int): Int {
<fim_middle>
"""

tokenizer = AutoTokenizer.from_pretrained('JetBrains/Mellum-4b-sft-kotlin')
model = AutoModelForCausalLM.from_pretrained('JetBrains/Mellum-4b-sft-kotlin')
encoded_input = tokenizer(example, return_tensors='pt', return_token_type_ids=False)
out = model.generate(
    **encoded_input,
    max_new_tokens=100,
)

Citation

If you use this model, please cite:

@misc{Mellum-4b-base,
  title     = {Mellum-4b-base},
  author    = {Pavlichenko, Nikita and Nazarov, Iurii and Dolgov, Ivan and Garanina, Ekaterina and Lasocki, Karol and Reshetnikova, Julia and Boitsov, Sergei and Bondyrev, Ivan and Karaeva, Dariia and Sheptyakov, Maksim and Ustalov, Dmitry and Mukhin, Artem and Proshev, Semyon and Abramov, Nikita and Kolomyttseva, Olga and Lysaniuk, Kseniia and Zavidnyi, Ilia and Semenkin, Anton and Tankov, Vladislav and Sazanovich, Uladzislau},
  year      = {2025},
}

Contact

For questions, collaborations and requests reach us out via [email protected]

Downloads last month
48
Safetensors
Model size
4.02B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for JetBrains/Mellum-4b-sft-kotlin

Finetuned
(4)
this model

Datasets used to train JetBrains/Mellum-4b-sft-kotlin

Collection including JetBrains/Mellum-4b-sft-kotlin