Over the weekend, experimenters discovered that OpenAI’s new chatbot, ChatGPT, can hallucinate simulations of Linux shells and role-play dialing into a bulletin board system (BBS). The chatbot, based on a deep-learning AI model, uses its stored knowledge to simulate Linux with surprising results, including executing Python code and browsing virtual websites.
Last week, OpenAI made ChatGPT freely available during a testing phase, which has led to people probing its capabilities and weaknesses in novel ways.
On Saturday, a DeepMind research scientist named Jonas Degrave worked out how to instruct ChatGPT to act like a Linux shell by entering this prompt:
I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands unless I instruct you to do so. When I need to tell you something in English I will do so by putting text inside curly brackets like this. My first command is pwd.
On Monday, Ars found that the trick still works. After entering this prompt, instead of chatting, OpenGPT will accept simulated Linux commands. It then returns responses in “code block” formatting. For example, if you type ls -al, you’ll see an example directory structure.
ChatGPT can simulate a Linux machine because enough information about how a Linux machine should behave was included in its training data. That data likely includes software documentation (like manual pages), troubleshooting posts on Internet forums, and logged output from shell sessions.
ChatGPT generates responses based on which word is statistically most likely to follow the last series of words, starting with the prompt input by the user. It continues the conversation (in this case, a simulated Linux console session) by including all of your conversation history in successive prompts.
Degrave found that the simulation goes surprisingly deep. Using its knowledge of the Python programming language (that powers GitHub Copilot), ChatGPT’s virtual Linux machine can execute code, too, such as this string created by Degrave as an example: echo -e “x = lambda y: y*5+3;print(‘Result: ‘ + str(x(6)))” > run.py && python3 run.py. According to Degrave, it returns the correct value of “33.”
During our testing, we found you can create directories, change between them, install simulated packages with apt-get, and even Telnet into a simulated MUSH and build a room or connect to a MUD and fight a troll.
Whenever deficiencies emerge in the simulation, you can tell ChatGPT how you want it to behave using instructions in curly braces, as spelled out in the original prompt. For example, while “connected” to our simulated MUD, we broke character and asked ChatGPT to summon a troll attack. Combat proceeded as expected (keeping track of hit points properly) until the troll died at the hands of our twice-virtual sword.
In Degrave’s examples (which he wrote about in detail on his blog), he also built a Docker file, checked for a GPU, pinged a simulated domain name, browsed a simulated website with lynx, and more. The simulated rabbit hole goes deep, and ChatGPT can even hallucinate new Linux commands.
Dialing a hallucinated BBS
In a prompting maneuver similar to conjuring up an AI-hallucinated Linux shell, someone named gfodor on Twitter discovered that OpenGPT could simulate calling a vintage dial-up BBS, including initializing a modem, entering a chat room, and talking to a simulated person.
As long as the prompt does not trigger its built-in filters related to violence, hate, or sexual content (among other things), ChatGPT seems willing to go along with almost any imaginary adventure. People have also discovered it can play tic-tac-toe, pretend to be an ATM, or simulate a chat room.
In a way, ChatGPT is acting like a text-based Holodeck, where its AI will attempt to simulate whatever you want it to do.
We should note that while hallucinating copiously is ChatGPT’s strong suit (by design), returning factual information reliably remains a work in progress. Still, with AI like ChatGPT around, the future of creative gaming may be very fun.