stas122 commited on
Commit
c7b8451
·
verified ·
1 Parent(s): 3eed10c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +129 -3
README.md CHANGED
@@ -1,3 +1,129 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ base_model:
6
+ - StentorLabs/Stentor-30M
7
+ ---
8
+ **Model Description**
9
+
10
+ Stentor Python 30M is a compact language model specifically fine-tuned for Python code generation and autocompletion tasks. Based on the Stentor-30M architecture, this model contains 30 million parameters and is designed to run efficiently on resource-constrained devices including mobile phones and embedded systems.
11
+
12
+ **Model Details**
13
+
14
+ - **Developed by:** Experimental fine-tuning project
15
+ - **Model type:** Causal language model (LlamaForCausalLM)
16
+ - **Language:** Python code, English instructions
17
+ - **Parameters:** 30,419,712
18
+ - **Context length:** 512 tokens
19
+ - **Model size:** 60 MB (FP16), 30 MB (INT8)
20
+ - **License:** Apache 2.0
21
+
22
+ **Training Data**
23
+
24
+ The model was fine-tuned on a curated dataset of 872 Python examples, including:
25
+
26
+ - Basic algorithms (factorial, prime numbers, list operations)
27
+ - Class implementations (Stack, BankAccount, Rectangle, Circle)
28
+ - Recursive functions (quicksort, Fibonacci)
29
+ - String manipulation (palindrome, anagram, vowel counting)
30
+ - MBPP (Mostly Basic Python Problems) dataset tasks
31
+
32
+ All examples follow a consistent format with "### Task:" instruction and "### Solution:" code block.
33
+
34
+ **Training Process**
35
+
36
+ The fine-tuning process involved multiple stages:
37
+
38
+ 1. Base model: Stentor-30M pre-trained checkpoint
39
+ 2. Initial fine-tuning on 50k examples (checkpoint-1000 selected as best)
40
+ 3. Multiple correction rounds with progressively lower learning rates
41
+ 4. Final detoxification training with learning rate 3e-7 to remove undesirable patterns
42
+
43
+ **Evaluation Results**
44
+
45
+ The model was evaluated on several test categories:
46
+
47
+ | Category | Pass Rate | Notes |
48
+ |----------|-----------|-------|
49
+ | Basic functions | 80% | Factorial, prime check, etc. |
50
+ | Classes from training set | 100% | Stack, BankAccount, Rectangle |
51
+ | New complex classes | 33% | Graph, Queue, inheritance |
52
+ | Function signatures (MBPP) | 100% | Correctly generates def statements |
53
+
54
+ **Capabilities**
55
+
56
+ - Generates Python functions from natural language descriptions
57
+ - Implements basic algorithms (factorial, prime check, palindrome)
58
+ - Creates class definitions with methods (Stack, BankAccount, Rectangle)
59
+ - Handles recursive functions (quicksort, Fibonacci)
60
+ - Produces syntactically correct function signatures
61
+
62
+ **Limitations**
63
+
64
+ - May produce repeated or redundant code after the main solution
65
+ - Struggles with complex data structures (graphs, trees, queues)
66
+ - Does not reliably handle class inheritance patterns
67
+ - Can generate incorrect list indexing operations
68
+ - May continue generating text beyond the intended solution
69
+ - Limited to 512 token context window
70
+ - Not suitable for production use without output post-processing
71
+
72
+ **Recommended Use Cases**
73
+
74
+ - Code autocompletion in lightweight IDEs
75
+ - Educational tool for Python beginners
76
+ - Rapid prototyping of simple functions
77
+ - Embedded systems with limited computational resources
78
+ - Offline code assistance on mobile devices
79
+
80
+ **Not Recommended For**
81
+
82
+ - Complex algorithm implementation
83
+ - Production code generation without human review
84
+ - Tasks requiring deep contextual understanding
85
+ - Generating large codebases
86
+ - Security-critical applications
87
+
88
+ **Usage Example**
89
+
90
+ ```python
91
+ from transformers import AutoTokenizer, AutoModelForCausalLM
92
+
93
+ model_path = "path/to/stentor-python-30m"
94
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
95
+ model = AutoModelForCausalLM.from_pretrained(model_path)
96
+
97
+ prompt = "### Task: Write a function that checks if a number is even\n\n### Solution:\n"
98
+ inputs = tokenizer(prompt, return_tensors="pt")
99
+ outputs = model.generate(**inputs, max_new_tokens=100, temperature=0.2)
100
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
101
+ ```
102
+
103
+ **Hardware Requirements**
104
+
105
+ - **Inference:** CPU only (no GPU required)
106
+ - **RAM:** < 100 MB for inference
107
+ - **Storage:** 60 MB (FP16), 30 MB (INT8 quantized)
108
+
109
+ **Ethical Considerations**
110
+
111
+ This model is intended for educational and development assistance purposes. Users should verify all generated code before deployment, particularly for security-sensitive applications. The model may occasionally produce incorrect or inefficient code and should not be relied upon as the sole source of truth for programming tasks.
112
+
113
+ **Citation**
114
+
115
+ If you use this model in your work, please cite:
116
+
117
+ ```
118
+ @misc{stentor-python-30m-2026,
119
+ author = {Fine-tuning Experiment},
120
+ title = {Stentor Python 30M: A Compact Model for Python Code Generation},
121
+ year = {2026},
122
+ publisher = {Hugging Face},
123
+ url = {https://huggingface.co/username/stentor-python-30m}
124
+ }
125
+ ```
126
+
127
+ **Contact**
128
+
129
+ For questions or feedback about this model, please open an issue on the Hugging Face repository.