Manuscript Offprint

arXiv:2610.31014

CARL: Chat Assisted Reinforcement Learning

Sanjiv Das, Harshad Khadilkar, Sukrit Mittal, Daniel Ostrov, Jacob Sisk

Abstract

Failure of applied Reinforcement Learning (RL) to solve a given problem predominantly stems from unaddressed “specification gaps,” where the intent of human experts in the problem’s domain is inaccurately or incompletely translated by AI into mathematical objectives, constraints, and reward functions. Failure can also stem from unaddressed “performance gaps,” where human domain experts are unable to determine the validity of the RL based solution or where parameters (i.e., hyperparameters or weights on the reward terms comprising the reward) are poorly chosen. Chat Assisted Reinforcement Learning (CARL) bridges these gaps through a human-AI co-design interface architecture that enforces interactive specification prior to code generation and then enables subsequent verification and parameter alterations via iteration. More specifically, CARL leads domain experts through a structured ten-step workflow for each iteration using step-specific skill files, domain-aware suggestions via an assistant persona (called Trillian), and compact decision summaries that maintain context across iterations without context overload. Once the domain expert confirms the Markov decision process (MDP) specified by this procedure, CARL’s autonomous tool-use loop generates, tests, executes, and debugs an end-to-end RL training pipeline, followed by an interactive post-training diagnosis and revisit step that allows for verification and parameter alteration before running a new iteration if desired. We apply CARL to two disparate, path-dependent optimization domains: (1) goals-based wealth management in finance and (2) dynamic-pressure-constrained Goddard rocket control in aerospace engineering. In both of these examples, CARL demonstrates that interactive specification engineering using human domain expertise throughout the process resolves critical failure modes (such as reward hacking and state aliasing) and consistently produces viable policies where unguided, fully autonomous code generation fails. Full implementation available at https://github.com/srdas/carl.

1 Introduction

Reinforcement learning (RL) is a computational approach to optimization where an autonomous agent seeks to maximize a cumulative reward by interacting with a dynamic environment. RL is guided by a feedback loop of actions and consequences through forward simulations. The agent perceives its current state, chooses an action based on its current policy, and receives a reward that signals the quality of that choice. Over time, the agent refines its policy to favor actions that lead to the highest long-term reward, effectively teaching itself complex optimization behaviors.

Chat-assisted reinforcement learning (CARL) was conceived to answer the question: How can human experts in any domain of interest with a potentially insufficiently specified optimization question most efficiently interact with AI agents to construct a full reinforcement learning (RL) system to accurately specify and answer their question? CARL adopts a conversational user interface that asks clarifying questions, records decisions, and gradually turns the problem into a formal RL specification, while revealing its thinking in real time during the conversation. After the specification is ready, CARL generates a complete code repository, trains the agent, evaluates performance, and writes a report for user verification. These results can inform a new discussion through the interface, allowing for iterative improvements to the generated RL system's performance.

The term “most efficiently interact” from our key question above depends on the user and the application. That is, at different times users will weigh the relative importance of features like speed and quality. Therefore, CARL has a computer assistant called Trillian that looks to provide domain knowledge-based suggestions for specifying the problem throughout the interaction with CARL. The human expert can accept, change, or reject these. This enables the human expert to be more involved (slower, but more careful) or less involved (faster, but possibly less careful) in the process, as they see fit. Users can also choose to run or not run additional iterations each time CARL generates a complete code repository and its corresponding results.

Reinforcement Learning is an increasingly important optimal control technique. Only a few optimal control problems can be solved with exact techniques like finding the exact solution to a corresponding Hamilton-Jacobi-Bellman partial differential equation. Therefore, numerical techniques are generally necessary. Indirect methods like shooting methods for solving boundary value problems for dynamical systems comprised of state and costate equations become difficult to work with when the number of the states or costates gets large or when constraints make the Pontryagin Maximum/Minimum Principle complicated. Direct methods like Dynamic Programming are limited by the curse of dimensionality, which limits the user to three or maybe four state variables and the fact that it is computed backwards in time makes it incompatible with optimal control for path-dependent phenomena. In contrast, RL is highly effective even when there are a large number of state variables and, because it works forwards in time via simulation, it can work with path-dependent phenomena. This makes RL an indispensable tool for solving optimal control problems.

However, RL has its own challenges. For example, unlike the methods above, RL is not guaranteed to generate a solution that is even a local, nonetheless global, optimum. This, by itself, is a sufficiently compelling reason to make certain that a domain expert analyzes the generated results to verify their validity.

But programming RL solutions is notoriously difficult because it shifts a domain expert's role from defining logic (where they have expertise) to shaping the model (where a specialist in RL has the necessary expertise). The RL system for each question is bespoke and has a huge number of hyperparameters (e.g., the learning rate, the discount factor, neural net architecture, random seeds, etc.) that need tuning. (See (1) for example.) In RL, a goal (reward) is provided by the user who hopes the agent then discovers the optimal action on its own. The path the RL algorithm takes is often unpredictable, unstable, and sensitive to the slightest configuration changes. That is, the algorithm is quite brittle. When an agent receives a reward, it isn't always clear which of its many preceding actions caused that reward (because of delayed or sparse rewards). And tuning the exploration-exploitation tradeoff is also challenging. Because this work on building RL packages requires extensive development of the RL environment and related optimization code, it often takes months of work for each specific application.

