NockAI commited on
Commit
7a59eda
·
verified ·
1 Parent(s): 133b237

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -10
README.md CHANGED
@@ -1,19 +1,43 @@
1
  ---
2
  license: apache-2.0
3
  base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
 
4
  library_name: transformers
5
  pipeline_tag: text-generation
 
 
6
  tags:
7
  - code
8
  - solidity
9
  - lora
 
10
  ---
11
 
 
 
12
  # nock-coder-1.5b
13
 
14
- Nock Coder is an open coding model from NockAI, tuned to answer with the code first and keep 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). A 4 bit GGUF build of about 1 GB for Ollama and llama.cpp is in [Nock-AI/nock-coder-1.5b-GGUF](https://huggingface.co/Nock-AI/nock-coder-1.5b-GGUF).
 
 
 
 
 
 
 
 
 
 
15
 
16
- ## Use
 
 
 
 
 
 
 
 
17
 
18
  ```python
19
  from transformers import AutoModelForCausalLM, AutoTokenizer
@@ -29,18 +53,51 @@ output = model.generate(**inputs, max_new_tokens=300, do_sample=False)
29
  print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
30
  ```
31
 
32
- ## Results so far
 
 
33
 
34
- On 50 short coding prompts, greedy decoding, full precision: 54.5 words per answer, 16.4 words outside code, 50 of 50 answers start with code, 0 of 50 have no code. Measured before quantization; numbers for the GGUF build and every raw answer are at https://nockai.dev/evaluation/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  ## Training
37
 
38
- - Method: LoRA (rank 16, alpha 32, all linear layers), 2 epochs, maximum length 1024 tokens.
39
- - Data: 2500 examples from [ise-uiuc/Magicoder-OSS-Instruct-75K](https://huggingface.co/datasets/ise-uiuc/Magicoder-OSS-Instruct-75K) (MIT), 1500 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 cut to the first code block plus at most one sentence. Rows that overlap the evaluation prompts were removed. The datasets contain text generated by other language models.
 
 
 
 
 
 
40
 
41
  ## Limitations
42
 
43
- - This is a 1.5B model. It makes mistakes, and its code can be wrong or insecure.
44
- - Smart contract output is not audited. Do not deploy it without review by a qualified person.
45
- - HumanEval and Solidity compile results are not published yet.
46
- - NockAI is independent and not affiliated with Robinhood or Alibaba.
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
4
+ base_model_relation: finetune
5
  library_name: transformers
6
  pipeline_tag: text-generation
7
+ language:
8
+ - en
9
  tags:
10
  - code
11
  - solidity
12
  - lora
13
+ - qwen2
14
  ---
15
 
16
+ ![Nock Coder](assets/banner.png)
17
+
18
  # nock-coder-1.5b
19
 
20
+ Nock Coder is an open coding model from NockAI. It is tuned to answer with the code first and keep any explanation to one short sentence. The 4 bit build is a 986 MB file that runs on an ordinary laptop with Ollama or llama.cpp, on Windows, macOS and Linux, with no GPU needed.
21
+
22
+ This repo holds the full model in safetensors. For the 1 GB file, see [Nock-AI/nock-coder-1.5b-GGUF](https://huggingface.co/Nock-AI/nock-coder-1.5b-GGUF).
23
+
24
+ | | |
25
+ |---|---|
26
+ | Base model | [Qwen/Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) (Apache 2.0) |
27
+ | Parameters | 1.54B |
28
+ | Method | LoRA fine tune, merged into the base weights |
29
+ | Context used in training | 1,024 tokens |
30
+ | License | Apache 2.0 |
31
 
32
+ ## Run it
33
+
34
+ With Ollama (the 1 GB build):
35
+
36
+ ```
37
+ ollama run hf.co/Nock-AI/nock-coder-1.5b-GGUF
38
+ ```
39
+
40
+ With transformers:
41
 
42
  ```python
43
  from transformers import AutoModelForCausalLM, AutoTokenizer
 
53
  print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
54
  ```
55
 
56
+ The default system prompt in the chat template is already set to Nock Coder's. You don't need to pass one.
57
+
58
+ ## Results
59
 
60
+ 50 short coding prompts across Python, JavaScript, TypeScript, SQL, Go, Rust, Java, C#, shell, Git, CSS and Docker. Greedy decoding, no system prompt passed.
61
+
62
+ | | Base model | Nock Coder v1 | Nock Coder v2 |
63
+ |---|---|---|---|
64
+ | Words per answer | 184 | 48 | 54 |
65
+ | Words outside the code | 133 | 17 | 16 |
66
+ | Answers that start with code | 1 of 50 | 27 of 50 | 50 of 50 |
67
+ | Answers with no code at all | 0 of 50 | 12 of 50 | 0 of 50 |
68
+
69
+ Base model and v1 were measured on the 4 bit GGUF with Ollama. v2 was measured in full precision on an earlier training run of the same recipe (same data and settings), with the same 50 prompts. This published build will be re-measured on the 4 bit GGUF with the v1 harness, and those numbers will replace these. Every raw answer is published at https://nockai.dev/evaluation/
70
+
71
+ HumanEval and Solidity compile results are not published yet, so we make no claim about code correctness.
72
+
73
+ ## What changed in v2
74
+
75
+ In v1, 12 of 50 answers had no code. All 12 were short one line requests, such as "Reverse a string in Python.", and two answers said they came from Alibaba Cloud, which showed the runtime was not passing our system prompt. v2:
76
+
77
+ - adds short one line requests with code answers,
78
+ - trains half the examples with the base model's default system prompt, so the behavior is in the weights and does not depend on the runtime,
79
+ - removes training rows that overlap the 50 evaluation prompts,
80
+ - updates the identity answers ("I'm Nock Coder, an open coding model from NockAI").
81
 
82
  ## Training
83
 
84
+ - LoRA rank 16, alpha 32, dropout 0.05, on all seven projection matrices (q, k, v, o, gate, up, down) in all 28 blocks: 18.5M trainable parameters, 1.2% of the model.
85
+ - 2 epochs, learning rate 2e-4, cosine schedule, effective batch 16, on one free Colab T4.
86
+ - Data:
87
+ - 2,500 general coding examples from [ise-uiuc/Magicoder-OSS-Instruct-75K](https://huggingface.co/datasets/ise-uiuc/Magicoder-OSS-Instruct-75K) (MIT)
88
+ - 1,500 short requests from [ise-uiuc/Magicoder-Evol-Instruct-110K](https://huggingface.co/datasets/ise-uiuc/Magicoder-Evol-Instruct-110K) (Apache 2.0)
89
+ - 500 Solidity examples from [AlfredPros/smart-contracts-instructions](https://huggingface.co/datasets/AlfredPros/smart-contracts-instructions) (MIT)
90
+ - 72 identity examples
91
+ - Every answer was cut to its first code block plus at most one sentence. The datasets contain text generated by other language models.
92
 
93
  ## Limitations
94
 
95
+ - This is a 1.5B model. It makes mistakes, and its code can be wrong or insecure. Review it before you run it.
96
+ - Smart contract output is not audited. Have contracts reviewed by a qualified person before you deploy them.
97
+ - It is tuned for short answers, so it is a poor fit for long explanations or design discussions.
98
+ - NockAI is an independent project and is not affiliated with Robinhood, Alibaba or Nockchain.
99
+
100
+ ## Links
101
+
102
+ - Website and results: https://nockai.dev
103
+ - X: https://x.com/useNockAI