ameforge commited on
Commit
2d9d32f
Β·
verified Β·
1 Parent(s): e01e111

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +201 -77
README.md CHANGED
@@ -1,97 +1,221 @@
1
  ---
2
- license: apache-2.0
3
  language:
4
  - en
5
  - fr
6
  tags:
7
  - code-generation
8
- - multilingual
9
- - chain-of-thought
10
- - instruction-tuned
11
- - finetuned
12
- - personalized
13
  - python
14
- - sparsemind
15
  - sparse-transformer
 
16
  - amforge
17
- base_model: AMFORGE/cofos_v2
18
- base_tokenizer: AMFORGE/cofos_tok_v2
 
19
  pipeline_tag: text-generation
20
  inference: false
 
 
 
 
 
 
 
 
 
 
 
21
  ---
22
 
23
- # Cofos Logo v2 (v1-personal-from-v2) β€” SparseMind personalized code assistant
24
-
25
- Fine-tuned from [AMFORGE/cofos_v2](https://huggingface.co/AMFORGE/cofos_v2)
26
- on the author's personal data (GitHub repos + ChatGPT conversations +
27
- Anthropic conversations). The result is a model that codes and reasons in
28
- the author's own style β€” variable naming, code structure, French/English
29
- mix, debugging approach.
30
-
31
- **Lineage** β€” full SparseMind v15 chain:
32
- 1. **Pretraining** on FineWeb-Edu (EN) + FineWeb-2 fra_Latn (FR) β†’ `cofos_general_(600m|1b)`
33
- 2. **Code finetune** on `cofos_distilled.jsonl` β†’ `cofos_general_code_(600m|1b)`
34
- 3. **Personal finetune** on `cofos_personal_redacted.jsonl` β†’ THIS MODEL
35
-
36
- All API keys and credentials were redacted from the personal dataset BEFORE
37
- training. The model has never seen real secrets.
38
-
39
- Developed by **AMEFORGE**.
40
-
41
- ## Architecture (SparseMind v15 β€” strictly preserved end-to-end)
42
- - **7 NeuronTypes** with dynamic plasticity (`DynamicTypeManager`):
43
- STEM, EXCITATORY, INHIBITORY, MEMORY, RELAY, MODULATORY, PATTERN
44
- - **`BalancedDiversityLayer`** on every even layer β€” 5 specialised modules
45
- - **`SparseAttn`** (Top-K tokens) + **`SparseFFN`** with `SparseGate` (Top-K channels)
46
- - **`MemoryBank`** + **`MemoryLayer`** (off by default per AMFORGE empirical)
47
- - **Type-differentiated optimizer** (per-neuron weight decay)
48
- - **Label smoothing 0.05**, embedding tied with output projection
49
-
50
- ## Parameters (inherited from base β€” unchanged)
51
- - `dim=1024`, `n_layers=20`, `n_heads=16` (head_dim=64)
52
- - `max_seq_len=2048`, `vocab_size=16384`
53
- - `channel_top_k=320`, `token_top_k=512`
54
- - **Total parameters:** 522,771,466
55
-
56
- ## Personal fine-tune
57
- - **Base:** [AMFORGE/cofos_v2](https://huggingface.co/AMFORGE/cofos_v2)
58
- - **Steps:** 1500, **LR:** 1e-05 (2.5Γ— lower than general finetune)
59
- - **Best `real_syntax_valid`:** 66.0%
60
-
61
- ## Data mix (65% / 25% / 10%)
62
- - **65% personal** (`cofos_personal_redacted.jsonl`) β€” your GitHub + ChatGPT +
63
- Anthropic conversations (secrets redacted before training)
64
- - **25% distilled** (`cofos_distilled.jsonl`) β€” kept as anti-catastrophic-
65
- forgetting signal so generic skills aren't lost
66
- - **10% real HF Python** β€” production patterns
67
-
68
- ## Tokenizer
69
- - [AMFORGE/cofos_tok_v2](https://huggingface.co/AMFORGE/cofos_tok_v2) β€” vocab 16384,
70
- NexusBPE-based (custom AMEFORGE tokenizer built on SentencePiece),
71
- byte_fallback=True (full multilingual + Unicode coverage), FR-aware
72
- - 381+ atomic tokens (Python keywords, dunders, builtins, decorators,
73
- JS namespaced methods, Rust macros, structural tags `<instruction>`
74
- `<thought>` `<python>` `<code>` `<test>`)
75
 
76
- ## Usage
77
- ```bash
78
- python cofos_inference_streaming.py \
79
- --model AMFORGE/cofos_logo_v2 \
80
- --prompt "CrΓ©e une classe Python LRUCache avec capacitΓ© maximale" \
81
- --with-thought --max-tokens 5000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  ```
83
 
84
- ## How to use
 
 
 
 
 
 
 
85
  ```python
86
- import torch
87
- import sentencepiece as spm
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
- # Load checkpoint
90
- ckpt = torch.load("cofos_best.pt", map_location="cpu")
91
- cfg_dict = ckpt["config"]
92
 
93
- # Instantiate model architecture
94
- # model = SparseMind(Config(**cfg_dict))
95
- # model.load_state_dict(ckpt["model"])
96
- # model.eval()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
2
  language:
3
  - en
4
  - fr
5
  tags:
6
  - code-generation
 
 
 
 
 
7
  - python
8
+ - chain-of-thought
9
  - sparse-transformer
10
+ - personalized
11
  - amforge
12
+ - sparsemind
13
+ - fine-tuned
14
+ library_name: pytorch
15
  pipeline_tag: text-generation
16
  inference: false
17
+ base_model: AMFORGE/cofos_v2
18
+ model-index:
19
+ - name: cofos_logo_v2
20
+ results:
21
+ - task:
22
+ type: text-generation
23
+ name: Python code generation
24
+ metrics:
25
+ - type: real_syntax_valid
26
+ value: 66
27
+ name: Real Python syntax validity (held-out)
28
  ---
29
 
30
+ # Cofos Logo v2 β€” Personalized Python Code Assistant
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
+ **Cofos Logo v2** is a 522M-parameter personalized code assistant, fine-tuned from [`AMFORGE/cofos_v2`](https://huggingface.co/AMFORGE/cofos_v2) on a curated corpus of personal coding conversations and project artifacts. It is the first **personalization-tier** model in the Cofos family by **AMEFORGE**, built on the proprietary **SparseMind** architecture.
33
+
34
+ The "Logo" suffix denotes that this variant has been fine-tuned on a specific developer's personal style and patterns. The base model remains general-purpose; this variant is a directional bias toward a particular coding voice.
35
+
36
+ ---
37
+
38
+ ## Model Summary
39
+
40
+ | Field | Value |
41
+ |---|---|
42
+ | **Developer** | AMEFORGE |
43
+ | **Architecture** | SparseMind v15 (proprietary) |
44
+ | **Parameters** | 522M |
45
+ | **Context length** | 2048 tokens |
46
+ | **Vocabulary** | 16,384 (NexusBPE, FR-aware) |
47
+ | **Languages** | French, English |
48
+ | **Base model** | [AMFORGE/cofos_v2](https://huggingface.co/AMFORGE/cofos_v2) |
49
+ | **Specialization** | Personal coding style + Python |
50
+ | **License** | Apache 2.0 |
51
+ | **Status** | Experimental β€” first personalization tier |
52
+
53
+ ---
54
+
55
+ ## Intended Use
56
+
57
+ ### Primary use cases
58
+
59
+ - **Personalized Python code generation** that reflects a specific developer's style and preferred patterns
60
+ - **Bilingual coding assistance** (French/English) where consistency with the developer's authored prompts matters
61
+ - **Experimental baseline** for studying personalization of small code models through targeted fine-tuning
62
+
63
+ ### Out-of-scope
64
+
65
+ This model is **not designed for**:
66
+ - General-purpose code assistance for other developers (the personal bias may produce surprising stylistic outputs)
67
+ - Tasks requiring broad knowledge or long-context reasoning
68
+ - Languages other than French and English
69
+ - Languages other than Python (other syntaxes appear only as artifacts of the base)
70
+ - Production deployment without human review
71
+
72
+ Cofos Logo v2 is a **research artifact**, not a general assistant. It explores whether targeted fine-tuning of a small specialized base on personal data produces a measurably "voiced" model.
73
+
74
+ ---
75
+
76
+ ## Performance
77
+
78
+ Evaluated on the same held-out set of 100 real Python instruction prompts used during base training.
79
+
80
+ | Metric | Cofos v2 base | Cofos Logo v2 (this) |
81
+ |---|---:|---:|
82
+ | Real-syntax-valid (n=100) | 67.0% | **66.0%** |
83
+ | Validation loss | 3.07 | 2.98 |
84
+
85
+ The fine-tune produces a small drop in raw Python syntactic validity (-1pp) and a meaningful improvement in validation loss on personal+code mixed data (-0.09). This is the expected trade-off of personalization: the model has shifted some capacity toward modeling personal style at a marginal cost to generic Python correctness.
86
+
87
+ A separate external benchmark (50 prompts, semantic execution tests) is available in the [Cofos benchmark suite](https://huggingface.co/AMFORGE/cofos_v2). Refer to that for comparison against open-source small code models.
88
+
89
+ ---
90
+
91
+ ## Training
92
+
93
+ ### Fine-tune configuration
94
+
95
+ - **Base**: AMFORGE/cofos_v2 (522M, step 11500, 67% real_syntax_valid)
96
+ - **Method**: Continued training (not LoRA β€” full parameter fine-tune)
97
+ - **Steps**: 1500
98
+ - **Learning rate**: 1e-5 (conservative β€” base is heavily trained)
99
+ - **Schedule**: 100-step warmup, cosine decay to 0
100
+ - **Best checkpoint**: step 600 (saved as `cofos_model.pt`)
101
+
102
+ ### Data mix
103
+
104
+ - **65% personal data** β€” curated conversations and code artifacts from the model author
105
+ - **25% distilled instruction-response data** β€” kept as anti-catastrophic-forgetting signal so generic skills are preserved
106
+ - **10% real Python instructions** β€” production patterns from public datasets
107
+
108
+ All personal data was redacted for secrets (API keys, tokens, PEM keys) before training. Redaction tokens use stable placeholders so the model learns to emit the placeholder rather than the secret.
109
+
110
+ ### Tokenizer
111
+
112
+ [AMFORGE/cofos_tok_v2](https://huggingface.co/AMFORGE/cofos_tok_v2) β€” NexusBPE-based custom tokenizer (vocab 16384, FR-aware, with atomic structural tags `<instruction>` `<thought>` `<python>` `<code>` `<test>`). Inherited from the base model unchanged.
113
+
114
+ ---
115
+
116
+ ## Lineage
117
+
118
+ ```
119
+ cofos_tok_v2 (tokenizer, NexusBPE)
120
+ ↓
121
+ cofos_v2 (base code model, from scratch, 67% syntax)
122
+ ↓
123
+ cofos_logo_v2 (this model β€” personal fine-tune, 66% syntax)
124
  ```
125
 
126
+ A parallel branch (`cofos_logo_general`) is planned, fine-tuning the upcoming general-purpose base instead of cofos_v2. The two variants will be compared empirically.
127
+
128
+ ---
129
+
130
+ ## Usage
131
+
132
+ ### Loading
133
+
134
  ```python
135
+ from huggingface_hub import hf_hub_download
136
+
137
+ checkpoint_path = hf_hub_download(repo_id="AMFORGE/cofos_logo_v2",
138
+ filename="cofos_model.pt")
139
+ tokenizer_path = hf_hub_download(repo_id="AMFORGE/cofos_logo_v2",
140
+ filename="cofos_tokenizer.model")
141
+ ```
142
+
143
+ Loading and inference require the AMEFORGE SparseMind runtime. The model architecture is proprietary; contact AMEFORGE for access to the runtime.
144
+
145
+ ### Prompt format
146
+
147
+ ```
148
+ <instruction>Write a Python function that ...</instruction>
149
+ ```
150
+
151
+ For chain-of-thought generation, prime with `<thought>`:
152
+
153
+ ```
154
+ <instruction>Write a Python function that ...</instruction>
155
+ <thought>
156
+ ```
157
+
158
+ For code generation primed with the wrapper:
159
+
160
+ ```
161
+ <instruction>Write a Python function that ...</instruction>
162
+ <python><code>
163
+ ```
164
+
165
+ ---
166
+
167
+ ## Limitations & Risks
168
+
169
+ ### Personalization-specific
170
 
171
+ - **Stylistic bias**: The model has been fine-tuned on one developer's style. Output will reflect that style and may feel unnatural to other developers.
172
+ - **Voice persistence**: The model has learned recurring patterns (variable naming, function structure, comment style) from the personal corpus. These will appear even when not requested.
173
+ - **Topical narrowness**: The personal corpus has its own topical distribution (heavy on ML, light on web frontend, etc.). Generations on topics outside that distribution may degrade in quality.
174
 
175
+ ### Inherited from base
176
+
177
+ - **Capacity**: 522M parameters is small. Complex multi-step reasoning is limited.
178
+ - **Hallucination**: As with all autoregressive language models, generated code can look plausible but be subtly wrong (invented variable names, swapped function names, etc.). Always test before use.
179
+ - **No safety alignment**: No RLHF, no refusal training. Should not be deployed in user-facing products without safety layers.
180
+
181
+ ### Privacy
182
+
183
+ The training data was redacted for technical secrets (API keys, tokens, PEM keys) before training. Personal information beyond such secrets (style, opinions, project context) is **intentionally retained** because the purpose of personalization is to learn that style. Users should be aware that interacting with this model exposes them to the trained style of the original author.
184
+
185
+ ---
186
+
187
+ ## Environmental Considerations
188
+
189
+ This fine-tune adds approximately 5 GPU-hours (A100) on top of the base model's training cost. The personalization approach is designed to be lightweight, making personalized models accessible without retraining from scratch.
190
+
191
+ ---
192
+
193
+ ## License
194
+
195
+ Released under the **Apache 2.0** license. You are free to use, modify, and redistribute it, subject to the terms of the license.
196
+
197
+ ---
198
+
199
+ ## Citation
200
+
201
+ ```bibtex
202
+ @misc{cofos_logo_v2_2026,
203
+ title = {Cofos Logo v2: A Personalized Python Code Assistant},
204
+ author = {{AMEFORGE}},
205
+ year = {2026},
206
+ url = {https://huggingface.co/AMFORGE/cofos_logo_v2}
207
+ }
208
  ```
209
+
210
+ ---
211
+
212
+ ## Contact
213
+
214
+ For questions, collaborations, or access to the AMEFORGE SparseMind runtime:
215
+
216
+ - **Organization**: AMEFORGE
217
+ - **HuggingFace**: [@AMFORGE](https://huggingface.co/AMFORGE)
218
+
219
+ ---
220
+
221
+ *Cofos Logo v2 is part of the broader Cofos model family by AMEFORGE. See the [AMFORGE organization page](https://huggingface.co/AMFORGE) for the base model, sibling variants, and ongoing work on the general-purpose foundation.*