In the AI Loop — Understanding Model Tuning and Learning Behaviors

Artificial Intelligence, by virtue of being, at its essence, a statistical model, runs on pure mathematics. What differentiates Artificial…

In the AI Loop — Understanding Model Tuning and Learning Behaviors

Artificial Intelligence, by virtue of being, at its essence, a statistical model, runs on pure mathematics. What differentiates Artificial Intelligence from Machine learning is the modeling and understanding of natural language, whereby a computer can maintain some functional understanding of language. Yes, it might not know what c-h-a-i-r is, but with enough examples or context around the word, the model can figure out what I am talking about a chair, something you sit on.

Readers who are familiar with my Thesis on Artificial Intelligence know that my conviction stands on a few hard truths:

  • AI systems are built on probability and statistics
  • As probability and statistics machine, the underlying data (and algorithms) govern the quality of the model
  • Data can be strategically layered to refine the model towards particular industries and use cases, as well as adapted more granularly
  • New data can augment models over time to grow their efficacy by tuning the underlying “line of best fit” (a.k.a the learning loop)

Suffice to say that, at each layer of the layered value chain, from foundation model to the prompt/context engineer, there are entities (individuals and/or companies) with subject matter expertise that are integral to the success of the overall system itself.

My fascination, going back to the IBM concept of Think, Reason, Learn, has always been on the learning aspect. I spent a significant portion of my career at Microsoft delving into learning, and that all kickstarted with the canonical “ChatGPT” moment. After putting fingers-to-keyboard and building systems first hand, (and because my mind thinks in frameworks), I wanted to provide a way to visualize all of the different learning components of AI and the underlying loops behind them.

For purposes of structure, I’ll start at the context/prompt engineer and move deeper into complexity towards Reinforcement Learning.

Context/Prompt Engineering

Context/Prompt engineering (used interchangeably) simply means providing instructions to an AI model. Because the AI models employ an algorithm that focuses on attention, adding relevant context and explicit instruction effectively “draw” the intended line-of-best-fit through billions of parameters to then generate the appropriate answer, also known as inference. This process is typically used once a model is complete, not requiring any additional training. Different prompting techniques change the output, which you can read about in Prompting Techniques and Logical Mimicry.

With prompting, there is no true learning loop as the instruction is controlled by the user. Users could employ AI models to refine a prompt and create structure, also called meta prompting, but again, the process is manual.

Retrieval Augmented Generation (RAG)

RAG architectures, are from their name, retrieving data to augmenting the output generated by the model, in effect, its a subset of grounding. Grounding is particularly useful in AI as it acts as a verifiable source of truth for users to confirm that the accuracy and validity of the output, thus reducing hallucinations. RAG architectures are extremely useful when, again, the model does not need to be updated, but information is dynamic and changing. Common use cases include FAQs, summarization tasks, and information lookup.

Learning loop capabilities are self-evident here. In effect, when more information is added to the corpus of information, the more data the model has for itself. To provide a relevant example, in the Dynamics 365 Contact Center at Microsoft, customer service representatives authored knowledge articles to aid in providing information to a caller. After every case, session summaries were generated and/or new knowledge articles were created. That then fed back into any AI system that pulled from that information as a source of truth, without any additional training.

Memory

Memory is the ability for a model to independently record and take notes based on observed or directed input from a user. A master file (example, Claude.md) or external data at as a notepad for the system to scribe notes to remember. This fictitious notepad is then re-read each time the model is used and loaded into context. You can read more in “Let Me Take Note of That, How AI Remembers.” This approach is used similarly to prompt engineering but is more persistent session over session. Personally, when designing learning systems at Microsoft, I frequently used this method when trying to tune a model for personal preferences, where the base model was used across multiple companies.

The learning loop with memory is evident, instruct the model to remember an instruction over each interaction and have it update its memory file. Similarly, instructions can be given for a model to periodically update its memory file to stay relevant. For Human-in-the-loop review, one can always review the memory-derived prompt/instruction set loaded into system context and/or set purging rules for old notes taken to ensure information is always fresh.

Fine-Tuning

Recall from mathematics the line of best fit. We often learned that this was a line, y=mx+b where x was an independent variable. AI models, in effect, have, say billions of x’s, often called parameters. These parameters have values associated with them (the m’s in our example) what are often unknown to the common folk. Even when models are open weight, pinpointing one particular weight that was changed and what that means is nearly impossible (I’m exaggerating) but mean nothing to an ordinary user. These parameters are why AI is sometimes considered a black box and what I observed early, prior to college, when I took an Entrepreneurship course in college and we built neural networks, I digress. Fine-tuning effectively modifies these weights so some are given more impact on the output than others. One might fine-tune a model towards a particular industry, task, or use case so the model becomes more capable in that area.

The learning loop component is additional data for retraining. For example, one might teach a model about various medical drugs, only to need to add more as new drugs come out, or even adding more knowledge in adjacent healthcare capabilities. The one trap to avoid is overfitting, a pitfall in data science where you make the model too accurate and thus can not accommodate any new or slightly different requests.

Reinforcement Learning

Reinforcement learning, arguably, is the most impactful type of modification for a model. In effect, it changes the weights significantly through a reward system. I discussed this concepts of incentives in “Incentives — the Truck of Behavioral Modification.” The reward is, in effect, a function that the AI system is trying to optimize. Maybe that is correctly accepted answers, maybe that is an evaluation of quality by a human, or a mathematical function, but some deterministic measure which the AI can optimize on. Within the AI industry, we see this more with behavior modification, say, how OpenAI takes GPT models and turns them into ChatGPT or the personality behind Gemini or Claude.

Learning Loops for reinforcement learning come in the form of human feedback. Humans can often provide quantitative or qualitative feedback to the system as the accepted source of truth, which act as new data points to retrain the model, similar to fine-tuning. The more technical term for this is Reinforcement Learning through Human Feedback (RLHF).


Model enhancements are non-negotiable for most production use cases and is why I spend most of my time and focus talking about the layered approach to AI as well as the competitive advantage gained from owning unique, unreplicatable data to feed the models. Afterall, they are models!