diff --git a/content/conf.py b/content/conf.py index 38e344f..150ee57 100644 --- a/content/conf.py +++ b/content/conf.py @@ -50,6 +50,8 @@ # https://myst-parser.readthedocs.io/en/latest/syntax/optional.html myst_enable_extensions = [ "colon_fence", + "attrs_inline", + "attrs_block" ] # Settings for sphinx-copybutton diff --git a/content/guide.rst-if-wanted b/content/guide.rst-if-wanted deleted file mode 100644 index 89553fb..0000000 --- a/content/guide.rst-if-wanted +++ /dev/null @@ -1,37 +0,0 @@ -Instructor's guide -================== - -Why we teach this lesson ------------------------- - - - -Intended learning outcomes --------------------------- - - - -Timing ------- - - - -Preparing exercises -------------------- - -e.g. what to do the day before to set up common repositories. - - - -Other practical aspects ------------------------ - - - -Interesting questions you might get ------------------------------------ - - - -Typical pitfalls ----------------- diff --git a/content/img/llm_blocks.excalidraw b/content/img/llm_blocks.excalidraw new file mode 100644 index 0000000..83e4acf --- /dev/null +++ b/content/img/llm_blocks.excalidraw @@ -0,0 +1,744 @@ +{ + "type": "excalidraw", + "version": 2, + "source": "https://excalidraw.com", + "elements": [ + { + "id": "W5JJ4pzMDaNO-Nyjh1os-", + "type": "line", + "x": 1085, + "y": 333.75, + "width": 271.25, + "height": 381.25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b2s", + "roundness": { + "type": 2 + }, + "seed": 1691872828, + "version": 42, + "versionNonce": 1970605615, + "isDeleted": true, + "boundElements": [], + "updated": 1789064543146, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + -271.25, + 381.25 + ] + ], + "startBinding": null, + "endBinding": null, + "startArrowhead": null, + "endArrowhead": null, + "polygon": false, + "created": null + }, + { + "id": "v93xHqgu3Qb6Mk0il3CUp", + "type": "line", + "x": 812.5, + "y": 718.75, + "width": 526.25, + "height": 1.25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b2t", + "roundness": { + "type": 2 + }, + "seed": 538243076, + "version": 32, + "versionNonce": 315453505, + "isDeleted": true, + "boundElements": [], + "updated": 1789064543146, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 526.25, + 1.25 + ] + ], + "startBinding": null, + "endBinding": null, + "startArrowhead": null, + "endArrowhead": null, + "polygon": false, + "created": null + }, + { + "id": "qVRv1aYw_02xFGbAjkDoc", + "type": "line", + "x": 1337.5, + "y": 720, + "width": 256.25, + "height": 391.25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b2u", + "roundness": { + "type": 2 + }, + "seed": 1643358396, + "version": 55, + "versionNonce": 1597075535, + "isDeleted": true, + "boundElements": [], + "updated": 1789064543146, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + -256.25, + -391.25 + ] + ], + "startBinding": null, + "endBinding": null, + "startArrowhead": null, + "endArrowhead": null, + "polygon": false, + "created": null + }, + { + "id": "e-LPdi8xJ3pEmwwbI5zqx", + "type": "text", + "x": 1002.7503997525362, + "y": 292.020800020622, + "width": 158.27999877929688, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b2w", + "roundness": null, + "seed": 1614611460, + "version": 71, + "versionNonce": 2065154081, + "isDeleted": true, + "boundElements": [], + "updated": 1789064543146, + "link": null, + "locked": false, + "text": "Lack of tracking", + "fontSize": 20, + "fontFamily": 5, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Lack of tracking", + "autoResize": true, + "lineHeight": 1.25, + "labelPosition": null, + "created": null, + "baseFontSize": null + }, + { + "id": "4vW5pXxaYxr9qKQ9QFUt5", + "type": "text", + "x": 744.0970667629026, + "y": 724.416799917512, + "width": 46.47999954223633, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b2x", + "roundness": null, + "seed": 1366572604, + "version": 42, + "versionNonce": 861703791, + "isDeleted": true, + "boundElements": [], + "updated": 1789064543146, + "link": null, + "locked": false, + "text": "Cost", + "fontSize": 20, + "fontFamily": 5, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Cost", + "autoResize": true, + "lineHeight": 1.25, + "labelPosition": null, + "created": null, + "baseFontSize": null + }, + { + "id": "NtBAuvidyDsAVnN6vGkx9", + "type": "text", + "x": 1347.9861333195854, + "y": 729.375199876268, + "width": 93.36000061035156, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b2y", + "roundness": null, + "seed": 2058620804, + "version": 37, + "versionNonce": 692917249, + "isDeleted": true, + "boundElements": [], + "updated": 1789064543146, + "link": null, + "locked": false, + "text": "Capability", + "fontSize": 20, + "fontFamily": 5, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Capability", + "autoResize": true, + "lineHeight": 1.25, + "labelPosition": null, + "created": null, + "baseFontSize": null + }, + { + "id": "VBpKoAlJjXNnz_l1RvMzK", + "type": "text", + "x": 810.3139990720102, + "y": 496.2087997112922, + "width": 127.94666290283203, + "height": 29.027733360829263, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b30", + "roundness": null, + "seed": 1154447676, + "version": 167, + "versionNonce": 750708879, + "isDeleted": true, + "boundElements": [], + "updated": 1789064543146, + "link": null, + "locked": false, + "text": "llm-gateway", + "fontSize": 23.22218668866341, + "fontFamily": 5, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "llm-gateway", + "autoResize": true, + "lineHeight": 1.25, + "labelPosition": null, + "created": null, + "baseFontSize": null + }, + { + "id": "m5L52WkQWGwz8Fufr2G5E", + "type": "text", + "x": 1220.1569623600049, + "y": 496.2781331133657, + "width": 43.33333206176758, + "height": 26.80546672165854, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b32", + "roundness": null, + "seed": 536877956, + "version": 214, + "versionNonce": 829221857, + "isDeleted": true, + "boundElements": [], + "updated": 1789064543146, + "link": null, + "locked": false, + "text": "ITS", + "fontSize": 21.444373377326833, + "fontFamily": 5, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "ITS", + "autoResize": true, + "lineHeight": 1.25, + "labelPosition": null, + "created": null, + "baseFontSize": null + }, + { + "id": "GMokk_87ZLcq0v5zQ6gxj", + "type": "text", + "x": 979.6128522554902, + "y": 731.2919044463467, + "width": 207.82666015625, + "height": 28.020800020622126, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b33", + "roundness": null, + "seed": 547594628, + "version": 89, + "versionNonce": 420544175, + "isDeleted": true, + "boundElements": [], + "updated": 1789064543146, + "link": null, + "locked": false, + "text": "AI experimentation", + "fontSize": 22.416640016497702, + "fontFamily": 5, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "AI experimentation", + "autoResize": true, + "lineHeight": 1.25, + "labelPosition": null, + "created": null, + "baseFontSize": null + }, + { + "id": "fEeJe5fBV97kr2nvVtgWn", + "type": "rectangle", + "x": 586.25, + "y": 342.5, + "width": 93.75, + "height": 396.25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b34", + "roundness": { + "type": 3 + }, + "seed": 1102718881, + "version": 105, + "versionNonce": 112163407, + "isDeleted": false, + "boundElements": null, + "updated": 1789064552081, + "created": 1789064548585, + "link": null, + "locked": false + }, + { + "id": "PjPpNkkCpJ0heQXw9Olh3", + "type": "text", + "x": 442.25, + "y": 455.5, + "width": 127.97333526611328, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b35", + "roundness": null, + "seed": 1237254625, + "version": 60, + "versionNonce": 193320271, + "isDeleted": false, + "boundElements": null, + "updated": 1789064667761, + "created": 1789064559812, + "link": null, + "locked": false, + "text": "Input tokens", + "fontSize": 20, + "baseFontSize": null, + "fontFamily": 5, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Input tokens", + "autoResize": true, + "lineHeight": 1.25, + "labelPosition": null + }, + { + "id": "P6zvJ3iPKR-cfsdI9yaQS", + "type": "rectangle", + "x": 593.75, + "y": 350, + "width": 78.75, + "height": 276.25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "#b2f2bb", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b36", + "roundness": { + "type": 3 + }, + "seed": 1858335887, + "version": 63, + "versionNonce": 109792641, + "isDeleted": false, + "boundElements": null, + "updated": 1789064654915, + "created": 1789064565093, + "link": null, + "locked": false + }, + { + "id": "jS7n0RYG5zRFtkLXmZgHX", + "type": "rectangle", + "x": 1121.2633323669434, + "y": 341.625, + "width": 93.75, + "height": 396.25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b37", + "roundness": { + "type": 3 + }, + "seed": 36731535, + "version": 418, + "versionNonce": 823790593, + "isDeleted": false, + "boundElements": [], + "updated": 1789064585028, + "created": 1789064571394, + "link": null, + "locked": false + }, + { + "id": "t0JbQR-IC4JcJ2NSJ3aYg", + "type": "text", + "x": 1227.2633323669434, + "y": 639.625, + "width": 143.9066619873047, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b38", + "roundness": null, + "seed": 780161199, + "version": 397, + "versionNonce": 1772776929, + "isDeleted": false, + "boundElements": [], + "updated": 1789064651561, + "created": 1789064571394, + "link": null, + "locked": false, + "text": "Output tokens", + "fontSize": 20, + "baseFontSize": null, + "fontFamily": 5, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Output tokens", + "autoResize": true, + "lineHeight": 1.25, + "labelPosition": null + }, + { + "id": "2xqlwmwARE2wsQ1HA7PuG", + "type": "rectangle", + "x": 1127.5133323669434, + "y": 349.125, + "width": 78.75, + "height": 276.25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "#b2f2bb", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b39", + "roundness": { + "type": 3 + }, + "seed": 179331791, + "version": 375, + "versionNonce": 2124718401, + "isDeleted": false, + "boundElements": [], + "updated": 1789064659044, + "created": 1789064571394, + "link": null, + "locked": false + }, + { + "id": "BJ4_mrIziqNWYtMyk7ULp", + "type": "rectangle", + "x": 714.3749999999998, + "y": 341.625, + "width": 372.5000000000001, + "height": 396.25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b3A", + "roundness": { + "type": 3 + }, + "seed": 32208751, + "version": 485, + "versionNonce": 1302594177, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "sgQFDPiU25poqHRh3uUYv" + } + ], + "updated": 1789064608760, + "created": 1789064589606, + "link": null, + "locked": false + }, + { + "id": "sgQFDPiU25poqHRh3uUYv", + "type": "text", + "x": 873.2983341217039, + "y": 527.25, + "width": 54.6533317565918, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b3AV", + "roundness": null, + "seed": 1201338351, + "version": 7, + "versionNonce": 1416432335, + "isDeleted": false, + "boundElements": null, + "updated": 1789064609711, + "created": 1789064608760, + "link": null, + "locked": false, + "text": "Model", + "fontSize": 20, + "baseFontSize": null, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "BJ4_mrIziqNWYtMyk7ULp", + "originalText": "Model", + "autoResize": true, + "lineHeight": 1.25, + "labelPosition": null + }, + { + "id": "PD7JMc86COi9laI_JHx-k", + "type": "text", + "x": 790, + "y": 503.5, + "width": 8, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b3B", + "roundness": null, + "seed": 1006217551, + "version": 3, + "versionNonce": 2002191073, + "isDeleted": true, + "boundElements": null, + "updated": 1789064606517, + "created": 1789064605914, + "link": null, + "locked": false, + "text": "", + "fontSize": 20, + "baseFontSize": null, + "fontFamily": 5, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "", + "autoResize": true, + "lineHeight": 1.25, + "labelPosition": null + }, + { + "id": "Sms9BHY2H2LUP2G8uceyx", + "type": "rectangle", + "x": 1127.513332, + "y": 634.375, + "width": 78.75, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "#ffc9c9", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "b3C", + "roundness": { + "type": 3 + }, + "seed": 2141762849, + "version": 549, + "versionNonce": 1361644911, + "isDeleted": false, + "boundElements": [], + "updated": 1789064661688, + "created": 1789064615720, + "link": null, + "locked": false + } + ], + "appState": { + "gridSize": 20, + "gridStep": 5, + "gridModeEnabled": false, + "viewBackgroundColor": "#ffffff", + "lockedMultiSelections": {} + }, + "files": {} +} \ No newline at end of file diff --git a/content/img/llm_blocks.png b/content/img/llm_blocks.png new file mode 100644 index 0000000..3bcb2b8 Binary files /dev/null and b/content/img/llm_blocks.png differ diff --git a/content/img/llm_blocks.svg b/content/img/llm_blocks.svg new file mode 100644 index 0000000..ee65a23 --- /dev/null +++ b/content/img/llm_blocks.svg @@ -0,0 +1,4 @@ + + +Input tokensOutput tokensModel \ No newline at end of file diff --git a/content/index.md b/content/index.md index 30d34f1..316f9a4 100644 --- a/content/index.md +++ b/content/index.md @@ -122,7 +122,6 @@ simply teaching you how to use these tools, we help you understand: ## See also - [OpenSSF Security Guide for AI Code Assistants](https://best.openssf.org/Security-Focused-Guide-for-AI-Code-Assistant-Instructions) -- TODO Add more references here ## Credits diff --git a/content/index.rst-if-wanted b/content/index.rst-if-wanted deleted file mode 100644 index f981650..0000000 --- a/content/index.rst-if-wanted +++ /dev/null @@ -1,60 +0,0 @@ -LESSON NAME -=========== - -Intro - - - -.. prereq:: - - prerequisites - - - -.. csv-table:: - :widths: auto - :delim: ; - - 20 min ; :doc:`filename` - - -.. toctree:: - :maxdepth: 1 - :caption: The lesson - - -.. toctree:: - :maxdepth: 1 - :caption: Reference - - quick-reference - guide - - - -.. _learner-personas: - -Who is the course for? ----------------------- - - - - - -About the course ----------------- - - - - - - -See also --------- - - - - - -Credits -------- diff --git a/content/introduction.md b/content/introduction.md index 25c0b48..0fd9937 100644 --- a/content/introduction.md +++ b/content/introduction.md @@ -17,16 +17,45 @@ ## What is a Large Language Model? A Large Language Model (LLM) is a type of artificial intelligence trained on -vast amounts of text data to predict and generate human-like text. At their -core, these models learn statistical patterns in language: given a sequence of -words (or better *tokens*: fragments of words, commas, and anything in text), -they predict what comes next. +vast amounts of text data to predict and generate human-like text. + ```{figure} img/llm.png :alt: general concept of LLM for code generation :width: 100% ``` + + +At their core, these models learn statistical patterns in language: given a +sequence of words (or better *tokens*: fragments of words, commas, and anything +in text), they predict what comes next. In order to do so, text must first be +converted into numerical representations, then transformer layers update those +representations using the surrounding context and finally back to text. + +```text +text + -> tokens + -> token IDs + -> embeddings + -> transformer blocks + -> output logits + -> next-token probabilities + -> tokens + -> text +``` + +```{figure} img/llm_blocks.png +:alt: Input tokens -> Model -> Input tokens + output token +:width: 100% + +A simplistic mental model for an LLM performing probabilistic next token prediction. +Source: [Simo Tuomisto](https://simo-tuomisto.github.io/understanding-ai-landscape-lecture/#3) +``` + When applied to code, LLMs benefit from the fact that programming languages are highly structured and follow consistent patterns. The model doesn't "understand" code in the way humans do, but it has learned enough patterns to generate @@ -38,33 +67,35 @@ excel at common patterns but can confidently produce incorrect code for novel or complex problems. **Always verify AI-generated code**. ::: -:::{admonition} Richard Stallman's view on "AI" +:::{admonition} Stochastic parrots :class: tip -"So I've come up with the term Pretend Intelligence. We could call it PI. And if we start saying this more often, we might help overcome this marketing hype campaign that wants people to trust those systems, and trust their lives and all their activities to the control of those systems and the big companies that develop and control them." +{attribution="Emily M. Bender and Timnit Gebru"} +> LM \[Language Model\] is a system for haphazardly stitching together sequences of linguistic forms it has observed in its vast training data, according to probabilistic information about how they combine, but without any reference to meaning: a stochastic parrot. -- [Dr. Richard Stallman cited in Slashdot](https://news.slashdot.org/story/26/01/25/1930244/richard-stallman-critiques-ai-connected-cars-smartphones-and-drm) +Source: ::: :::{admonition} Practitioner's perspective: Simon Willison :class: tip -*"My current favorite mental model is to think of them as an over-confident +{attribution="Simon Willison"} +> My current favorite mental model is to think of them as an over-confident pair programming assistant who's lightning fast at looking things up, can churn out relevant examples at a moment's notice and can execute on tedious -tasks without complaint.* - -*Over-confident is important. They'll absolutely make mistakes—sometimes -subtle, sometimes huge. These mistakes can be deeply inhuman—if a human +tasks without complaint. +> +> **Over-confident** is important. They'll absolutely make mistakes --- sometimes +subtle, sometimes huge. These mistakes can be deeply inhuman --- if a human collaborator hallucinated a non-existent library or method you would -instantly lose trust in them.* - -*Don't fall into the trap of anthropomorphizing LLMs and assuming that +instantly lose trust in them. +> +> **Don't fall into the trap of anthropomorphizing LLMs and assuming that failures which would discredit a human should discredit the machine in the -same way."* +same way.**" -— [Simon Willison, "How I use LLMs to help me write code"](https://simonwillison.net/2025/Mar/11/using-llms-for-code/) +Source: ["How I use LLMs to help me write code"](https://simonwillison.net/2025/Mar/11/using-llms-for-code/) ::: @@ -90,6 +121,12 @@ During pre-training, the model learns: - Relationships between code and comments/documentation - How different parts of a codebase relate to each other +The size of typical datasets also implies that to train a model from the scratch +is a heavy commitment. It is expensive, both in terms of time (person-hours) and +compute. Which in turn means that very few actors do this and most users rely on +such pre-trained "frontier" models for their specific use cases, such as +coding. + ### 2. Fine-tuning and instruction tuning After pre-training, models are often further refined: @@ -154,7 +191,8 @@ Understanding what data models are trained on helps us understand their capabili Consider these implications: - It is useful for teaching models to follow **coding instructions**, not just predict the next token - Because much of the data is **synthetic**, model behavior may reflect the style and biases of the generator models -- It complements **large code pretraining corpora such as The Stack** rather than replacing them +- It complements **large code pretraining corpora** such as [The Stack](https://huggingface.co/datasets/bigcode/the-stack) rather than replacing them +- In the future maybe there might more alternate datasets such as [CodeCommons](https://codecommons.org/) which respect creators' rights. ::: @@ -179,8 +217,8 @@ General-purpose AI assistants accessed via web interface: | [Claude](https://claude.ai) | Anthropic | Large context window, artifacts | | [Gemini](https://gemini.google.com) | Google | Multimodal, Google integration | -:::{admonition} Recommended for exercises: Duck.ai -:class: tip +:::{admonition} Recommended tool for exercises: Duck.ai +:class: note For the exercises in this course, we recommend [Duck.ai](https://duck.ai) by DuckDuckGo. DuckDuckGo is known for its privacy-first philosophy—their search @@ -270,22 +308,11 @@ for an extended taxonomy. ::: -## Current adoption and trends - -:::{warning} -To-Do: This section needs expanding and/or kept up to date with data on current adoption trends. -::: - -- From: [Jellyfish AI Engineering Trends](https://jellyfish.co/newsroom/jellyfish-reveals-ais-real-impact-on-engineering-teams/) (17 March 2026) survey on 700 companies, 200K engineers, 20M pull requests: more than half use AI assisted coding, 64% generate a majority of their code with AI assistance. +## Limitations: what LLMs *cannot* do -## Limitations to keep in mind - -Before diving into specific scenarios, remember these fundamental limitations: - -### What LLMs *cannot* do - -A typical generative AI system based on LLMs, without `toolcall` capabilities, cannot: +Before diving into specific scenarios, remember fundamental limitations. +A typical generative AI system based on LLMs, without *tool-calling* capabilities, cannot: 1. **Verify their own output**: They cannot run code or check if it works. 2. **Access real-time information**: Knowledge is frozen at training cutoff. @@ -295,13 +322,19 @@ A typical generative AI system based on LLMs, without `toolcall` capabilities, c 3. **Understand your specific context**: They don't know your data, infrastructure, or requirements unless you tell them. 4. **Guarantee correctness**: They optimize for "plausible", not "correct". -### Common failure modes +An LLM with *tool-calling* can alleviate some of these limitations, but does not +necessarily solve it. + +:::{admonition} Common failure modes +:class: dropdown - **Hallucinated packages**: Suggesting libraries that don't exist - **Outdated APIs**: Using deprecated functions or old syntax - **Subtle bugs**: Code that looks right but has edge-case failures - **Security vulnerabilities**: Not considering injection, authentication, etc. +::: + :::{exercise} Exercise: Explore an AI chatbot Go to [duck.ai](https://duck.ai) (no account needed) and try the following: @@ -336,9 +369,6 @@ In this section, we covered the foundations of AI-assisted coding: ## See also -:::{warning} -To-Do: This section needs expanding with more links and/or kept up to date. -::: - [StarCoder: A State-of-the-Art LLM for Code](https://huggingface.co/blog/starcoder) - BigCode project blog - [The Stack v2 Paper](https://arxiv.org/abs/2402.19173) - Technical details on training data @@ -346,6 +376,11 @@ To-Do: This section needs expanding with more links and/or kept up to date. - [Awesome-Code-LLM](https://github.com/codefuse-ai/Awesome-Code-LLM) - Curated list of code LLM resources - [Simon Willison: How I use LLMs to help me write code](https://simonwillison.net/2025/Mar/11/using-llms-for-code/) - Practical insights from an experienced practitioner +Current adoption and trends + +- [Jellyfish AI Engineering Trends](https://jellyfish.co/newsroom/jellyfish-reveals-ais-real-impact-on-engineering-teams/) (17 March 2026) survey on 700 companies, 200K engineers, 20M pull requests: more than half use AI assisted coding, 64% generate a majority of their code with AI assistance. + + :::{keypoints} - LLMs are pattern-matching systems trained on billions of lines of code diff --git a/content/quick-reference.rst-if-wanted b/content/quick-reference.rst-if-wanted deleted file mode 100644 index 492da1e..0000000 --- a/content/quick-reference.rst-if-wanted +++ /dev/null @@ -1,2 +0,0 @@ -Quick Reference -=============== diff --git a/content/scenario-full-control.md b/content/scenario-full-control.md index 6e4fdeb..b8a77f0 100644 --- a/content/scenario-full-control.md +++ b/content/scenario-full-control.md @@ -326,7 +326,10 @@ Once satisfied with data loading, move to summary statistics: > for reaction_time and accuracy, grouped by condition." -## Common pitfalls and how to avoid them +:::{admonition} Common pitfalls and how to avoid them +:class: warning, dropdown + +Some of the following will be covered and revisited in the [episode on risks](./security.md). ### Pitfall 1: Accepting code without understanding it @@ -359,6 +362,7 @@ explain the code to a colleague, you shouldn't use it. - Search GitHub for the repository - Be especially suspicious of packages you've never heard of +::: ## When to relax the rules: Learning and exploration