Table of Contents
Fetching ...

High-quality generation of dynamic game content via small language models: A proof of concept

Morten I. K. Munk, Arturo Valdivia, Paolo Burelli

TL;DR

The paper addresses the challenge of generating coherent, world-grounded dynamic game content offline, where cloud-based LLMs are impractical due to latency, cost, and accessibility. It proposes an agentic framework of narrowly fine-tuned SLMs arranged as a DAG-based network, using world-grounded, DAG-generated training data to ground behavior in a specific game world. As a proof-of-concept, the authors implement DefameLM, a single fine-tuned SLM that drives a reputational-conflict loop and is evaluated at 16-, 8-, and 4-bit quantization under a retry-until-success strategy judged by an LLM-based evaluator; results show real-time viability on consumer hardware, with 8-bit and 16-bit performing similarly and 4-bit offering speed advantages at the cost of some quality and reliability. The work demonstrates the feasibility of offline, agentic SLMs for real-time game content and outlines practical paths and challenges for extending to broader narrative tasks, including the need for local runtime quality assessment and broader ethical considerations.

Abstract

Large language models (LLMs) offer promise for dynamic game content generation, but they face critical barriers, including narrative incoherence and high operational costs. Due to their large size, they are often accessed in the cloud, limiting their application in offline games. Many of these practical issues are solved by pivoting to small language models (SLMs), but existing studies using SLMs have resulted in poor output quality. We propose a strategy of achieving high-quality SLM generation through aggressive fine-tuning on deliberately scoped tasks with narrow context, constrained structure, or both. In short, more difficult tasks require narrower scope and higher specialization to the training corpus. Training data is synthetically generated via a DAG-based approach, grounding models in the specific game world. Such models can form the basis for agentic networks designed around the narratological framework at hand, representing a more practical and robust solution than cloud-dependent LLMs. To validate this approach, we present a proof-of-concept focusing on a single specialized SLM as the fundamental building block. We introduce a minimal RPG loop revolving around rhetorical battles of reputations, powered by this model. We demonstrate that a simple retry-until-success strategy reaches adequate quality (as defined by an LLM-as-a-judge scheme) with predictable latency suitable for real-time generation. While local quality assessment remains an open question, our results demonstrate feasibility for real-time generation under typical game engine constraints.

High-quality generation of dynamic game content via small language models: A proof of concept

TL;DR

The paper addresses the challenge of generating coherent, world-grounded dynamic game content offline, where cloud-based LLMs are impractical due to latency, cost, and accessibility. It proposes an agentic framework of narrowly fine-tuned SLMs arranged as a DAG-based network, using world-grounded, DAG-generated training data to ground behavior in a specific game world. As a proof-of-concept, the authors implement DefameLM, a single fine-tuned SLM that drives a reputational-conflict loop and is evaluated at 16-, 8-, and 4-bit quantization under a retry-until-success strategy judged by an LLM-based evaluator; results show real-time viability on consumer hardware, with 8-bit and 16-bit performing similarly and 4-bit offering speed advantages at the cost of some quality and reliability. The work demonstrates the feasibility of offline, agentic SLMs for real-time game content and outlines practical paths and challenges for extending to broader narrative tasks, including the need for local runtime quality assessment and broader ethical considerations.

Abstract

Large language models (LLMs) offer promise for dynamic game content generation, but they face critical barriers, including narrative incoherence and high operational costs. Due to their large size, they are often accessed in the cloud, limiting their application in offline games. Many of these practical issues are solved by pivoting to small language models (SLMs), but existing studies using SLMs have resulted in poor output quality. We propose a strategy of achieving high-quality SLM generation through aggressive fine-tuning on deliberately scoped tasks with narrow context, constrained structure, or both. In short, more difficult tasks require narrower scope and higher specialization to the training corpus. Training data is synthetically generated via a DAG-based approach, grounding models in the specific game world. Such models can form the basis for agentic networks designed around the narratological framework at hand, representing a more practical and robust solution than cloud-dependent LLMs. To validate this approach, we present a proof-of-concept focusing on a single specialized SLM as the fundamental building block. We introduce a minimal RPG loop revolving around rhetorical battles of reputations, powered by this model. We demonstrate that a simple retry-until-success strategy reaches adequate quality (as defined by an LLM-as-a-judge scheme) with predictable latency suitable for real-time generation. While local quality assessment remains an open question, our results demonstrate feasibility for real-time generation under typical game engine constraints.
Paper Structure (26 sections, 3 equations, 6 figures, 2 tables)

This paper contains 26 sections, 3 equations, 6 figures, 2 tables.

Figures (6)

  • Figure 1: Game loop centered on reputational conflict where participants pursue goals (e.g., inciting a riot) blocked by insufficient relative reputation. Players collect intel, initiate smear campaigns, and manage reputation to outmaneuver opponents, who can retaliate with their own smear campaigns. The loop continues until one side achieves its goal or is defeated, ending the conflict.
  • Figure 2: Input/output structure for DefameLM with example outputs from ChatGPT-4o (training data gold standard), DefameLM 16-bit, and DefameLM 4-bit. The model takes as input basic information about the sender and target (either NPC or player), plus contextual information: 1) intelligence about the target, 2) the target audience, and 3) the rhetorical angle of the smear campaign. Inputs shown are shortened, full outputs appear in Appendix \ref{['app:FullTextSample']}. DefameLM was trained without instruction prompting to associate output structure with raw JSON inputs containing sender, target, intelligence, and style data.
  • Figure 3: Example of the DAG-based data generation using choice nodes (predefined lists) and generation nodes (LLM-generated content): A finished LLM input is stitched together from various parts that are either chosen from conditional lists, dependent on earlier choices, or generated by an LLM. In our example, all conditional lists were generated ahead of time using ChatGPT-4o, and generations during the DAG execution were also carried out using ChatGPT-4o. The final collected input $\omega$ populates a parametrized prompt $\Pi(\omega)$, which is sent to a final ChatGPT-4o call, thus producing the final LLM output $\Omega_{\text{LLM}}(\omega)$.
  • Figure 4: Training data generation and fine-tuning pipeline. $a)$ Varied inputs $\{\vec{z}_i\}_i$ are generated following the structure of Fig. \ref{['fig:DataGenerationDAG']}, mapped to string inputs $\omega_i$ populating the parametrized prompt $\Pi$. LLM generation produces outputs $\Omega_{\text{LLM}}(\Pi(\omega))$. $80\,\%$ of the inputs form the training dataset $I_{\text{train}}$, the remainder forms the validation set $I_{\text{eval}}$. $b)$ Base model Llama 3.2-1B is fine-tuned on training data, yielding 16-bit (training precision), 8-bit, and 4-bit quantized versions generating outputs $\Omega_{\text{SLM}}(\omega_i)$.
  • Figure 5: Mean LLM-as-judge scores per metric for DefameLM at different quantization levels (16-, 8-, and 4-bit) compared to the ChatGPT-4o baseline (gold standard training data), averaged over 360 test samples. Three metrics (writing quality, audience targeting, and rhetorical targeting) are omitted as all models achieved perfect scores. The overall judge verdict (rightmost) represents the minimum across all metrics, requiring all individual tests to pass. Error bars show standard error ($\sigma/\sqrt{N}$). Despite the 16-bit model scoring 2 percentage points lower than the 8-bit model on overall verdict, overlapping confidence intervals show that this difference is not statistically significant.
  • ...and 1 more figures