Upload NextStep-Coder-MoE LoRA adapter
Browse files
README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: transformers
|
| 6 |
+
tags:
|
| 7 |
+
- code
|
| 8 |
+
- reasoning
|
| 9 |
+
- chain-of-thought
|
| 10 |
+
- lora
|
| 11 |
+
- moe
|
| 12 |
+
- fine-tuned
|
| 13 |
+
base_model: Qwen/Qwen2.5-Coder-1.5B
|
| 14 |
+
pipeline_tag: text-generation
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# NextStep-Coder-MoE
|
| 18 |
+
|
| 19 |
+
A high-performance tiny coding LLM with **Interleaved Thinking** capability for advanced reasoning and agentic workflows.
|
| 20 |
+
|
| 21 |
+
## Model Description
|
| 22 |
+
|
| 23 |
+
NextStep-Coder-MoE is a LoRA fine-tuned model based on Qwen2.5-Coder-1.5B, optimized for:
|
| 24 |
+
- Chain-of-Thought reasoning with `<think>...</think>` tags
|
| 25 |
+
- Multi-step coding tasks
|
| 26 |
+
- Agentic workflows (plan → act → reflect)
|
| 27 |
+
|
| 28 |
+
## Usage
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 32 |
+
from peft import PeftModel
|
| 33 |
+
|
| 34 |
+
# Load model
|
| 35 |
+
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-1.5B")
|
| 36 |
+
model = PeftModel.from_pretrained(base_model, "OsamaBinLikhon/NextStep-Coder-MoE")
|
| 37 |
+
tokenizer = AutoTokenizer.from_pretrained("OsamaBinLikhon/NextStep-Coder-MoE")
|
| 38 |
+
|
| 39 |
+
# Generate
|
| 40 |
+
prompt = "Write a Python function to check if a number is prime.\n<think>"
|
| 41 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 42 |
+
outputs = model.generate(**inputs, max_new_tokens=256)
|
| 43 |
+
print(tokenizer.decode(outputs[0]))
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## Training Details
|
| 47 |
+
|
| 48 |
+
| Parameter | Value |
|
| 49 |
+
|-----------|-------|
|
| 50 |
+
| Base Model | Qwen/Qwen2.5-Coder-1.5B |
|
| 51 |
+
| Method | LoRA (r=16, alpha=32) |
|
| 52 |
+
| Trainable Params | 18.4M (1.18%) |
|
| 53 |
+
| Precision | bf16 |
|
| 54 |
+
| Framework | Transformers + PEFT |
|
| 55 |
+
|
| 56 |
+
## Interleaved Thinking Format
|
| 57 |
+
|
| 58 |
+
The model uses `<think>` tags to show reasoning:
|
| 59 |
+
|
| 60 |
+
```
|
| 61 |
+
User: Write a binary search function.
|
| 62 |
+
|
| 63 |
+
Model: <think>
|
| 64 |
+
I need to implement binary search on a sorted array.
|
| 65 |
+
Key steps: find middle, compare, narrow search space.
|
| 66 |
+
Edge case: empty array returns -1.
|
| 67 |
+
</think>
|
| 68 |
+
|
| 69 |
+
def binary_search(arr, target):
|
| 70 |
+
left, right = 0, len(arr) - 1
|
| 71 |
+
while left <= right:
|
| 72 |
+
mid = (left + right) // 2
|
| 73 |
+
if arr[mid] == target:
|
| 74 |
+
return mid
|
| 75 |
+
elif arr[mid] < target:
|
| 76 |
+
left = mid + 1
|
| 77 |
+
else:
|
| 78 |
+
right = mid - 1
|
| 79 |
+
return -1
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## Intended Use
|
| 83 |
+
|
| 84 |
+
- Code generation with step-by-step reasoning
|
| 85 |
+
- Debugging and code review
|
| 86 |
+
- Algorithm design and explanation
|
| 87 |
+
- Educational coding assistance
|
| 88 |
+
|
| 89 |
+
## Limitations
|
| 90 |
+
|
| 91 |
+
- Best for Python, may vary for other languages
|
| 92 |
+
- Requires `<think>` tag retention in conversation history
|
| 93 |
+
- 2048 token context limit
|
| 94 |
+
|
| 95 |
+
## Author
|
| 96 |
+
|
| 97 |
+
**OsamaBinLikhon**
|
| 98 |
+
|
| 99 |
+
## License
|
| 100 |
+
|
| 101 |
+
Apache 2.0
|