File size: 12,747 Bytes
684b9ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
af16949
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684b9ec
 
 
 
 
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
---
language:
  - fr
  - en
license: apache-2.0
library_name: transformers
tags:
  - microsoft-365
  - powershell
  - microsoft-graph
  - entra-id
  - sharepoint
  - exchange-online
  - intune
  - teams
  - fine-tuned
  - qlora
  - gguf
  - ollama
base_model: Qwen/Qwen3-8B
model-index:
  - name: m365-expert-v3
    results:
      - task:
          type: question-answering
          name: M365 Administration QA
        dataset:
          type: custom
          name: M365 Expert Benchmark (166 questions, 20 categories)
        metrics:
          - type: accuracy
            value: 92.7
            name: Score global
---

# m365-expert-v3 — Expert Microsoft 365 Fine-tuné

<div align="center">

**Le premier modèle LLM open-source spécialisé dans l'administration Microsoft 365**

🏆 **92.7%** sur un benchmark exhaustif de 166 questions | 20 catégories M365

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Ollama](https://img.shields.io/badge/Ollama-Compatible-green.svg)](https://ollama.com)

</div>

---

## Description / Overview

### Français

**m365-expert-v3** est un modèle de langage fine-tuné sur Qwen3-8B, spécialisé dans l'administration Microsoft 365. Il couvre l'ensemble de l'écosystème M365 : Microsoft Graph API, PowerShell (Microsoft.Graph, Exchange Online, PnP, Teams), Microsoft Entra ID, SharePoint, Intune, et la sécurité M365.

Le modèle a été entraîné avec QLoRA sur un dataset de **40 962 exemples** couvrant les commandes les plus récentes, les dépréciations, les migrations AzureAD vers Microsoft Graph, et les bonnes pratiques d'administration.

### English

**m365-expert-v3** is a fine-tuned language model based on Qwen3-8B, specialized in Microsoft 365 administration. It covers the entire M365 ecosystem: Microsoft Graph API, PowerShell (Microsoft.Graph, Exchange Online, PnP, Teams), Microsoft Entra ID, SharePoint, Intune, and M365 security.

The model was trained using QLoRA on a dataset of **40,962 examples** covering the latest commands, deprecations, AzureAD to Microsoft Graph migrations, and administration best practices.

---

## Résultats de benchmark / Benchmark Results

### Benchmark exhaustif — 166 questions, 20 catégories

| Catégorie / Category | N | Score |
|---|:---:|:---:|
| 1. Migration AzureAD → Graph | 14 | 92.9% |
| 2. Commandes Graph PS récentes | 15 | 96.0% |
| 3. API REST Graph endpoints | 13 | 92.3% |
| 4. Dépréciations récentes | 10 | **100.0%** |
| 5. Exchange Online PowerShell | 13 | 90.8% |
| 6. PnP PowerShell & SharePoint | 10 | 88.0% |
| 7. Permissions & Scopes Graph | 13 | 96.9% |
| 8. Teams & Collaboration | 9 | 95.6% |
| 9. Intune & Device Management | 7 | 94.3% |
| 10. Sécurité & Conditional Access | 8 | 90.0% |
| 11. OneDrive & Files Graph API | 8 | 80.0% |
| 12. SharePoint Sites Graph API | 6 | 93.3% |
| 13. Mail & Calendar Graph API | 8 | 92.5% |
| 14. Gestion utilisateurs avancée | 8 | 90.0% |
| 15. Groupes & membres Graph | 5 | 92.0% |
| 16. Rapports & Audit Graph | 5 | 92.0% |
| 17. Sécurité & Compliance avancée | 6 | 93.3% |
| 18. Webhooks & Subscriptions | 2 | **100.0%** |
| 19. Batch & Performances | 3 | **100.0%** |
| 20. Planner & OneNote Graph | 3 | 80.0% |
| **TOTAL** | **166** | **92.7%** |

### Comparaison avec des modèles généralistes / Comparison with generic models

| Modèle / Model | Taille / Size | Fine-tuning | Score |
|---|:---:|:---:|:---:|
| **m365-expert-v3 (ce modèle)** | **4.7 GB** | **QLoRA 12h** | **92.7%** |
| Gemma3 12B (généraliste) | 8.1 GB | Non | 95.7% |
| Gemma3 4B (généraliste + prompt) | 3.3 GB | Non | 92.3% |
| StarCoder2 7B | 4.0 GB | Non | 67.6% |

> **Note :** Les modèles Gemma bénéficient du system prompt M365 optimisé et du post-processing. Ce modèle fine-tuné contient cette expertise directement dans ses poids, sans dépendance au prompt engineering.

---

## Détails du fine-tuning / Fine-tuning Details

### Architecture et paramètres / Architecture and parameters

| Paramètre / Parameter | Valeur / Value |
|---|---|
| Modèle de base / Base model | Qwen3-8B |
| Méthode / Method | QLoRA (4-bit) |
| Framework | Unsloth + TRL |
| GPU | NVIDIA RTX 3090 (24 GB VRAM) |
| Durée / Duration | ~12 heures / hours |
| Étapes / Steps | 4 610 |
| Époques / Epochs | 2 |

### Hyperparamètres / Hyperparameters

| Paramètre / Parameter | Valeur / Value |
|---|---|
| Learning Rate | 5e-5 |
| LR Scheduler | Cosine |
| Warmup Ratio | 0.05 |
| Batch Size | 1 (gradient accumulation: 16) |
| Max Sequence Length | 4 096 tokens |
| Optimizer | AdamW 8-bit |
| Weight Decay | 0.01 |
| Max Gradient Norm | 1.0 |
| Seed | 42 |

### Paramètres LoRA / LoRA Parameters

| Paramètre / Parameter | Valeur / Value |
|---|---|
| LoRA Rank (r) | 64 |
| LoRA Alpha | 128 |
| LoRA Dropout | 0.05 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Bias | none |

### Métriques d'entraînement / Training Metrics

| Étape / Step | Train Loss | Eval Loss |
|---|:---:|:---:|
| 50 | 1.790 | — |
| 500 | 0.280 | 0.225 |
| 1 000 | 0.244 | 0.202 |
| 2 000 | 0.219 | 0.176 |
| 3 000 | 0.171 | 0.163 |
| 4 000 | 0.173 | 0.156 |
| **4 610 (final)** | **0.168** | **0.155** |

---

## Dataset

### Statistiques / Statistics

| Propriété / Property | Valeur / Value |
|---|---|
| Total exemples / Total examples | 40 962 |
| Entraînement / Training | 36 865 (90%) |
| Évaluation / Evaluation | 4 097 (10%) |
| Format | ChatML |
| Paires de renforcement / Reinforcement pairs | 156 (52 uniques x3 oversampling) |
| Langue / Language | Français (code en anglais) |

### Sujets couverts / Topics covered

- **Microsoft Graph API** : endpoints REST, query parameters, pagination, batch requests
- **PowerShell Microsoft.Graph** : Get-MgUser, New-MgGroup, Connect-MgGraph, Invoke-MgGraphRequest...
- **Exchange Online** : Get-Mailbox, Get-EXOMailbox, transport rules, anti-phishing, compliance search
- **PnP PowerShell** : Connect-PnPOnline, site management, permissions, templates
- **Microsoft Entra ID** : migration AzureAD → Graph, conditional access, identity protection
- **SharePoint Online** : sites, drives, lists, permissions via Graph API
- **Microsoft Teams** : création d'équipes, canaux, messages, archivage via Graph
- **Intune** : device management, compliance policies, app deployment
- **Sécurité** : alertes, risky users, eDiscovery, DLP, sensitivity labels
- **OneDrive** : files, sharing links, permissions via Graph API
- **Rapports** : audit logs, sign-ins, usage reports via Graph

---

## Utilisation / Usage

### Avec Ollama / With Ollama

1. **Télécharger le fichier GGUF** (`m365-expert-v3-Q4_K_M.gguf`) et le `Modelfile`

2. **Créer le modèle :**
```bash
ollama create m365-expert-v3 -f Modelfile
```

3. **Utiliser :**
```bash
ollama run m365-expert-v3 "Quel cmdlet Graph remplace Get-AzureADUser ?"
```

### Avec Transformers (Python)

```python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "AYI-NEDJIMI/m365-expert-v3"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")

messages = [
    {"role": "system", "content": "Tu es un expert en administration Microsoft 365."},
    {"role": "user", "content": "Comment migrer de Get-AzureADUser vers Microsoft Graph ?"}
]

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=512, temperature=0.3)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

### System Prompt recommandé / Recommended System Prompt

```
Tu es un expert en administration Microsoft 365. Tu maîtrises parfaitement Microsoft Graph API,
PowerShell (Microsoft.Graph, Exchange Online, PnP, Teams), Microsoft Entra ID, SharePoint,
Intune, et la sécurité M365.
Règles OBLIGATOIRES :
1. Le service Azure AD s'appelle désormais « Microsoft Entra ID ». Utilise ce nom dans tes
   explications. ATTENTION : les noms de cmdlets PowerShell (Get-AzureADUser, Connect-AzureAD,
   etc.) et de modules (AzureAD, MSOnline) ne changent PAS.
2. Inclus TOUJOURS un bloc de code powershell ou http avec des exemples concrets.
3. Réponds en français avec des phrases complètes. Le code et les noms techniques restent
   en anglais.
```

---

## Exemples de réponses / Example responses

### Question : Quel cmdlet Graph remplace Get-AzureADUser ?

> Le cmdlet **Get-AzureADUser** du module AzureAD (déprécié depuis mars 2024) est remplacé par **Get-MgUser** du SDK Microsoft Graph PowerShell.
>
> Voici comment effectuer la migration :
>
> ```powershell
> # Ancien (module AzureAD — déprécié)
> Connect-AzureAD
> Get-AzureADUser -All $true
>
> # Nouveau (module Microsoft.Graph — recommandé)
> Connect-MgGraph -Scopes 'User.Read.All'
> Get-MgUser -All
> ```
>
> Les permissions requises sont `User.Read.All` ou `Directory.Read.All`.

### Question : Comment créer une politique d'accès conditionnel via Graph ?

> Pour créer une politique d'accès conditionnel dans Microsoft Entra ID via l'API Microsoft Graph :
>
> ```http
> POST https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies
> Content-Type: application/json
>
> {
>   "displayName": "Block Legacy Auth",
>   "state": "enabled",
>   "conditions": { ... },
>   "grantControls": { ... }
> }
> ```
>
> ```powershell
> New-MgIdentityConditionalAccessPolicy -DisplayName "Block Legacy Auth" ...
> ```
>
> Permission requise : `Policy.ReadWrite.ConditionalAccess`

---

## Quantification / Quantization

| Format | Taille / Size | Qualité / Quality | Usage recommandé |
|---|:---:|:---:|---|
| **Q4_K_M (GGUF)** | **4.7 GB** | Très bon | Ollama Desktop, llama.cpp |
| Full (safetensors) | ~16 GB | Maximum | Transformers, vLLM |

---

## Limitations

### Français
- Le modèle est optimisé pour le français. Les réponses en anglais sont possibles mais moins naturelles.
- Les connaissances sont basées sur les données disponibles jusqu'à février 2025.
- Certaines commandes très récentes ou en preview peuvent ne pas être couvertes.
- Le modèle peut occasionnellement halluciner des noms de cmdlets ou d'endpoints.

### English
- The model is optimized for French. English responses are possible but less natural.
- Knowledge is based on data available up to February 2025.
- Some very recent or preview commands may not be covered.
- The model may occasionally hallucinate cmdlet names or endpoints.

---

## Citation

```bibtex
@misc{m365-expert-v3-2026,
  title={m365-expert-v3: A Fine-tuned LLM for Microsoft 365 Administration},
  author={AYI-NEDJIMI},
  year={2026},
  url={https://huggingface.co/AYI-NEDJIMI/m365-expert-v3}
}
```


---

## 🛠️ Outils GitHub Associés / Related GitHub Tools

Découvrez la suite complète d'outils IA cybersécurité :

| Outil | Description | Lien |
|-------|-------------|------|
| 🎯 ThreatIntel-GPT | Analyse de Threat Intelligence avec IA | [GitHub](https://github.com/ayinedjimi/ThreatIntel-GPT) |
| 🔍 VulnScanner-LLM | Scanner de vulnérabilités avec LLM | [GitHub](https://github.com/ayinedjimi/VulnScanner-LLM) |
| 🎣 PhishingDetector-AI | Détection de phishing avec BERT | [GitHub](https://github.com/ayinedjimi/PhishingDetector-AI) |
| 🚨 SOC-Assistant | Assistant SOC avec RAG | [GitHub](https://github.com/ayinedjimi/SOC-Assistant) |
| 🔎 CVE-Explorer-AI | Recherche sémantique de CVE | [GitHub](https://github.com/ayinedjimi/CVE-Explorer-AI) |
| ⚡ CUDAEmbeddings | Embeddings GPU ultra-rapides | [GitHub](https://github.com/ayinedjimi/CUDAEmbeddings) |
| 📊 ModelBench | Benchmark de LLM sur GPU | [GitHub](https://github.com/ayinedjimi/ModelBench) |
| 🏗️ DatasetForge | Pipeline de création de datasets | [GitHub](https://github.com/ayinedjimi/DatasetForge) |
| 🗡️ ADBloodHound-AI | Analyse AD avec IA | [GitHub](https://github.com/ayinedjimi/ADBloodHound-AI) |
| 🎯 YaraGen-AI | Générateur de règles YARA | [GitHub](https://github.com/ayinedjimi/YaraGen-AI) |
| 🔎 KQLHunter | Générateur de requêtes KQL | [GitHub](https://github.com/ayinedjimi/KQLHunter) |
| 🔐 HashCracker-GPU | Cracking de hashes sur GPU | [GitHub](https://github.com/ayinedjimi/HashCracker-GPU) |
| 📡 PacketSniffer-AI | Analyse réseau avec ML | [GitHub](https://github.com/ayinedjimi/PacketSniffer-AI) |

**Auteur** : [Ayi NEDJIMI](https://ayinedjimi-consultants.fr) | [GitHub](https://github.com/ayinedjimi) | [HuggingFace](https://huggingface.co/AYI-NEDJIMI)

---

## Licence / License

Apache 2.0 — Libre d'utilisation commerciale et personnelle.