Objectif
Avoir un support clair pour apprendre : colonne EN (points clés + micro-extraits) et colonne FR (traduction/synthèse). Le contenu est un résumé, pas une reproduction intégrale de l’original.
Introduction — pourquoi le prompt engineering est itératif
EN (key points)
- A prompt is the input used by an LLM to predict an output (text, sometimes images).
- Effectiveness depends on model choice, configuration, wording, structure, and context.
- Prompt engineering is iterative; weak prompts lead to ambiguous/inaccurate responses.
Short excerpt (EN)
“Prompt engineering is an iterative process… Inadequate prompts can lead to ambiguous, inaccurate responses…”
FR (traduction / synthèse)
- Un prompt est l’entrée (texte et parfois image) qui déclenche la génération.
- La qualité dépend du modèle, des réglages, de la formulation, de la structure et du contexte.
- C’est un processus d’itération : un prompt faible donne des réponses floues/inexactes.
LLM Output Configuration — tokens, température, top-k, top-p
EN (key points)
- Output length: more tokens increases compute/cost/latency; a limit cuts output, not “style”.
- Temperature: low = stable/deterministic; high = diverse/unexpected.
- Top-K / Top-P: restrict candidate tokens; lower tends to be more consistent.
- Settings interact (e.g., temp=0 may dominate sampling controls).
Short excerpt (EN)
“Generating more tokens requires more computation… higher costs.”
FR (traduction / synthèse)
- Tokens : plus tu génères, plus ça coûte et peut ralentir; la limite coupe sans garantir la concision.
- Température : bas = stable; haut = plus varié/créatif.
- Top-K/Top-P : filtrage des choix; utile pour contrôler la diversité.
- Ces paramètres s’influencent mutuellement.
Prompting techniques — zero-shot, one-shot, few-shot
EN (key points)
- Zero-shot: task + input, no examples.
- One-shot: one example to imprint a pattern.
- Few-shot: multiple examples, stronger adherence to format (classification/extraction).
- Track iterations (goal, settings, prompt, output) for controlled improvement.
Short excerpt (EN)
“A few-shot prompt provides multiple examples…”
FR (traduction / synthèse)
- Zero-shot : description + entrée, sans exemple.
- One-shot : un exemple pour imposer le format.
- Few-shot : plusieurs exemples pour renforcer le pattern (extraction/classification).
- Documenter les essais accélère l’amélioration.
System, Role & Context — cadrer le modèle
EN (key points)
- System prompting: high-level rules (tone, boundaries, constraints).
- Role prompting: expert persona to shape output style/structure.
- Contextual prompting: background + success criteria reduce ambiguity.
FR (traduction / synthèse)
- System : règles de comportement et de sortie.
- Role : persona d’expert pour structurer la réponse.
- Contexte : informations nécessaires + critères de réussite.
Step-back prompting — reculer pour mieux viser
EN (key points)
- Ask a more general question first, then apply it to the specific task.
- Improves planning and reframing when the initial prompt is too narrow/noisy.
FR (traduction / synthèse)
- Commencer par une question plus générale (principes), puis revenir au cas concret.
- Améliore le plan, la clarté et réduit les erreurs d’orientation.
Chain of Thought (CoT) — expliciter les étapes
EN (key points)
- Encourage step-by-step reasoning for problems solvable by “talking through”.
- Keep the final answer clearly separated from the reasoning.
Short excerpt (EN)
“Any task that can be solved by ‘talking through’ is a good candidate for a chain of thought.”
FR (traduction / synthèse)
- Demander un raisonnement en étapes pour les problèmes qui s’y prêtent.
- Séparer clairement le raisonnement et la réponse finale.
Self-consistency — plusieurs essais, puis la réponse la plus stable
EN (key points)
- Generate multiple answers (often with more randomness), then pick the most consistent/frequent result.
- Pairs well with CoT if you can reliably extract the final answer each time.
FR (traduction / synthèse)
- Produire plusieurs sorties, puis retenir la plus cohérente/fréquente.
- Souvent combiné avec CoT, avec extraction claire de la réponse finale.
Tree of Thoughts (ToT) — explorer des branches
EN (key points)
- Explore a tree of candidate “thoughts”, evaluate branches, continue on promising ones.
- Useful when a single linear reasoning chain is too brittle.
FR (traduction / synthèse)
- Approche arborescente : plusieurs pistes, scoring/évaluation, approfondissement des meilleures.
- Utile pour plans, stratégie, problèmes complexes.
ReAct — Reason & Act (outils)
EN (key points)
- Interleave reasoning with actions (search, code, APIs), then update the plan based on results.
- Control output length to avoid runaway responses.
FR (traduction / synthèse)
- Alterner raisonnement et actions (outils), puis adapter la solution selon les résultats.
- Contrôler les tokens et le format pour éviter les réponses trop longues.
Automatic Prompt Engineering (APE)
EN (key points)
- Use models to propose prompt candidates, evaluate with metrics, keep improving.
- Good for production systems that must handle many user phrasings.
FR (traduction / synthèse)
- Automatiser la recherche de bons prompts : candidats → score → sélection → amélioration.
- Très utile pour des chatbots en production.
Code prompting — générer, expliquer, traduire, déboguer
EN (key points)
- Be explicit about language, versions, constraints, I/O, edge cases.
- Use prompts for: generation, explanation, translation, debugging/review.
FR (traduction / synthèse)
- Préciser langage, version, contraintes, entrées/sorties et cas limites.
- Cas d’usage : générer, expliquer, traduire, déboguer/reviewer.
Multimodal prompting — texte + images + autres
EN (key points)
- Multimodal prompting combines multiple inputs (text + images/audio/code) depending on the model.
- Different concern from code prompting (often still text + constraints).
FR (traduction / synthèse)
- Multimodal = plusieurs formats d’entrée (texte + image + audio + code) si le modèle le supporte.
- Distinct du prompting “code” (souvent du texte structuré).
Best Practices — ce qui donne le plus de résultats
EN (key points)
- Provide examples (one/few-shot): strongest lever to match format & expectations.
- Simplicity: concise, clear, avoid unnecessary info.
- Specify output: schema, length, tone, constraints.
- Control max tokens: manage cost/latency, avoid runaway.
- Use variables: reusable templates.
- Experiment and document prompt attempts.
- Adapt after model updates.
Short excerpt (EN)
“The most important best practice is to provide… examples within a prompt.”
FR (traduction / synthèse)
- Exemples (one/few-shot) : levier n°1 pour verrouiller format et attentes.
- Simplicité : clair, concis, sans bruit.
- Sortie précise : schéma, longueur, ton, contraintes.
- Max tokens : coût/latence + évite les réponses qui s’étirent.
- Variables : prompts réutilisables.
- Tester + documenter : itération maîtrisée.
- Re-tester après mises à jour du modèle.
Summary — ce que tu dois retenir
EN (key points)
- Prompt engineering = iterative improvement + tuning configs for accuracy and usefulness.
- Use the toolbox: few-shot, system/role/context, step-back, CoT, self-consistency, ToT, ReAct, APE.
- Best practices are what makes it production-grade: examples, clarity, output spec, token control, documentation.
FR (traduction / synthèse)
- Itération sur le prompt + réglages = qualité et utilité.
- Choisir la technique selon le besoin (format, raisonnement, exploration, outils, automatisation).
- La qualité “prod” vient des best practices : exemples, clarté, format, tokens, documentation.