This is part of a weekly series covering generative AI as applied to investing, drawn from source material from the full-length book, Truth Engine: Applying AI to Investing.

Causal language modeling had been a long effort from scientists, and OpenAI had a key insight that paved their path to GPT-3 (the ChatGPT predecessor). Remarkably, their insight connected to Munger’s favorite mathematician catch-phrase, “invert, always invert ” (man muss immer umkehren), originally from Jacobi. OpenAI emphasized so-called decoder only casual language modeling. Before, scientists used an encoder portion, which created a mapping of many to one (vector representation), and then the decoder took the one vector to many (words). OpenAI’s insight was counter-intuitive and a bolt of clarity because it stripped the neural network, yet increased modeling power. Seemingly, they took one step back on architectural complexity to take two steps forward in expressivity. By using only a decoder neural network, they matched the many to one mapping to the expressive generative problem. They worked from their desired result, and inverted to settle on the correct architecture, even when prevailing practice suggested otherwise. Their achievement rocked the scientific establishment when they published their GPT-3 paper, “Language Models are Few-Shot Learners”.

Reward Model Loop

Earlier we discussed the tension between the encoder and decoder, couched in terms of the Platonic ideal and instantiations of the ideal. Generative AI architectures are typically decoder only with the reward model (RM) handling some of the conceptual burden typically handled by the encoder. In RL, an agent interacts with an environment to achieve a certain goal. The agent takes actions based on its current state and receives rewards from the environment in return. The goal of the agent is to learn a policy that maximizes the expected sum of rewards over time. The RM is the function that quantifies the desirability of the states that the agent can encounter. Scientists struggled with absorbing the best parts of RL, the RM, into NLU. As an old martial arts teacher liked to say, it wasn’t practice that made perfect, rather perfect practice that made perfect. In the ML language, a meta-learning approach to the learning process is necessary to reach new heights. The RM is exactly the step that takes causal LM and grades it for human preferences.

The design of the RM is critical for the agent’s performance and learning efficiency. Sparse and dense rewards represent two ends of a spectrum. With sparse rewards, the agent receives feedback only upon achieving the end goal, making the task more challenging but potentially more interesting. Dense rewards, on the other hand, offer feedback at each step, which generally accelerates the learning process but may not always lead to the most optimal or interesting solutions.

The reward function should both incentivize good behavior and penalize bad behavior. Positive rewards can be assigned for actions that move the agent closer to its goal, such as reaching a particular location or acquiring an item. Conversely, negative rewards can be used to discourage actions that lead to failure or undesirable states, like hitting a wall, falling off a cliff, or spouting nonsense.

In situations where multiple behaviors or outcomes are desirable, a tradeoff may be necessary. This can be achieved by assigning different weights to different types of rewards. For instance, reaching the end goal might carry more weight than avoiding obstacles. However, striking a balance is crucial to prevent the agent from learning suboptimal behavior or overfitting to the training set.

First, the RM is trained to discern between a generated output and human text and issue a rating from zero to nine. RM training follows these steps:

  • Collect data: The language model responds to a variety of prompts and questions.

  • Rate data: Human experts review generated responses and human responses and rate them based on a rubric. In particular, OpenAI went to lengths to create a 7 point Likert (psychometric) scale to replicate the essence of following instructions55

  • Train reward model: Using the expert ratings, the RM is trained to help the LLM understand desirable responses. The RM mimics the human labelers calculating a rating as the reward factor for the RL model during training

The RM captures desired semantic qualities that can be hard capture with hand-designed criteria. Humans often have criteria they find difficult to express. Radiologists use a special term, “Aunt Minnie”, that captures the ineffability of their job. When a radiologist at the University of Cincinnati was pressed on what he saw in a radiograph that caused his diagnosis, he stated, that it was as clear to him as if his Aunt Minnie was in the radiograph. The first RM trained by OpenAI captured the semantics of a good summary using a ten point scale across several dimensions. Their release of ChatGPT expanded their RM to question and answering, brainstorming, chatting, rewriting, classification, and open-ended generation.55 They furthered scaled instruction tasks with the GPT-4 arguably achieving semantic capture of generic instruction following. Instruction following as a generic mandate is strong. For example, some detractors said that GPT-4 can’t write jokes. When asked to extend a joke from Mervyn King’s book, GPT-4 added:

A physicist, a chemist, and an economist are stranded on a desert island with a can of food. They need to find a way to open it.

The physicist says, We can use the principle of leverage. If we find a suitable fulcrum and a sturdy lever, we can pry the can open with minimal effort.

The chemist chimes in, Or we could find a reactive substance on the island and create a chemical reaction to dissolve the can’s seal, making it easy to open.

The economist, rubbing his chin thoughtfully, finally speaks up, You’re both overcomplicating things. Let’s just assume we have a can opener.

GPT-4: The mathematician then adds, Actually, there’s a more elegant solution. We can prove that the can is open by contradiction. First, let’s assume the can is not open...

If GPT-4 hasn’t reached the high art of original jokes, it can at least extend jokes as a theme. By some historian accounts, humanity domesticated canids 23,000 years ago. Canids live to please their human caretakers with an almost infinite capability to read emotions. As the domestication of canids occurred in pre-history, historians aren’t exactly sure how dogs became man’s best friend. Anthropologists surmise that increasing expansion of human habitats lead to frequent positive encounters, which then lead to an ever escalating co-habitation. Generative AI is now in the period where AI lives with humanity. In OpenAI’s terminology, RMs capture the nature of instruction following. The process has now started for co-evolution and mutual productivity. While right now GPT-4 dominates the benchmarks, the research community has revealed early hints on how alignment will evolve. An umbrella concern is that generative AI is often all too eager to please (the junior developer Earnest). We discuss methods to adjust this behavior. Like canids, there are a plethora of breeds and dispositions that fit different situations.


This is part of a weekly series covering generative AI as applied to investing, drawn from source material from the full-length book, Truth Engine: Applying AI to Investing.