Gamification of Children’s Learning with ChatGPT: A Prototype Application and first Application Insights

Jochen Wulf
8 min readJul 28, 2023

--

Figure 1: DALL-E Visualization of a Robot teaching a Child

As any parent will tell you, getting children to engage with math exercises can often feel like an uphill battle. The challenge lies not in the complexity of the problems, but in capturing the child’s interest and maintaining engagement. In the face of this universal parenting challenge, I found myself turning to an unexpected ally: artificial intelligence, specifically, large language models like ChatGPT developed by OpenAI.

The idea was simple: an application that gamifies the math exercises and leverage the storytelling prowess of ChatGPT. By integrating the math problems into an engaging narrative, I hoped to transform the often-dreaded math practice into an exciting adventure. The goal was to let my child interact with a story featuring her favorite characters, where she could help them navigate through their journey by solving math problems. You can have a look at my prototype at https://github.com/jocwulf/math_adventure.

In the realm of education, the advent of technology has brought about a revolution in teaching methodologies. One such innovative approach is the integration of gamification and artificial intelligence (AI) in children’s learning. This blog post will delve into the function of my application prototype that leverages gamification and AI to create an engaging learning experience for children. It will also discuss the role of gamification in children’s learning and the potential of large language models like GPT in generating creative stories.

Gamification in Children’s Learning

Gamification refers to the application of game-design elements in non-game contexts. In the context of education, it involves using game mechanics to make learning more engaging and fun for children.

Research has shown that gamification can significantly enhance children’s motivation and engagement in learning.[1] It provides immediate feedback, which helps children understand concepts more clearly and retain information longer. Moreover, it encourages active participation and promotes problem-solving skills.

The main idea of my application prototype was to gamify the learning process by integrating math problems into a story. Children are tasked with solving these problems to help the story’s characters, making them active participants in the narrative. This approach not only makes learning math more enjoyable but also helps children understand the practical applications of mathematical concepts.

Story Generation with ChatGPT

The Generative Pretrained Transformer (GPT) by OpenAI has revolutionized artificial intelligence with its human-like text generation, particularly in storytelling. This is made possible by its underlying Transformer architecture and the concept of ‘attention’, which allows the model to focus on different parts of the input when generating each word in the output. This ensures contextually relevant and coherent text generation.

GPT introduces variance and creativity into content creation through a parameter known as ‘temperature’. This controls the randomness of predictions, allowing a balance between randomness and determinism in GPT’s outputs. A higher temperature results in more diverse but potentially less accurate outputs, while a lower temperature makes the outputs more deterministic and confident but potentially less diverse.

This combination of attention mechanism and temperature parameter enables GPT to generate innovative and creative stories, maintaining consistency with the story so far while introducing new elements. It’s like having a virtual storyteller that can spin an endless array of unique and engaging tales.

Moreover, GPT’s storytelling isn’t limited to predefined templates or structures. It can generate stories in a wide variety of styles, genres, and tones, demonstrating a form of artificial creativity. By integrating GPT-generated stories into educational activities, we can create a learning experience that is not only informative but also captivating and fun, transforming traditional learning methods.

The Application: A Prototype Demonstrating the Capacity of GPT

My application serves as a prototype that demonstrates the capacity of GPT in the field of education. It showcases how the AI model can be used to generate creative, engaging content for children, and how it can be integrated with gamification techniques to enhance the learning process.

Story Configuration

The application personalizes the storytelling experience to each child’s preferences. By allowing children to provide their favorite characters and story topics, we can create stories that resonate with them on a personal level. Favorite characters, such as the kid’s teddy bear, her or his best friend or fantasy characters, can be flexibly added within the app. The same holds for story topics, such as being in school, camping in the backyard or playing in the woods. This personalization is crucial for fostering immersion, a state of deep engagement where children become so absorbed in the story that they feel as if they are part of it.

Immersion is a powerful tool in education and learning. When children are immersed in a story, they are more motivated and engaged, which can significantly enhance their learning experience. They are more likely to remember the story and the concepts embedded within it, making learning more effective and enjoyable.

The application addresses elementary school children and lets users choose the included calculation types (addition, substraction, multiplication, division) and number ranges (1-digit and 2-digit). Figure 2 shows the prototypical user interface with the selection options.

Figure 2: Application Prototype: Configuration of the Math Adventure

Story Generation

For creating the continuation story, we send a series of prompts to OpenAI’s Application Programing Interface. Prompt engineering is a critical aspect of working with language models like GPT. It involves crafting the input or “prompt” that is given to the model in a way that guides it towards generating the desired output. It’s a bit like steering a ship: the prompt sets the direction, and the language model sails towards it, generating text along the way.

