JSON-Bag: A generic game trajectory representation
This paper introduces JSON-Bag, a generic method for representing game trajectories by tokenizing their JSON descriptions and measuring similarity via Jensen-Shannon distance, which outperforms hand-crafted baselines in classifying agents, parameters, and seeds across six tabletop games while demonstrating strong correlation with agent policy distances and sample efficiency.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you have a library full of video game replays. Usually, to understand how two games are different, a human expert has to sit down and write a long list of rules to describe what to look for (like "count the number of cards played" or "measure the grid size"). This is slow, boring, and requires knowing the specific game inside and out.
This paper introduces a clever shortcut called JSON-Bag.
Here is the simple breakdown of how it works, using everyday analogies:
1. The "Receipt" Analogy (What is JSON-Bag?)
Think of every moment in a game as a digital receipt. When a game runs, it automatically writes down a long list of facts about what happened (who moved, what they bought, what the score is) in a standard format called JSON.
Usually, this list is just a wall of text. The authors' idea was: "What if we just treat this wall of text like a bag of words?"
- The Process: They take the game's "receipt" (the JSON data) and chop it up into tiny pieces called tokens.
- The Bag: Imagine putting all these chopped-up pieces into a giant bag. You don't care about the order they came in; you just count how many times each piece appears.
- The Result: Instead of a complex game replay, you now have a simple "bag of ingredients" that represents that game. A game where you bought a lot of wood will have a bag full of "wood" tokens. A game where you moved a lot will have a bag full of "move" tokens.
2. The "Taste Test" Analogy (How do we compare them?)
Now that you have a "bag of ingredients" for Game A and a "bag of ingredients" for Game B, how do you tell if they are similar?
The authors use a mathematical tool called Jensen-Shannon Distance (JSD).
- The Analogy: Imagine two chefs. Chef A makes a soup with a specific recipe (a specific mix of ingredients). Chef B makes a soup with a slightly different mix.
- The JSD: This tool measures exactly how different the two recipes are. If the bags of ingredients are almost identical, the distance is zero (they are the same soup). If the bags are totally different, the distance is high.
- Why it's cool: You don't need to know what the ingredients are or how to cook them. You just compare the bags. It works for any game, from a complex card game like 7 Wonders to a simple grid game like Connect4.
3. The "Prototype" Analogy (The Sample Efficient Superpower)
The paper shows that you don't need thousands of game replays to figure out what a game "looks like."
- The Analogy: Imagine you want to describe a "Red Apple." You don't need to show someone 1,000 red apples. You just need to show them one perfect average apple (a prototype).
- The Result: The authors created a "Master Bag" for each type of player or game setting. When a new game happens, they just check: "Which Master Bag does this new game's bag look most like?"
- The Benefit: This is incredibly fast. You can tell if a new game is "novel" or "different" just by looking at a tiny handful of examples, rather than waiting for a massive dataset.
4. The "Magic Detective" (Automatic Feature Extraction)
Sometimes, the simple "bag of tokens" isn't enough to tell the difference between two very similar players (like two advanced computer bots).
- The Analogy: Imagine a detective who usually just counts clues. Sometimes, the clues are too similar to solve the case. But if you give that detective a Random Forest (a smart computer tool that looks for hidden patterns), it can suddenly see connections the simple count missed.
- The Result: By feeding the "tokens" into this smart tool, the system automatically figured out which parts of the game data were actually important, without a human having to tell it what to look for. It significantly improved accuracy on the hardest games.
5. The "Personality Test" (Do the numbers match reality?)
The authors wanted to know: "Does this mathematical distance actually match how different the players really are?"
- The Analogy: They compared the "distance" between two players' "bags" against the actual difference in their playing styles (their "policies").
- The Result: It was a perfect match. If the bags were mathematically far apart, the players were behaving very differently. If the bags were close, the players were playing almost the same way. This proves the method actually understands the "personality" of the game.
The One Catch (The "Sparse" Games)
The paper admits this method isn't perfect for everything.
- The Analogy: Imagine trying to describe a game using a bag of ingredients, but the game only has one ingredient (like a game of Tic-Tac-Toe where you only have X's and O's). The bag is empty or boring.
- The Issue: For games with very few unique parts (like Dots and Boxes or Connect4), the "bag" doesn't have enough information to tell the stories apart. In these cases, the method struggled a bit, though the "Magic Detective" (Random Forest) helped fix it.
Summary
The paper proposes a way to turn any game replay into a simple bag of tokens (like a grocery list). By comparing these lists using a specific math formula, you can instantly tell if two games are similar, identify who played them, or spot if a new game is unique—all without needing a human expert to write custom rules for every single game. It's a universal translator for game data.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.