--- license: apache-2.0 base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct base_model_relation: finetune library_name: transformers pipeline_tag: text-generation tags: - code - solidity - lora --- ![Nock Coder](assets/banner.png) # nock-coder-1.5b-v2.1 Nock Coder v2.1 is an open coding model from NockAI. It answers with the code first and keeps any explanation to one short sentence. It is a LoRA fine tune of [Qwen/Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct). The 1 GB build for Ollama and llama.cpp is [Nock-AI/nock-coder-1.5b-GGUF](https://huggingface.co/Nock-AI/nock-coder-1.5b-GGUF), which now serves v2.1. The v2 weights stay at [Nock-AI/nock-coder-1.5b](https://huggingface.co/Nock-AI/nock-coder-1.5b), where they are pinned for the Surplus launch. ## Run it ``` ollama run hf.co/Nock-AI/nock-coder-1.5b-GGUF ``` With transformers: ```python from transformers import AutoModelForCausalLM, AutoTokenizer model_id = "Nock-AI/nock-coder-1.5b-v2.1" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto") messages = [{"role": "user", "content": "Reverse a string in Python."}] text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) inputs = tokenizer(text, return_tensors="pt").to(model.device) output = model.generate(**inputs, max_new_tokens=300, do_sample=False) print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)) ``` The LoRA adapter itself is in the `adapter/` folder of this repo. ## Results All numbers come from the 4 bit GGUF files with Ollama: temperature 0, fixed seed, each model with its own default system prompt, on a Kaggle T4 (October 11, 2026). | | Base model | Nock Coder v2 | Nock Coder v2.1 | |---|---|---|---| | HumanEval, problems passed (of 164) | 112 | 104 | 118 | | Answers that start with code (of 50) | 1 | 50 | 50 | | Answers with no code at all (of 50) | 0 | 0 | 0 | | Words per answer | 185 | 51 | 50 | | Solidity tasks that compile with solc (of 15) | 8 | 11 | 10 | v2 passed 8 fewer HumanEval problems than the base model. v2.1 trains the same data more gently and passes 6 more than the base model while keeping the code first habit. Compiling is a low bar: it says nothing about whether a contract is correct or safe. Every raw answer: https://nockai.dev/evaluation/ ## Training - Method: LoRA, rank 16, alpha 32, on all 7 linear projections; 1 epoch, learning rate 1e-4 (v2 used 2 epochs at 2e-4), cosine schedule, effective batch 16, maximum length 1024 tokens, loss on the answers only. - Data: 2,500 examples from [ise-uiuc/Magicoder-OSS-Instruct-75K](https://huggingface.co/datasets/ise-uiuc/Magicoder-OSS-Instruct-75K) (MIT), 1,500 short requests from [ise-uiuc/Magicoder-Evol-Instruct-110K](https://huggingface.co/datasets/ise-uiuc/Magicoder-Evol-Instruct-110K) (Apache 2.0), 500 Solidity examples from [AlfredPros/smart-contracts-instructions](https://huggingface.co/datasets/AlfredPros/smart-contracts-instructions) (MIT), and 72 identity examples. Answers were reshaped to the first code block plus at most one sentence. Half the examples carry the base model's default system prompt. Rows that overlap the evaluation prompts were removed. The datasets contain text generated by other language models. - Hardware: one free T4 GPU, about 50 minutes. ## Limitations - This is a 1.5B model. It makes mistakes, and its code can be wrong or insecure. Review it before you run it. - Smart contract output is not audited. Have contracts reviewed by a qualified person before you deploy them. - NockAI is an independent project and is not affiliated with Robinhood, Alibaba or Nockchain.