Instructions to use Nock-AI/nock-coder-1.5b-v2.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nock-AI/nock-coder-1.5b-v2.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nock-AI/nock-coder-1.5b-v2.1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Nock-AI/nock-coder-1.5b-v2.1") model = AutoModelForCausalLM.from_pretrained("Nock-AI/nock-coder-1.5b-v2.1", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Nock-AI/nock-coder-1.5b-v2.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nock-AI/nock-coder-1.5b-v2.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nock-AI/nock-coder-1.5b-v2.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nock-AI/nock-coder-1.5b-v2.1
- SGLang
How to use Nock-AI/nock-coder-1.5b-v2.1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Nock-AI/nock-coder-1.5b-v2.1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nock-AI/nock-coder-1.5b-v2.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Nock-AI/nock-coder-1.5b-v2.1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nock-AI/nock-coder-1.5b-v2.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nock-AI/nock-coder-1.5b-v2.1 with Docker Model Runner:
docker model run hf.co/Nock-AI/nock-coder-1.5b-v2.1
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.
The 1 GB build for Ollama and llama.cpp is Nock-AI/nock-coder-1.5b-GGUF, which now serves v2.1. The v2 weights stay at 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:
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 (MIT), 1,500 short requests from ise-uiuc/Magicoder-Evol-Instruct-110K (Apache 2.0), 500 Solidity examples from 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.
- Downloads last month
- -
Model tree for Nock-AI/nock-coder-1.5b-v2.1
Base model
Qwen/Qwen2.5-1.5B