The art of prompt engineering lies in understanding how to communicate your intent to the model effectively. This involves not only specifying the content you want but also the format, style, and tone. For example, if you want a formal business letter, your prompt should not only include the information to be conveyed but also be phrased in a formal style to guide the model in the right direction.

In this application, I use a chat-based format, where the prompts and responses are structured as a conversation with three roles: the system, the user, and the assistant.

The system role is used to set the overall context and guidelines for the conversation. The following prompt component specifies that the assistant should tell a story about a specific character and topic, with each episode of the story ending with a math problem. Note that the character, topic, and sentences per episode can be set freely.

{"role": "system", 
"content": "Tell a seven-year-old child a continuation story about being in school. Each episode consists of exactly 5 sentences. The story is about the day of the happy elephant trumpy. An episode of the story consists of exactly 5 sentences and no more. Start directly with the narration. End each episode with a math problem, which is always posed by [role: user] beforehand. Integrate the math problem into the narration of the episode. Make sure the math problem is correctly formulated. Do not give the solution. By solving this problem, the child can help the happy elephant trumpy. Continue in the new episode already told episodes and pose a new math problem. PLEASE NOTE: Do not give the solution to the math problem. Use only 5 sentences. End the end with the math problem."}

The user role is used to provide the current question or task in a chat. Here, I use this role to pose the math problems that the assistant integrates into the story. The math problem is generated automatically based on the user settings regarding math problem and number range.

{"role": "user", 
"content": "72 : 9"}

The assistant role is played by GPT, which generates the story based on the prompts from the system and user. It uses its creative capabilities to weave the math problems into the narrative. Prior episodes of the continuation story generated by the assistant are also fed into the prompt, because the OpenAI API is stateless, i.e., it does not remember prior communication.

User Interaction

Once the child hits the “Start the story” button, the application generates a unique story involving the chosen character and topic. Each episode of the story ends with a math problem that the child needs to solve to help the character in the story. The child enters the solution into a number input field and the application checks if it’s correct. If it is, the story continues; if not, the child is encouraged to try again. Figure 3 shows an example of the episodes and answers.

Figure 3: Exemplary Episodes and Answers

The “End the story” button allows the child to end the story at any point. This gives children control over the length of their learning session and allows them to end on a high note when they feel they’ve achieved their learning goal.

My Learnings

Immersion works. The prototype’s effectiveness became evident when I tested it with my daughter. The ability to choose a relatable character was a key attraction. The stories, intertwined with math problems, held her interest and motivated her to solve the tasks. The application also served as a valuable tool for practicing math word problems, often a challenging area for young learners. The story context made these problems more comprehensible and engaging.

Prompt engineering is challenging. Creating effective prompts can be a challenging process, requiring both time and testing. It’s not a one-size-fits-all situation; a prompt that works well with one GPT model may not perform as effectively with another. For instance, in my prototype, the prompt didn’t consistently yield reliable results with GPT-3.5, particularly when it came to formulating correct math problems, as illustrated in Figure 4. However, when tested with GPT-4, the stability improved significantly.

Figure 4: Incorrect Math Problem Formulation by GPT-3.5

Consider legal restrictions. Publishing a book about a copyrighted character is not permissible, and the same applies to content generated by GPT. Additionally, when using free text inputs for character and topic in the application, it’s crucial to adhere to OpenAI’s usage policies. For instance, generating content that is hateful, harassing, or violent is strictly prohibited.

Do not forget the cost. Utilizing the OpenAI API comes with a cost. For instance, GPT-3.5 is priced at $0.002 per 1K tokens, with approximately 75 words equating to 100 tokens. However, the more potent GPT-4 is 30 times more expensive. Therefore, a single round of the math adventure with GPT-4 incurs an API cost of about $0.04. This factor becomes significant when considering scaling to scenarios with heavy usage.

Conclusion

The integration of gamification and AI in children’s learning holds immense potential. By making learning fun and interactive, it can enhance children’s engagement and improve their understanding of complex concepts. The prototype discussed in this article is a testament to this potential. It leverages the power of GPT to generate creative stories and gamifies the learning process by integrating math problems into the narrative.

As AI continues to advance, we can expect to see more innovative applications like this in the field of education. These applications will not only make learning more enjoyable for children but also equip them with the skills needed to thrive in the 21st century.

[1] Su, C‐H., and C‐H. Cheng. “A mobile gamification learning system for improving the learning motivation and achievements.” Journal of Computer Assisted Learning 31.3 (2015): 268–286.

--

--

Jochen Wulf

Jochen Wulf is senior lecturer for Data Driven Service Engineering at Zurich University of Applied Sciences (ZHAW)