Introduction to LLMs and AI Assisted Coding, with a slant towards After Effects
- Roland Kahlenberg
- Aug 26
- 5 min read

Every LLM uses its proprietary tokenizer. Here is an online tokenizer - tiktokenizer.vercel.app It shows the result of tokenization for words based on the base word, "eve". Although "eve" is the base word for all words, it does not act as a base for the longer words based on it. The only base token is 5671 which references "event". The important takeaway is that an LLMs uses a probability distribution to provide you with the first/next word in its response to you.




URLS - HOTLINKS
Stanford CS230 | Autumn 2025 | Lecture 8: Agents, Prompts, and RAG
0:00 – 41:06 Prompt Engineering
Stanford CS329A Self-Improving AI Agents | Part 1 | Course Overview
4:53 - 10:50 Why Models are Getting Better & Prompt Engineering - Zero Shot & Chain of Thought
Stanford AI Expert: Defines a Proficient AI User and a Casual User/AI Adopter
3:35 - 4:26, 15:32 - 18:32
AI Expert: 71% of People Won't Survive the AI Shift

Below are Pro Tips on using RAG in your prompts when using an LLM as a Coding Assistant for writing scripts and Expressions.
CODE OF CONDUCT FOR YOUR AI CODING ASSISTANT
A programming language has a defined syntax, set of rules, and supported language features. To ensure an AI Coding Assistant produces code compatible with After Effects, apply the following guidelines:
AFTER EFFECTS SCRIPTING AND EXPRESSIONS PROMPT + RAG
The scripting language in After Effects uses Adobe’s ExtendScript which is based on JavaScript ECMAScript 3 (ECMA-262 3rd Edition, 1999). Newer JavaScript features are not supported at runtime in ExtendScript and will cause errors in scripts. An After Effects script may deploy supported Modern Javascript Expressions since they are only applicable for deployment as Expressions and not processed as part of ExtendScript at runtime.
Prompt + RAG
————————————–
Scripts and Expressions must work across all language versions of After Effects.
Scripting: Runtime code must follow JavaScript ECMAScript 3 (ECMA-262 3rd Edition, 1999), as used by After Effects ExtendScript. Newer JavaScript language features are not supported by the ExtendScript runtime and may cause errors.
Expressions: Expressions must use syntax and features supported by the After Effects expression engine and the specified target After Effects version.
Cross-language compatibility: Use After Effects matchNames (the internal, language-independent identifier for After Effects properties, property groups, and effects) whenever possible instead of localized names to ensure cross-language compatibility.
Scripts and Expressions must be written to work across all localized language versions of After Effects.
Ensure compatibility on both macOS and Windows.
————————————–
AFTER EFFECTS EXPRESSIONS PROMPT + RAG
After Effects expressions uses a modern JavaScript engine (ECMAScript 2018 — V8 on Windows, JavaScriptCore on macOS) when the project is set to the JavaScript engine. A Legacy ExtendScript (ECMAScript 3) Expression Engine option still exists for legacy support.
When writing new Expressions, it is recommended to write code for the newer Javascript Expression engine for added functionality and improved performance.
Prompt + RAG
————————————–
Expressions must work across all language versions of After Effects. Use After Effects matchNames (the internal, language-independent identifier for After Effects properties, property groups, and effects) whenever possible instead of localized names to ensure cross-language compatibility.
Ensure compatibility on both macOS and Windows.
Target the [** choose one ** Javscript Expression Engine / Legacy ExtendScript Expression Engine].
————————————–
OFFICIAL ADOBE AFTER EFFECTS URLS
USEFUL EXPRESSIONS
COMMON LLM TERMS APPLICABLE
FOUNDATIONAL CONCEPTS
TOKEN
The basic unit of text that an LLM processes (roughly ¾ of a word on average). Context windows, costs, and limits are all measured in tokens.
PROMPT
The full input you send to the model, including instructions, context, examples, and the user’s question.
CONTEXT WINDOW
The maximum number of tokens (input + output) an LLM can process in a single chat/conversation.
This the hard limit of what the model can “see” and reason over at one time and is also used to define the short-term memory of an LLM.
MEMORY
SHORT-TERM MEMORY
The information currently sitting inside the context window. This may include the system prompt, conversation history, retrieved documents, and any other content provided in the current request – it really depends on the model and how it is set up. It is temporary and disappears when the context is cleared to start a new conversation or compacted to prevent/delay dilution.
LONG-TERM MEMORY
Persistent knowledge that lives outside the context window.
Usually implemented through RAG (vector databases), external knowledge bases, or fine-tuned model weights. To be used, relevant pieces must be retrieved and loaded into the short-term memory (context window).
MODEL DILUTION (ALSO CALLED CONTEXT DILUTION / ATTENTION DILUTION)
The drop in model performance that occurs as the context grows longer or becomes noisier.
Because attention is a limited resource (weights must sum to 1), important information receives less focus when surrounded by too many tokens. This leads to the well-known “lost-in-the-middle” effect and reduced accuracy, even when the relevant data is still present.
COMPACTION
The process of reducing the size of the current context so it continues to fit inside the context window.
Common techniques include summarizing earlier conversation turns, removing less relevant information, or compressing history. Compaction is essential for long-running chats and agents.
PROMPT TECHNIQUES
PROMPT ENGINEERING
The practice of carefully designing and refining prompts to get better, more reliable outputs from an LLM.
CONTEXT ENGINEERING
The broader discipline of managing everything the model sees — prompts, RAG, memory, compaction, and structure; to allow for optimal performance by the LLM.
RETRIEVAL & KNOWLEDGE STRUCTURES
RAG (RETRIEVAL AUGMENTED GENERATION)
A technique that retrieves relevant external information and injects it into the prompt so the model can ground its answers in real, up-to-date data instead of relying only on its training knowledge. Do not feed ambiguous, unnecessary or exceptionally long documents.
RAG is especially critical for After Effects users because LLMs lack context which that are specific and critical to its performance as a Coding Assistant:
Specific scripting and expression syntax
matchNames – a matchName is the internal, language-independent identifier for properties and effects (e.g. "ADBE Scale" instead of the localized name "Scale").
Your particular project structure – only if it is relevant
Custom tools, scripts, or workflows
Current UI details and version differences
When you provide RAG, you are essentially giving the model the context it needs to produce accurate, usable code and advice.
WHAT YOU CAN INCLUDE AS RAG:
Code snippets or complete scripts
Expressions
matchName lists
Screen captures of the UI or Timeline – look for references online
Project structure notes
Error messages
Without good RAG, the model is forced to guess, which often leads to hallucinations, outdated syntax, or code that simply doesn’t work in After Effects.



Comments