====== AI Coding ====== Coder avec une IA LLM. Explications: * introduction aux LLM : [[https://www.linagora.ai/introduction-aux-llm|Démystifier les (LLM) et comment les mettre en œuvre chez vous pour les étudier de plus près]] * [[https://berdachuk.com/ai/how-to-run-llms-locally|How to Run LLMs Locally: A Complete Step-by-Step Guide]] (//2025-05-27//) sur la quatification, format GGUF, Group Size Suffix (S/M/L) Autres pages: * [[/informatique/ai_coding/samples|Quelques essais perso]] * Un peu de [[/informatique/ai_coding/gpu_bench|GPU bench]] * Pour d'[[#autres_usages|Autres usages]] que la programmation informatique (codage) ===== Sur les perfs ===== * https://cosmo-games.com/quels-modeles-llm-installes-local-8-ou-16-go-vram/ * https://www.glukhov.org/fr/post/2025/05/ollama-cpu-cores-usage/ ==== Estimations ==== **Devstral avec llama.cpp sur RTX 3060 12 Go.** by ChatGPT : | Modèle | Contexte (seq_len) | Batch_size recommandé | Remarques | | ----------------- | ------------------ | --------------------- | ---------------------------------------- | | Devstral Small 7B | 1024 | 4 | Très sûr, VRAM ample | | Devstral Small 7B | 2048 | 2‑3 | Bon compromis vitesse/VRAM | | Devstral Small 7B | 4096 | 1‑2 | VRAM presque saturée | | Devstral 13B | 1024 | 2 | VRAM limitée | | Devstral 13B | 2048 | 1‑2 | Optimal, attention VRAM | | Devstral 13B | 4096 | 1 | VRAM saturée, offload CPU conseillé | | Devstral 13B | 8192 | 1 | Possible mais contexte long → risque OOM | by LeChat: | contexte (tokens) | modèle (paramètres) | VRAM estimée (Go) | Batch size optimal | Latence estimée (tok/s) | Notes | | 512 | 7B | ~5.5 | 8 | 15-25 | Idéal pour des tâches courtes et rapides. | | 1024 | 7B | ~6.0 | 4 | 10-20 | Bon compromis pour des prompts moyens. | | 2048 | 7B | ~7.0 | 2 | 5-15 | Nécessite une gestion fine de la VRAM. | | 4096 | 7B | ~8.5 | 1 | 3-10 | Proche de la limite VRAM, risque de ralentissement. | | 512 | 13B | ~9.0 | 4 | 8-15 | Modèle plus gros, latence accrue. | | 1024 | 13B | ~10.0 | 2 | 4-10 | VRAM presque saturée, batch_size réduit. | | 2048 | 13B | ~11.5 | 1 | 2-8 | Risque élevé de dépassement VRAM, latence importante. | ==== Online services ==== launch a opencode server : opencode serve --port=30781 --print-logs --log-level DEBUG Then **prompt : "Explain async/await in JavaScript"** with: time opencode run -m --attach=http://127.0.0.1:30781 --agent=plan "Explain async/await in JavaScript" 👾 Attention, les résultats peuvent être très différents: * d'une simple phrase de définition à un exemple de code * mais je n'ai pas modifier la taille du ''context'', ce qui a une grande importance sur la taille/qualité de la réponse ... * aussi, le ''system message prompt'' est sélectionné par opencode ... * https://github.com/sst/opencode/issues/4861 * ovhcloud/Qwen3-Coder-30B-A3B-Instruct = 2,008s / 3,100s * ovhcloud/gpt-oss-20b = 14,219s / 21,714s * ovhcloud/Mistral-Nemo-Instruct-2407 = abandon après 7 minutes d'attente ... * ovhcloud/DeepSeek-R1-Distill-Llama-70B = 22,301s / 29,187s * opencode/big-pickle = 2,858s / 3,479s * mistral-codestral/codestral-latest = 2,320s / 3,427s ===== Cartes IA ===== Hailo * [[https://hailo.ai/products/ai-accelerators/hailo-8-ai-accelerator/#hailo8-performance|Hailo 8]] * packaging in a box with a [[https://www.seeedstudio.com/reComputer-AI-R2140-12-p-6431.html|Raspberry by SeedStudio]], 26 TOPS, 15 GB RAM - $289 Axelera * [[https://axelera.ai/ai-accelerators/metis-pcie-ai-acceleration-card|Metis]] * [[https://axelera.ai/ai-accelerators/aipu/europa|Europa]] seeedstudio * [[https://www.seeedstudio.com/reComputer-Mini-J4012-p-6355.html|reComputer Mini J4012]] is a tiny AI computer powered by NVIDIA® Jetson Orin™ NX **16GB** module,delivering up to 100 TOPS AI performance - $900 * [[https://www.seeedstudio.com/reComputer-J2022-p-5497.html|reComputer J2022 - Edge AI Computer with NVIDIA® Jetson Xavier™ NX 16GB]] - $759 Ollama & Nvidia Jetpack * https://www.jetson-ai-lab.com/tutorial_ollama.html * pour plus de performance utiliser [[https://www.jetson-ai-lab.com/tutorial_nano-llm.html|NanoLLM - Optimized LLM Inference]] * Ollama uses llama.cpp for inference, which various API benchmarks and comparisons are provided for on the Llava page. It gets roughly half of peak performance versus the faster APIs like NanoLLM , but is generally considered fast enough for text chat. Nvidia * A10 * https://askgeek.io/en/gpus/NVIDIA/NVIDIA-A10 * [[https://askgeek.io/en/gpus/vs/NVIDIA_NVIDIA-A10-vs-NVIDIA_GeForce-RTX-3060|NVIDIA A10 vs RTX 3060]] ^ ^ A 10 ^ A 30 ^ A 40 ^ A 100 SXM4 ^ A 800 ^ H 100 SMX5 ^ | Prix eBay | $2,330 | $3,999 | $9,950 | $4,000 | $20,000 | $20,000 | | Architecture | Ampere | Ampere | Ampere | Ampere | Ampere | Hopper | | Code name | GA102 | GA100 | GA102 | GA100 | GA100 | GH100 | | Launch date | 2021-04 | 2021-04 | 2020-10 | 2020-05 | 2022-11 | 2022-03 | | Maximum RAM | **24** GB | **24** GB | **48** GB | **40** GB | **40** GB | **96** GB | | Memory type | GDDR6 | HBM2e | GDDR6 | HBM2e | HBM2e | HBM3 | | Memory bandwidth | 600.2 GB/s | 933.1 GB/s | 695.8 GB/s | 1555 GB/s | 1.56 TB/s | 1,681 GB/s | | Memory bus width | 384 bit | 3072 bit | 384 bit | 5120 bit | 5120 bit | 5120 bit | | Memory clock speed | 1563 MHz | 1215 MHz | 1812 MHz | 1215 MHz | 1215 MHz | 1313 MHz | | Core clock speed | 885 MHz | 930 MHz | 1305 MHz | 1095 MHz | 765 MHz | 1837 MHz | | Boost clock speed | 1695 MHz | 1440 MHz | 1740 MHz | 1410 MHz | 1410 MHz | 1665 MHz | | Peak Half Precision (FP16) | 31.24 TFLOPS (1:1) | 10.32 TFLOPS (1:1) | 37.42 TFLOPS (1:1) | 77.97 TFLOPS (4:1) | | | | Pipelines | 9216 | 3584 | 10752 | 6912 | 6912 | 16896 | | Thermal Design Power | 150 Watt | 165 Watt | 300 Watt | 400 Watt | 250 Watt | 700 Watt | | OpenCL | 3.0 | 3.0 | 3.0 | | 3.0 | | ===== Cartes graphiques ===== Nvidia * RTX 3060 * CUDA GPU Compute Capability: 8.6 * [[https://chipset.fr/boutique/composants-pc/carte-graphique/asus-dual-rtx5060ti-o16g-nvidia-geforce-rtx-5060-ti-16-go-gddr7/|RTX 5060 TI 16 Go]] 475€ TTC chipset.fr * CUDA GPU Compute Capability: 12.0 * [[https://www.grosbill.com/carte-graphique/pny-rtx-5060ti-16go-overclocked-dual-fan-155315.aspx|pny-rtx-5060ti-16go-overclocked]] 445€ TTC grosbill.com [[/informatique/ai_coding/gpu_bench|gpu_bench]] ==== Adaptateur GPU externe ==== En anglais "**GPU enclosures**". Nécessite un port Thunderbolt 3, 4 ou à venir 5. egpu docks [[https://developer.nvidia.com/blog/accelerating-machine-learning-on-a-linux-laptop-with-an-external-gpu/|Accelerating Machine Learning on a Linux Laptop with an External GPU]] by NVidia (Setting up Ubuntu to use NVIDIA eGPU) [[/informatique/egpu|eGPU]] ===== Models ===== Pour de l'assistance au code avec un GPU 16Go * [[https://qwen.ai|Qwen]] * Qwen2.5-Coder-7B-Instruct * https://huggingface.co/bartowski/Qwen2.5-Coder-7B-Instruct-GGUF * F16 15.2 GB, Q8_0 8.1 GB * Qwen3-14B * https://huggingface.co/unsloth/Qwen3-14B-GGUF * Q8_0 15.7 GB, Q6_K_XL 13.3 GB * DeepSeek2 * DeepSeek-Coder-V2-Lite-Instruct * https://huggingface.co/bartowski/DeepSeek-Coder-V2-Lite-Instruct-GGUF * Q6_K_L 14.6 GB, Q6_K 14.1 GB * Google * Gemma3 https://huggingface.co/bartowski/burtenshaw_GemmaCoder3-12B-GGUF * Q8_0 12.5 GB * codegemma-7b-it https://huggingface.co/bartowski/codegemma-7b-it-GGUF * Q8_0 9.08 GB * Lama3 * https://huggingface.co/bartowski/Llama-3-8B-Instruct-Coder-v2-GGUF * Q8_0 8.54 GB * Mistral * Mistral-7B-Instruct-v0.3 https://huggingface.co/lmstudio-community/Mistral-7B-Instruct-v0.3-GGUF * Q8_0 7.7 GB * Codestral-22B-v0.1 https://huggingface.co/lmstudio-community/Codestral-22B-v0.1-GGUF * Q5_K_M 15.7 GB, Q4_K_M 13.3 GB * Magistral-Small-2509 https://huggingface.co/bartowski/mistralai_Magistral-Small-2509-GGUF * Q4_1 14.9 GB, Q4_K_M 14.3 GB * Devstral-Small-2507 https://huggingface.co/unsloth/Devstral-Small-2507-GGUF * agentic LLM for software engineering tasks, finetuned from Mistral-Small-3.1, context window of up to 128k tokens * [[https://docs.unsloth.ai/models/tutorials-how-to-fine-tune-and-run-llms/devstral-how-to-run-and-fine-tune|Devstral: How to Run & Fine-tune]] * Q4_K_XL 14.5 GB * VibeThinker-1.5B (Weibo) * https://huggingface.co/Mungert/VibeThinker-1.5B-GGUF * BF16 3.56 GB, F16_Q 2.77 GB * OpenAI * gpt-oss-20b https://huggingface.co/unsloth/gpt-oss-20b-GGUF * F16 13.8 GB, Plan de test de comparaison : * LeChat https://chat.mistral.ai/chat/c97f1761-ca39-4b0c-98e4-e8514d9567b9 [[https://cdn-uploads.huggingface.co/production/uploads/64d1faaa1ed6649d70d1fa2f/jYT1Iq9Jv6vw8Cllr3DuX.png|{{https://cdn-uploads.huggingface.co/production/uploads/64d1faaa1ed6649d70d1fa2f/jYT1Iq9Jv6vw8Cllr3DuX.png?600}}]] ==== Autres usages ==== * [[https://linagora.com/webinaire-openllm-lucie-un-modele-souverain-reellement-open-source|LUCIE, le modèle d’IA Open Source dédié à l’Éducation]] * [[https://openllm-france.fr/|Lucie-7B, notre premier modèle fondation entraîné à partir de zéro, est le plus gros modèle fondation qui a été entraîné sur plus de 30 % de données françaises]] sur openllm-france.fr * [[https://huggingface.co/OpenLLM-France/Lucie-7B-Instruct-human-data|Model Card for Lucie-7B-Instruct-human-data]] * [[https://eurollm.io/|EuroLLM, Large language model made in Europe built to support all official 24 EU languages]] * [[https://korben.info/eurollm-llm-europeen-local-ollama-laptop.html|EuroLLM - Le LLM européen qui tourne sur votre laptop]] * [[https://huggingface.co/utter-project/EuroLLM-9B|huggingface/utter-project/EuroLLM-9B]] * https://huggingface.co/bartowski/EuroLLM-9B-Instruct-GGUF * [[https://github.com/bofenghuang/vigogne/blob/main/docs/model.md|Vigogne]] modèles réentrainer en français (//2023//) * [[https://github.com/bofenghuang/vigogne/blob/main/blogs/2023-08-17-vigogne-chat-v2_0.md|Voilà Voilà: Unleashing Vigogne Chat V2.0]] * [[https://www.channelnews.fr/avec-son-moteur-ia-ultra-leger-et-ultra-puissant-lighton-rend-la-deep-research-accessible-et-souveraine-148246|LightOn dévoile Reason-ModernColBERT]] * un modèle open source taillé pour la Deep Research et capable de battre des géants du retrieval avec seulement 150 millions de paramètres. L’entraînement complet ne prend que deux heures et moins de 100 lignes de code, ouvrant la voie à un fine-tuning rapide sur des corpus privés ===== Models servers ===== ==== llama.cpp ==== https://github.com/ggml-org/llama.cpp Lancer le serveur avec un modèle en local: ./bin/llama-server -m devstralQ5_K_M.gguf --port 8012 --jinja --ctx-size 20000 ~/Code/bronx/AI_Coding/llama.cpp/build/bin/llama-server --port 8012 --chatml -m ~/Data/AI_Models/Qwen2.5-coder-7b-instruct-q8_0.gguf --ctx-size 48000 Quid des chat formats ? Est-ce lié au modèle ? * ''--jinja'' * ''--chatml'' Modèles: * Les models au format GGUF, en fichier ou url sur [[https://huggingface.co/|Hugging Face]], [[https://modelscope.cn/|ModelScope]] * [[https://github.com/ggml-org/llama.cpp#obtaining-and-quantizing-models|Obtaining and quantizing models]] $ ./bin/llama-server --jinja -m ./Qwen3-Coder-30B-A3B-Instruct-Q5_K_S.gguf llama_context: n_ctx_seq (4096) < n_ctx_train (262144) -- the full capacity of the model will not be utilized === Avec GPU === Il faut le compiler avec CUDA. Avec une version >= 11.7 pour [[https://github.com/ggml-org/llama.cpp/issues/11112|compatibilité syntaxe]]. * [[https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md#cuda|Build llama.cpp with CUDA]] J'ai [[https://linuxcapable.com/how-to-install-cuda-on-debian-linux/|installé CUDA]] le [[https://developer.nvidia.com/blog/updating-the-cuda-linux-gpg-repository-key|dépot Nvidia]] Cuda et cuda toolkit 13 $ sudo cat /etc/apt/sources.list.d/cuda-ubuntu2404-x86_64.list deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/ / et aussi export PATH=$PATH:/usr/local/cuda-13.0/bin/ Ensuite une très très longue compilation : DCMAKE_CUDA_ARCHITECTURES: ''86'' pour RTX 3060 et ''120'' pour RTX 5060. # CUDA GPU Compute Capability https://developer.nvidia.com/cuda-gpus # RTX 3060 : 86 # RTX 5060 : 120 $ cmake -B build -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES="86;120" \ -DCMAKE_CUDA_COMPILER=/usr/local/cuda-12.9/bin/nvcc -DCMAKE_INSTALL_RPATH="/usr/local/cuda-12.9/lib64;\$ORIGIN" -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -- ccache found, compilation results will be cached. Disable with GGML_CCACHE=OFF. -- CMAKE_SYSTEM_PROCESSOR: x86_64 -- GGML_SYSTEM_ARCH: x86 -- Including CPU backend -- x86 detected -- Adding CPU backend variant ggml-cpu: -march=native -- CUDA Toolkit found -- Using CUDA architectures: 86;120 -- CUDA host compiler is GNU 13.3.0 -- Including CUDA backend -- ggml version: 0.9.4 -- ggml commit: 6016d0bd4 -- Configuring done (0.5s) -- Generating done (0.2s) -- Build files have been written to: /home/cyrille/Code/bronx/AI_Coding/llama.cpp/build $ cmake --build build --config Release ... real 44m35,149s user 42m38,100s sys 1m51,594s ==== ollama ==== - https://ollama.com - https://github.com/ollama/ollama Chat & build with open models ==== koboldcpp ==== https://github.com/LostRuins/koboldcpp ==== vllm ==== * https://docs.vllm.ai/en/stable/ * https://github.com/vllm-project/vllm ==== NanoLLM ==== https://github.com/dusty-nv/NanoLLM From nvidia ingenier "Dustin Franklin" @dustynv . * https://dusty-nv.github.io/NanoLLM/ * https://www.jetson-ai-lab.com/tutorial_nano-llm.html Todo * [[https://towardsdatascience.com/how-to-build-an-openai-compatible-api-87c8edea2f06/|How to build an OpenAI-compatible API]] ==== LiteLLM ==== https://github.com/BerriAI/litellm ==== Tabby ML ==== Est à la fois le serveur de model et l'[[#tabby|assistant de code]]. https://tabby.tabbyml.com/docs/quick-start/installation/linux/ ===== Coding assistant ===== Agentic Capabilities LLMs. ==== continue ==== https://docs.continue.dev/ ==== Claude code ==== https://claude.com/product/claude-code ==== opencode ==== * https://opencode.ai * https://github.com/sst/opencode Les prompts system: * https://github.com/sst/opencode/tree/dev/packages/opencode/src/session/prompt * config * agents https://opencode.ai/docs/agents/#json * modes https://opencode.ai/docs/modes/#json-configuration 😩 Attention au contenu du fichier configuration ''opencode.json'', la moindre erreur n'est pas signalée, mais pose des problèmes. === Essais de models === ''opencode models'' list les modèles disponibles sur les providers configurés. Bien pratique pour trouver le nom à mettre dans la config. Modèles essayés avec opencode. * Big Pickle (opencode zen) : résultats impressionants ! Un vrai super assistant * Codestral (mistral free) * baseURL: https://codestral.mistral.ai/v1 * model : codestral-latest * Qwen3-Coder-30B-A3B-Instruct (ovhcloud) : ça fonctionne mais juste le minimum * //mistral-nemo-instruct-2407 (ovhcloud) : Pas de réponse// * //Mixtral-8x7B-Instruct-v0.1 (ovhcloud) : Bad request// * //Llama-3.1-8B-Instruct (ovhcloud) : Failed with "First, let me check the opencode documentation to see if there's any information about ..."// * //Meta-Llama-3_3-70B-Instruct (ovhcloud) : Failed with "Unknown agent type: greeting-responder is not a valid agent type"// ==== cline ==== * https://github.com/cline/cline * https://docs.cline.bot ==== codex-cli ==== Par OpenAi * https://developers.openai.com/codex/cli * https://github.com/openai/codex ==== Tabby ==== Contient le [[#tabby_ml|serveur de model]] qu'il faut installer. * https://www.tabbyml.com/ * source https://github.com/TabbyML/tabby * doc https://tabby.tabbyml.com/docs/ ==== Gemini CLI ==== ==== LLxprt Code ==== ==== Windsurf ==== ==== Amp Free ==== ===== MCP server ===== Articles: * [[https://tighten.com/insights/let-ai-interact-with-your-app-via-mcp/|Let AI Interact with Your App via MCP]] (//show how to build an MCP server for a task management app//) ==== Serena ==== * https://github.com/mcp/oraios/serena * https://apidog.com/fr/blog/serena-mcp-server-fr/ ==== arabold/docs-mcp-server ==== https://grounded.tools/ https://github.com/arabold/docs-mcp-server ==== context7 ==== https://context7.com/ ==== laravel boost==== Dédié Php Laravel: https://laravel.com/ai/boost ==== Chrome DevTools MCP ==== https://github.com/ChromeDevTools/chrome-devtools-mcp/ chrome-devtools-mcp permet à votre agent de codage (tel que Gemini, Claude, Cursor ou Copilot) de contrôler et d'inspecter un navigateur Chrome en direct. Il agit comme un serveur MCP (Model-Context-Protocol), donnant à votre assistant de codage IA accès à toute la puissance de Chrome DevTools pour une automatisation fiable, un débogage approfondi et une analyse des performances. ===== LSP Server ===== Intelephense (php) https://intelephense.com/docs Php Actor * https://github.com/phpactor/phpactor * https://phpactor.readthedocs.io ===== system message ===== Exemple de ''system message'' pour un chatbot: * [[https://tighten.com/insights/build-private-self-hosted-ai-applications-with-ollama-and-laravel/?utm_source=newsletter&utm_medium=email&utm_campaign=freekdev-newsletter-193#demo-a-chatbot-for-super-spies|Demo: A Chatbot For Super-Spies!]]