{"id":880329,"date":"2022-11-22T16:50:13","date_gmt":"2022-11-23T00:50:13","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/research\/?post_type=msr-project&p=880329"},"modified":"2023-06-29T14:41:05","modified_gmt":"2023-06-29T21:41:05","slug":"grounded-conversational-characters","status":"publish","type":"msr-project","link":"https:\/\/www.microsoft.com\/en-us\/research\/project\/grounded-conversational-characters\/","title":{"rendered":"Grounded Conversational Characters"},"content":{"rendered":"
\n\t
\n\t\t
\n\t\t\t\"header\t\t<\/div>\n\t\t\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\n

Grounded Conversational Characters<\/h2>\n\n\n\n

Dynamically generating interactive game characters by prompting large language models tuned on code<\/p>\n\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\t<\/div>\n<\/section>\n\n\n\n\n\n

Non-Player Characters (NPCs) significantly enhance the player experience in many games. Historically, players\u2019 interactions with NPCs have tended to be highly scripted, to be limited to natural language responses to be selected by the player, and to not involve dynamic change in game state.<\/p>\n\n\n\n

In this work, we demonstrate that use of a few example conversational prompts can power a conversational agent to generate both natural language and novel code. This approach can permit development of NPCs with which players can have grounded conversations that are free-form and less repetitive. We demonstrate our approach using OpenAI Codex (GPT-3 finetuned on GitHub), with Minecraft game development as our test bed. We show that with a few example prompts, a Codex based agent can generate novel code, hold multi-turn conversations and answer questions about structured data. We evaluate this application using experienced gamers in a Minecraft realm and provide analysis of failure cases and suggest possible directions for solutions.<\/p>\n\n\n\n

We include recordings of user studies evaluated on our initial framework, as well as some recordings of further efforts into ‘personalizing’ the agent by producing discernible personas that the agent follows as well as more in-depth conversation prompting.<\/p>\n\n\n\n

\n
View on GitHub<\/a><\/div>\n\n\n\n
Read the paper<\/a><\/div>\n<\/div>\n\n\n\n\n\n

In video games, Non-Player Characters (NPCs) can be central to the player experience, providing agents that players can engage with in interesting and entertaining ways. In many games, the interactions between players and NPCs involve conversations. These are universally highly scripted and limited in scope, usually requiring players to select from a set of prespecified responses in a dialog tree. Conversational interactions rarely directly involve dynamic negotiation of game state. Players cannot, for example, induce NPCs to perform actions that they were not explicitly preprogrammed to do.  <\/p>\n\n\n\n

This scripted gaming paradigm is about to be shattered. In the not-too-distant future, gamers will encounter transformative new experiences ushered in by extremely large pretrained neural network models that are already changing the shape of text, conversation, code, and image generation. Players will be able to engage in much richer conversational interactions with NPCs than has hitherto been thought possible, perform actions collaboratively with agents within the game, and perhaps even eventually transfer personal assistants from one game to the next. Game creators, likewise, will find that these technologies may fundamentally change the ways that they approach the development of NPCs, side quests, story <\/s>lines, and even entire worlds, all through natural language descriptions. Entirely new classes of games may emerge.<\/p>\n\n\n\n

The Natural Language Processing Group<\/a> at Microsoft Research has teamed with Xbox Gaming, Semantic Machines<\/a>, and the Office of the CTO in a project that takes the first steps toward making some of this vision a reality. Some hints of things to come were presented in a fun demo at Microsoft Build in May this year. Now, in a paper<\/a> (presented at the WordPlay 2022 Workshop), the team explores in greater detail the potential for, and challenges of, creating functionally agentive NPCs with which players can hold free-form conversations that are grounded in game, and can have the NPC adaptively generate code that calls functions exposed by the game API.  <\/p>\n\n\n\n

We chose Minecraft as our test <\/s>bed–it\u2019s an open-world game, rich in game lore, in which players creatively build artifacts in the environment, which makes it ideal for our research. Conversations with NPCs are not a standard feature of the game, so this is a relatively pristine environment in which to explore interactions with NPCs that can converse and perform tasks on behalf of players. In addition, Minecraft has several game APIs that permit large language models to write function calls that enable the NPC to perform in-game actions. Figures 1 and 2 depict two examples of player interactions with such an NPC in Minecraft.<\/p>\n\n\n\n

\n
\n
\"Figure
Figure 1: A Minecraft player obtaining crafting recipes by interacting with the NPC <\/figcaption><\/figure>\n<\/div>\n\n\n\n
\n
\"Figure
Figure 2: A Minecraft player instructing the NPC to make an iron sword.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n\n\n\n

In the present experiments, we use a single language model, OpenAI Codex (Chen et al., 2021), to generate both conversational responses and code. We employ a strategy known as few-shot prompting, in which a small number of sample instances in the prompt given to the model generalize to new unseen input (Brown et al., 2020). By the simple expedient of including examples of both natural language conversations and code in the Codex prompt, the model can generalize to interesting new settings, opening up intriguing possibilities for enhanced player experiences and game development. <\/p>\n\n\n\n

The prompt provides the model with the natural language commands and the code samples necessary to enable basic NPC functionalities such as moving around, following the player, locating resources, mining, and crafting artifacts. Figure 3 includes a sample of this prompt. Each new conversational input from the player is appended to this seed prompt and sent to the model for evaluation. When the completion includes a function call to the game API, the corresponding action is performed by the NPC inside the game. When it includes a call to the bot.chat() function, a response string is displayed in the chat interface. For each subsequent input, the prompt includes the seed prompt plus the previous player inputs and model completions. When the prompt exceeds the currently allowed token limit (2048 tokens), we revert to the seed prompt and report to the player that the context has been reset.<\/p>\n\n\n\n

\"Figure
Figure 3: Sample prompt given to the Codex model to power an NPC in Minecraft. <\/figcaption><\/figure>\n\n\n\n

The paper presents an evaluation of the performance of these prompted NPCs through an exploratory user study. We asked eight experienced gamers to interact with an NPC to accomplish tasks in a Minecraft realm–obtain crafting recipes, mine resources, craft items and, lastly, break out of two escape rooms. We found that the NPC exhibits multiple capabilities: it can parse unseen commands, generalize to new functionality, hold multi-turn conversation, generate language about code, switch between code and language generation, answer questions, and generate novel function chains. Short videos showing sample interactions with the participants are available on GitHub (opens in new tab)<\/span><\/a>, along with the original prompts and supporting code, so that others can explore the possibilities for themselves.  <\/p>\n\n\n\n

Gaming environments offer an excellent sandbox for exploring the road ahead in artificial intelligence, with implications beyond gaming to other consumer applications. There are a lot of challenges. We observed numerous issues in our prompt-based approach, from calling of non-existent functions and conversational responses instead of function calls, to factual inaccuracies, inconsistent persona, and recency bias. Many of these issues are already familiar to people researching conversational agents, others are new and cross-modal. So, it is early days yet. It will take time, experimentation and a great deal of ingenuity, innovation and possibly entirely new classes of models to resolve them. In the near term, it is likely that game creators will benefit first from tooling that allows them to use conversational and coding suggestions generated by the models to accelerate development and to explore new possibilities for engaging game scenarios. But the promise of the pretrained models is real, and in due course we expect them to bring exciting new kinds of experiences to the gaming community.  <\/p>\n\n\n\n

\"Table
Table 1: Player utterance, NPC response and the code generated during the second escape room interaction. <\/figcaption><\/figure>\n\n\n\n\n\n

We release some clips of the recordings done during our user study, showcasing some very interesting interactions with our NPC!<\/p>\n\n\n\n

\n
\n
\n