Table des matières

AI Language Model

Les modèles d’intelligence artificielle (IA), des simples algorithmes de régression jusqu’aux réseaux neuronaux complexes utilisés dans l’apprentissage profond, fonctionnent grâce à une logique mathématique. Toutes les données utilisées par un modèle d’intelligence artificielle, y compris les données non structurées comme le texte, l’audio ou les images, doivent être exprimées sous forme numérique. Le plongement vectoriel, ou représentation vectorielle, est une méthode qui permet de convertir un point de données non structuré en un tableau de nombres, tout en conservant la signification originale des données.

Articles:

Autres pages:

Glossaire

Classification de modèles ouverts: Foundation models by Ibm

Comment faire pour qu'un appel à un LLM ait un résultat reproductible d'une fois sur l'autre ?

Hugging Face entreprise française créée en 2016 → L'IA open source par Hugging Face - Gen AI Nantes 2024-01 par Julien Simon

Sur les perfs

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 <ProviderId/ModelId> --attach=http://127.0.0.1:30781 --agent=plan "Explain async/await in JavaScript"

👾 Attention, les résultats peuvent être très différents:

Cartes IA

Hailo

Axelera

seeedstudio

Ollama & Nvidia Jetpack

Nvidia

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

gpu_bench

Tips: Reset nvidia et CUDA:

# éteindre la carte
# débrancher THB
$ sudo rmmod nvidia_uvm nvidia

Adaptateur GPU externe

En anglais “GPU enclosures”. Nécessite un port Thunderbolt 3, 4 ou à venir 5.

egpu docks

Accelerating Machine Learning on a Linux Laptop with an External GPU by NVidia (Setting up Ubuntu to use NVIDIA eGPU)

eGPU

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
./bin/llama-server --port 8012 --chatml -m ~/Data/AI_Models/Qwen2.5-coder-7b-instruct-q8_0.gguf --ctx-size 48000

nouveautés hiver 2025-26:

chat templates

Quid des chat formats ? Est-ce lié au modèle ?

$ llama-server --help
...
--chat-template JINJA_TEMPLATE          set custom jinja chat template (default: template taken from model's
                                        metadata)
                                        if suffix/prefix are specified, template will be disabled
                                        only commonly used templates are accepted (unless --jinja is set
                                        before this flag):
                                        list of built-in templates:
                                        bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml,
                                        command-r, deepseek, deepseek2, deepseek3, exaone-moe, exaone3,
                                        exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, grok-2,
                                        hunyuan-dense, hunyuan-moe, kimi-k2, llama2, llama2-sys,
                                        llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm,
                                        mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7,
                                        mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3,
                                        phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca,
                                        yandex, zephyr
                                        (env: LLAMA_ARG_CHAT_TEMPLATE)

...

models GGUF format

Modèles:

$ ./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

Élargir la “context window” :

Compilation pour GPU

Il faut le compiler avec CUDA. Avec une version >= 11.7 pour compatibilité syntaxe.

J'ai installé CUDA le 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/ /

Ma dernière installation :

sudo apt install nvidia-headless-590-open nvidia-utils-590 nvidia-cuda-toolkit nvidia-cuda-dev
 
Package: nvidia-headless-590-open
Version: 590.48.01-0ubuntu0.24.04.1
APT-Sources: http://fr.archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages
 
Package: nvidia-cuda-toolkit
Version: 12.0.140~12.0.1-4build4
APT-Sources: http://fr.archive.ubuntu.com/ubuntu noble/multiverse amd64 Packages
 
# Je ne comprends pas j'ai pourtant un /etc/apt/sources.list.d/cuda-ubuntu2404-x86_64.list
# qui pointe sur /etc/apt/sources.list.d/cuda-ubuntu2404-x86_64.list

en option ou @ spécifier pour le cmake build :

export PATH=$PATH:/usr/local/cuda-<version>/bin/

Ensuite une longue compilation :

# DCMAKE_CUDA_ARCHITECTURES :
# CUDA GPU Compute Capability https://developer.nvidia.com/cuda-gpus
# RTX 3060 : 86
# RTX 5060 : 120

$ export CUDA_VERSION=12.9 && cmake -B build -DGGML_CUDA=ON \
 -DCMAKE_CUDA_ARCHITECTURES="86;120" \
 -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
 -DCMAKE_CUDA_COMPILER=/usr/local/cuda-${CUDA_VERSION}/bin/nvcc \
 -DCMAKE_INSTALL_RPATH="/usr/local/cuda-${CUDA_VERSION}/lib64;\$ORIGIN"

-- 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

$ time cmake --build build --config Release -j 10

# host: i7-1360P + SSD
...
real	44m35,149s
user	42m38,100s
sys	1m51,594s
...
# Avec `-j 10` (concurent tasks)
real	11m6,449s
user	104m56,615s
sys	3m45,431s

ollama

- https://ollama.com - https://github.com/ollama/ollama

Chat & build with open models.

Interface utilisateur pour gérer et exécuter des modèles localement, utilise Llama.cpp sous le capot.

Sur linux install un service systemd

koboldcpp

https://github.com/LostRuins/koboldcpp

vLLM

vLLM est une bibliothèque open-source optimisée pour servir efficacement des LLMs en production, à la différence de llama.cpp qui est pour le développement ou usage solo sur du matériel standard (RTX ou CPU).

NanoLLM

https://github.com/dusty-nv/NanoLLM

From nvidia ingenier “Dustin Franklin” @dustynv .

Todo

LiteLLM

https://github.com/BerriAI/litellm

Tabby ML

Est à la fois le serveur de model et l'assistant de code.

https://tabby.tabbyml.com/docs/quick-start/installation/linux/

Fourni llama.cpp.