--- 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é
**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)
--- ## 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.