somethingobscurefordevstuff commited on
Commit
8d010a7
Β·
verified Β·
1 Parent(s): fb6d0f5

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +243 -0
README.md ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Facilitair CodeBERT Routing Model v1
2
+
3
+ **Accuracy**: 99.93% (validation)
4
+ **Task**: Multi-task routing for software development tasks
5
+ **License**: MIT
6
+ **Base Model**: microsoft/codebert-base (125M parameters)
7
+
8
+ ---
9
+
10
+ ## Model Description
11
+
12
+ This model routes software development tasks to appropriate domains, strategies, capabilities, and execution types with 99.93% accuracy on technical tasks.
13
+
14
+ ### Capabilities
15
+
16
+ The model performs 4 simultaneous predictions:
17
+
18
+ 1. **Domain Classification** (19 classes):
19
+ - frontend, backend, data, ml, devops, mobile, cloud, security
20
+ - general, testing, database, infrastructure, api, microservices
21
+ - blockchain, networking, embedded, gaming, system_design
22
+
23
+ 2. **Strategy Classification** (2 classes):
24
+ - DIRECT: Execute immediately
25
+ - ORCHESTRATE: Complex multi-step execution
26
+
27
+ 3. **Capability Detection** (8 multi-label):
28
+ - code_generation, debugging, testing, refactoring
29
+ - optimization, documentation, deployment, data_analysis
30
+
31
+ 4. **Execution Type** (5 classes):
32
+ - single_task, multi_step, iterative, parallel, sequential
33
+
34
+ ### Performance
35
+
36
+ | Metric | Score |
37
+ |--------|-------|
38
+ | Overall Accuracy | 99.93% |
39
+ | Minimum Per-Domain | 99.1% (backend) |
40
+ | Perfect Domains | 17/19 (100.0%) |
41
+ | Training Time | 4.7 hours on AMD MI300X |
42
+ | Model Size | 477MB |
43
+
44
+ ---
45
+
46
+ ## Usage
47
+
48
+ ### Python (Transformers)
49
+
50
+ ```python
51
+ import torch
52
+ from transformers import RobertaTokenizer, RobertaModel
53
+
54
+ # Load model and tokenizer
55
+ model = RobertaModel.from_pretrained("somethingobscurefordevstuff/facilitair-codebert-routing-v1")
56
+ tokenizer = RobertaTokenizer.from_pretrained("microsoft/codebert-base")
57
+
58
+ # Load trained weights
59
+ checkpoint = torch.load("codebert_best_model.pt")
60
+ model.load_state_dict(checkpoint['model_state_dict'])
61
+ model.eval()
62
+
63
+ # Tokenize input
64
+ task = "Build a React component for user login"
65
+ encoding = tokenizer(task, max_length=512, padding='max_length', truncation=True, return_tensors='pt')
66
+
67
+ # Predict
68
+ with torch.no_grad():
69
+ domain_logits, strategy_logits, capability_logits, execution_logits = model(
70
+ encoding['input_ids'],
71
+ encoding['attention_mask']
72
+ )
73
+
74
+ # Get domain prediction
75
+ domain_idx = torch.argmax(domain_logits, dim=1).item()
76
+ domains = ["frontend", "backend", "data", "ml", "devops", "mobile", "cloud", "security",
77
+ "general", "testing", "database", "infrastructure", "api", "microservices",
78
+ "blockchain", "networking", "embedded", "gaming", "system_design"]
79
+ print(f"Domain: {domains[domain_idx]}")
80
+ ```
81
+
82
+ ### Using Facilitair Inference API
83
+
84
+ ```python
85
+ from huggingface_hub import hf_hub_download
86
+
87
+ # Download model
88
+ model_path = hf_hub_download(
89
+ repo_id="somethingobscurefordevstuff/facilitair-codebert-routing-v1",
90
+ filename="codebert_best_model.pt"
91
+ )
92
+
93
+ # Use with Facilitair's inference code
94
+ from facilitair_inference import CodeBERTRouter
95
+
96
+ router = CodeBERTRouter(model_path=model_path)
97
+ result = router.route_task("Build a React component")
98
+
99
+ print(f"Domain: {result['domain']}") # frontend
100
+ print(f"Confidence: {result['domain_confidence']:.1%}") # 95.8%
101
+ print(f"Strategy: {result['strategy']}") # DIRECT
102
+ print(f"Capabilities: {result['capabilities']}") # ['code_generation']
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Training Data
108
+
109
+ - **Size**: 149,986 examples
110
+ - **Distribution**: Perfectly balanced across 19 domains (7,894 per domain)
111
+ - **Task Types**:
112
+ - 66.6% short (3-8 words)
113
+ - 33.3% medium (10-20 words)
114
+ - 0.1% long (30-50 words)
115
+ - **Domains**: All technical domains (frontend, backend, DevOps, ML, etc.)
116
+ - **Note**: Not trained on non-coding tasks (meetings, business analysis, etc.)
117
+
118
+ ---
119
+
120
+ ## Model Architecture
121
+
122
+ ```
123
+ CodeBERT Base (microsoft/codebert-base)
124
+ β”œβ”€β”€ 12 transformer layers
125
+ β”œβ”€β”€ 768 hidden size
126
+ β”œβ”€β”€ 12 attention heads
127
+ └── 125M total parameters
128
+
129
+ Classification Heads:
130
+ β”œβ”€β”€ Domain Head: 768 β†’ 256 β†’ 19
131
+ β”œβ”€β”€ Strategy Head: 768 β†’ 256 β†’ 2
132
+ β”œβ”€β”€ Capability Head: 768 β†’ 256 β†’ 8 (multi-label)
133
+ └── Execution Head: 768 β†’ 256 β†’ 5
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Training Details
139
+
140
+ - **Base Model**: microsoft/codebert-base
141
+ - **Training Examples**: 149,986 (135K train, 15K validation)
142
+ - **Epochs**: 10 (early stopping triggered)
143
+ - **Best Epoch**: 4 (validation loss: 0.2146)
144
+ - **Batch Size**: 16
145
+ - **Learning Rate**: 2e-5
146
+ - **Optimizer**: AdamW with warmup
147
+ - **Hardware**: AMD MI300X (192GB HBM3)
148
+ - **Training Time**: 4.7 hours
149
+
150
+ ### Loss Weighting
151
+
152
+ - Domain: 50%
153
+ - Capability: 25%
154
+ - Strategy: 15%
155
+ - Execution: 10%
156
+
157
+ ---
158
+
159
+ ## Evaluation Results
160
+
161
+ ### Per-Domain Accuracy (Validation Set)
162
+
163
+ | Domain | Accuracy | Examples |
164
+ |--------|----------|----------|
165
+ | frontend | 100.0% | 790 |
166
+ | backend | 99.1% | 790 |
167
+ | data | 100.0% | 790 |
168
+ | ml | 100.0% | 790 |
169
+ | devops | 99.6% | 790 |
170
+ | mobile | 100.0% | 790 |
171
+ | cloud | 100.0% | 790 |
172
+ | security | 100.0% | 790 |
173
+ | general | 100.0% | 790 |
174
+ | testing | 100.0% | 790 |
175
+ | database | 100.0% | 790 |
176
+ | infrastructure | 99.8% | 790 |
177
+ | api | 100.0% | 790 |
178
+ | microservices | 100.0% | 790 |
179
+ | blockchain | 100.0% | 790 |
180
+ | networking | 100.0% | 790 |
181
+ | embedded | 100.0% | 790 |
182
+ | gaming | 100.0% | 790 |
183
+ | system_design | 100.0% | 790 |
184
+
185
+ **Summary**: 17/19 domains perfect (100%), minimum 99.1%
186
+
187
+ ---
188
+
189
+ ## Limitations
190
+
191
+ 1. **Non-Coding Tasks**: Model is trained exclusively on technical software development tasks. It may misclassify:
192
+ - Business analysis tasks
193
+ - Meeting scheduling
194
+ - Document writing
195
+ - General Q&A
196
+
197
+ 2. **Confidence Thresholds**: For production use, consider applying a confidence threshold (e.g., 70%) and fallback to "general" domain for uncertain predictions.
198
+
199
+ 3. **Domain Overlap**: Some tasks may legitimately belong to multiple domains. Model predicts single most likely domain.
200
+
201
+ ---
202
+
203
+ ## Citation
204
+
205
+ If you use this model, please cite:
206
+
207
+ ```bibtex
208
+ @software{facilitair_codebert_routing_2025,
209
+ title={Facilitair CodeBERT Routing Model v1},
210
+ author={Facilitair Team},
211
+ year={2025},
212
+ url={https://huggingface.co/somethingobscurefordevstuff/facilitair-codebert-routing-v1}
213
+ }
214
+ ```
215
+
216
+ ---
217
+
218
+ ## License
219
+
220
+ MIT License - Free for commercial use
221
+
222
+ ---
223
+
224
+ ## Contact
225
+
226
+ - **Repository**: https://github.com/facilitair/codebert-routing
227
+ - **Issues**: https://github.com/facilitair/codebert-routing/issues
228
+ - **Website**: https://beta.facilitair.ai
229
+
230
+ ---
231
+
232
+ ## Version History
233
+
234
+ ### v1.0.0 (2025-11-17)
235
+ - Initial release
236
+ - 99.93% validation accuracy
237
+ - 19 domains, 2 strategies, 8 capabilities, 5 execution types
238
+ - Trained on 150K balanced examples
239
+
240
+ ---
241
+
242
+ **Model Card**: [Full Model Card](model-card.md)
243
+ **Training Details**: [Training Report](training-report.md)