File size: 3,049 Bytes
fda5b0a
 
 
 
 
 
 
d30506f
fda5b0a
 
 
 
 
 
 
 
 
 
d30506f
fda5b0a
d30506f
fda5b0a
d30506f
fda5b0a
d30506f
 
 
 
 
fda5b0a
d30506f
fda5b0a
d30506f
 
 
 
 
fda5b0a
d30506f
fda5b0a
d30506f
 
 
 
 
 
 
 
 
 
fda5b0a
 
 
 
 
d30506f
 
 
fda5b0a
 
d30506f
 
 
 
 
fda5b0a
d30506f
 
 
 
fda5b0a
 
 
d30506f
 
 
 
 
 
fda5b0a
d30506f
 
 
 
 
 
 
 
 
 
 
fda5b0a
d30506f
 
fda5b0a
 
d30506f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
language: it
license: apache-2.0
library_name: peft
base_model: Qwen/Qwen2.5-1.5B
tags:
  - lora
  - peft
  - cognitive-architecture
  - progressive-learning
  - magnitude-pruning
  - math
  - arithmetic
datasets:
  - custom
pipeline_tag: text-generation
---

# Architettura Cognitiva Progressiva β€” Progressive-LoRA con Magnitude Pruning (Italiano)

**Primo prototipo** β€” Qwen2.5-1.5B addestrato con architettura cognitiva progressiva a 4 fasi, usando **magnitude pruning** (azzeramento pesi piccoli). Successivamente sostituito da SVD Dream Pruning.

## πŸ“Š Risultati

| Metrica | Progressive-LoRA (questo) | Dream-LoRA | Flat-LoRA |
|---------|--------------------------|-----------|-----------|
| Accuratezza Esatta | 37.0% Β± 0.5 | 58.6% Β± 2.9 | 60.6% |
| Number Sense | 57.7% Β± 0.5 | 60.0% Β± 0.8 | 0.0% |
| Metacognizione | 98.5% | 100.0% | 0.0% |

## 🧠 Architettura

Training progressivo a 4 fasi su dati aritmetici italiani:
1. **Fondamenta** β€” Aritmetica esatta
2. **Consolidamento** β€” Magnitude pruning + fine-tuning su approssimazioni
3. **Delega** β€” Routing complessitΓ : calcolo interno vs. strumento
4. **Orchestrazione** β€” Pipeline completa: intuizione β†’ routing β†’ tool β†’ validazione

## πŸ”§ Configurazione

| Parametro | Valore |
|-----------|--------|
| Modello Base | Qwen/Qwen2.5-1.5B |
| LoRA Rank | 16 |
| LoRA Alpha | 32 |
| Target LoRA | q_proj, k_proj, v_proj, o_proj |
| Tipo Pruning | Magnitude (azzeramento pesi piccoli) |
| Lingua Dati | Italiano |

## πŸš€ Uso Rapido

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_model = AutoModelForCausalLM.from_pretrained(
    "Qwen/Qwen2.5-1.5B", device_map="auto", torch_dtype="auto"
)
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-1.5B")

model = PeftModel.from_pretrained(
    base_model,
    "dexmac/progressive-cognitive-lora",
    subfolder="lora_adapters"
)

messages = [{"role": "user", "content": "Calcola: 342 * 67"}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.1)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

## πŸ”— Modelli Correlati

- [**Dream-LoRA (IT)**](https://huggingface.co/dexmac/progressive-cognitive-dream-lora) β€” Versione migliorata con SVD Dream Pruning
- [Flat-LoRA (IT)](https://huggingface.co/dexmac/progressive-cognitive-baseline-lora) β€” Controllo senza fasi
- [1.5B Dream (EN)](https://huggingface.co/dexmac/progressive-cognitive-dream-lora-en) β€” Miglior modello (inglese)
- [GitHub](https://github.com/dexmac221/progressive-cognitive) β€” Codice sorgente completo

## πŸ“ Citation

```bibtex
@software{progressive_cognitive_2026,
  author = {Dex Mac},
  title = {Progressive Cognitive Architecture for LLMs},
  year = {2026},
  url = {https://github.com/dexmac221/progressive-cognitive},
  version = {1.0.0}
}
```


## πŸ“„ License

Apache 2.0