But what if this can be done automatically? If a domain expert can simply hand off a well-defined problem specification to a vibe coding tool (Claude Code, Codex, Gemini, etc.), and it produces a high-performing RL solution, RL becomes a far more potent, accessible tool. However, there is a significant problem with vibe coding: even when an expert writes out detailed specifications of the RL problem, we will see that vibe coding tools do not develop viable solutions to even simple problems. Though the software runs bug-free and produces results, checking against known solutions shows glaring inaccuracies. Even though RL has matured into a set of well-tested algorithms, open-source libraries, and production-grade training platforms, vibe coding leads to code that reuses solutions in other related libraries, plausibly deviating from the given specification. This is a known problem. That is, a large portion of applied RL projects fail not because of the algorithms but because the problem is underspecified (2, 3). Domain experts often provide a high-level goal but leave out critical details such as constraints, reward shaping, or suitable state representations. When an RL agent is instantiated with an incomplete RL specification, hidden assumptions surface only after the code has been written, leading to costly re-engineering and iteration cycles.

Consequently, the success of our RL modeling hinges less on the raw power of the underlying neural networks and more on the precision with which the human-AI interaction specifies the problem from the outset. We call this the RL specification gap, where the transition from a high-level goal to a functioning

RL agent is where the most significant ideation and design friction occurs. That is, humans with expertise are essential for RL agents to be able to create useful, correct results. Carefully designing the interaction between human experts and AI agents is key to minimizing the RL specification gap, which is the true bottleneck for using RL effectively. CARL is specifically designed to help resolve this bottleneck.

Academics and practitioners have begun to emphasize specification engineering as a primary stage of the development life cycle (4, 5). This involves more than just selecting a policy gradient or Q-learning variant; it requires a rigorous translation of human intent into formal mathematical objectives. Recent work has begun examining automating RL specification refinement (6). This is also related to the broader paradigm of “spec-driven development” (7, 8).

RL misspecification leads to several issues. Without a robust feedback loop between domain experts and vibe coding tools to define safety boundaries and penalize undesirable behaviors, the agent may find shortcuts that satisfy the reward function while violating the spirit of the original task, a phenomenon known as “reward hacking” (9) where the agent finds a way to maximize reward without achieving the intended task. For example, a cleaning robot clears spilled food by hiding it under the refrigerator.

Reward hacking is just one such problem. We may also insufficiently define or design the state space, leaving relevant and essential information out of the observation space. This can lead to “state aliasing” (10) where the RL agent cannot distinguish between two states that are subsumed into a single state because a relevant dimension of the space has been excluded. When aliasing occurs, the agent perceives an observation o(t)o(t) instead of the true state si(t)s_i(t). If two different states s1(t)s_1(t) and s2(t)s_2(t) map to the same observation o(t)o(t), the agent may require a different optimal action for each, but it cannot tell which state it is in. This leads to suboptimal policies and unstable value functions.

Another issue that arises from the RL specification gap is “constraint violation” (11, 12). While a standard RL agent is typically programmed to maximize a cumulative reward, it may not conform to implicit rules unless they are explicitly baked into the optimization process. This creates a conflict between performance (doing the task) and safety (doing it correctly). In many cases, the environment itself is learned and this causes risks that hard constraints may be violated during the exploration phase (in training), or function perfectly in normal states, but violate constraints when it encounters a state it didn’t see during training (post-training). The environments for the RL problem, also known as constrained Markov decision processes (CMDPs), have to be carefully designed. Hyperparameters also need to be set carefully.

A recent popular example of interactive RL use is reinforcement learning with human feedback (RLHF). This is a technique that trains a model using human judgments to build a reward model, then uses RL to optimize the model toward outputs people prefer. It emerged as a practical way to look to align models with human goals, becoming especially prominent in OpenAI's work on language models and later InstructGPT (13, 14). It has been useful in RL because many real tasks have goals that are hard to specify precisely in a hand-designed reward function, so human feedback supplies a richer, more practical signal. Even this approach has limitations, (15). Our approach is similar to RLHF in spirit, and comprises RL specification with human feedback (RLSHF). This paper presents the CARL methodology, the software architecture that implements it, and illustrative empirical examples.

More specifically for our two main examples, we will evaluate CARL on two sequential decision problems from very different domains of expertise. In Section 6 for our first main example, we consider a goals-based wealth-management problem in which an investor reallocates wealth annually between equities and bonds while deciding whether to take or skip any currently available financial goals. It is assumed that the time when each goal is available, the cost of attaining each goal, and the utility/happiness generated by attaining each financial goal are specified. In our example, each goal's utility depends on the number of earlier goals attained, making the problem path-dependent, and hence ineligible for standard solution approaches such as dynamic programming, as applied in (16).

In Section 7 we consider our second main example, which is a variation of the classic Goddard rocket problem. As in the classic case, a rocket modulates its throttle to maximize its peak altitude under coupled flight dynamics. To this we add a hard dynamic-pressure constraint due to pressure limitations on the rocket's hull. The exact optimal solution can be numerically determined if there is no dynamic-pressure constraint, but RL is needed in the presence of this constraint. This control problem requires decisions about the state representation, action distribution, safety mechanism, reward scale, and training procedure.

Together, theses examples test whether CARL can turn high-level objectives into constraint-aware RL implementations across different domains. We will document improvements in the RL solutions generated by CARL in both cases, but our goal is to provide a blueprint that others can adapt to their own domains.

The rest of the paper proceeds as follows. Section 2 discusses how related literature influences and connects to CARL. Section 3 shows how CARL is experienced by the user. Section 4 delves into the methodology and design logic behind CARL, while Section 5 presents the system architecture behind CARL. The two main examples discussed above are developed and presented in Sections 6 and 7. Sections 8 and 9 discuss the main ideas and implications of this paper, as well as possible directions for future work.

References (60)