This is a LoRA fine-tune of microsoft/Phi-4-mini-instruct adapted to the issue and pull request
history of the dotnet/runtime codebase. The goal is to move a small, efficient base model toward the
vocabulary, conventions, and recurring problems of one specific engineering domain so it reads and
responds in that domain's dialect.
This is the first step in my applied post-training track. Here I change what a small model knows by
fitting it to a domain I understand. The next step, the
Gemma 3 reasoning
adapter, changes how a model thinks rather than
what it knows. The step after that, the
Gemma 4
GlucoLens adapter, takes the same
instinct into a domain where the output is a structured rollout and the model has to refuse when it
is unsure. In parallel I built a transformer by hand in
gpt2-nano
to understand the layer underneath all of this.
The model is meant for assistance on the dotnet/runtime domain, reading issues and pull requests and
drafting responses in the terminology and style of that codebase. It is a research artifact, not a
production reviewer.
The model is not built for factual retrieval, and it can produce plausible but wrong statements. It
is not a source of professional medical or legal advice, and it is not suitable for safety critical
systems. Do not use it to generate harmful or misleading content.
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
3from peft import PeftModel
4
5BASE = "microsoft/Phi-4-mini-instruct"
6ADAPTER = "kotlarmilos/phi-4-mini-dotnet-runtime"
7
8bnb_config = BitsAndBytesConfig(
9 load_in_4bit=True,
10 bnb_4bit_quant_type="nf4",
11 bnb_4bit_use_double_quant=True,
12 bnb_4bit_compute_dtype=torch.bfloat16,
13)
14
15tokenizer = AutoTokenizer.from_pretrained(BASE, use_fast=True)
16base = AutoModelForCausalLM.from_pretrained(
17 BASE, quantization_config=bnb_config, device_map="auto", trust_remote_code=True,
18)
19model = PeftModel.from_pretrained(base, ADAPTER)
20
21def generate(prompt):
22 inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
23 output = model.generate(
24 **inputs, max_new_tokens=256, do_sample=True, temperature=0.7,
25 pad_token_id=tokenizer.eos_token_id,
26 )
27 return tokenizer.decode(output[0], skip_special_tokens=True)
28
29print(generate("Review the following code changes:"))
I do not report a held-out benchmark score for this model. The effect of fine-tuning is a shift
toward the repository's terminology and issue framing relative to the base model on the same prompts.
A labeled evaluation split drawn from held-out issues is the natural next step. See the repository for
details.