Skip to main content
  1. Home
  2. Emerging Tech
  3. Computing
  4. News

Digital Trends may earn a commission when you buy through links on our site. Why trust us?

A neural network tried to write a 9th Harry Potter book, with hilarious results

Add as a preferred source on Google

Do you remember that memorable scene in the Harry Potter books when a person seeking revenge on Ron turns out to be Dumbledore hiding behind a cream cake?

If you don’t, that’s probably because you read the version of Harry Potter written by J.K. Rowling instead of an LSTM recurrent neural network — trained to generate new Hogwarts-related stories using a data set consisting of the series’ first four books.

Recommended Videos

“I’ve been experimenting with deep learning over the past few weeks, and the Harry Potter story is the result of one of those experiments,” creator Max Deutsch told Digital Trends. “Beyond just looking for a fun way to practice what I’ve been learning, the Harry Potter project was an attempt to make something enjoyable to read.”

Since the results are more surreal mashup than anything likely to give Rowling sleepless nights, “enjoyable” may not be exactly the word. However, it’s a fascinating demonstration of what happens when a neural network turns its attention to creativity.

“The computer is quite good at capturing the rhythm and style of the source text, but the sentences themselves are mostly nonsense,” Deutsch admits. “Occasionally, there is a glimmer of sense, and these moments — plus the knowledge that a computer wrote it — is what makes the read enjoyable to me.”

Interestingly, this isn’t the first time textual analysis algorithms have been applied to the work of J.K. Rowling. When the U.K. newspaper the Sunday Times outed the mega-successful author as the scribe of detective novel The Cuckoo’s Calling a few years ago — writing under the pen name Robert Galbraith — computer scientists were called in to use machine learning to solve the mystery. By analyzing the text based on word-length distribution, usage of common words like “the” and “of,” and recurring-word pairings, they proved that she was.

Max Deutsch’s work might not have quite the academic rigor of that work, but it moves beyond it by not simply analyzing existing works — but generating new ones. “Creativity is a hard thing to explain, even in the context of humans,” he says. “If creativity is simply the act of creating something new — often based on connecting pre-existing things in new ways — then you can argue that the Harry Potter neural network was very creative. In fact, this might be the first time anyone, or anything, has constructed the sentence: ‘Dumbledore will get out from behind a cream cake.’”

You can read the rest of Deutsch’s deep learning Harry Potter story here.

Luke Dormehl
I'm a UK-based tech writer covering Cool Tech at Digital Trends. I've also written for Fast Company, Wired, the Guardian…
Google’s new AI gives robots better balance, smarter hands, and teamwork capabilities
Google just made robots a lot less clumsy and a lot more helpful.
Gemini robotics 2.0

Google DeepMind just brought sci-fi robots closer to reality, and it is very exciting. Building on its original Gemini Robotics model, the company has introduced Gemini Robotics 2, an AI system designed to help robots think, move, and even work together. Unlike most robots today, which rely on pre-programmed routines or someone controlling them remotely, this new system lets robots figure things out on their own when situations get unpredictable.

Can robots finally handle whole-body tasks?

Read more
Remember Samsung’s Ballie home robot? It may finally be inching closer to reality
Leaked app wireframes give the strongest hint yet that Samsung's Ballie home robot, first shown at CES 2020, might still be headed toward an actual release.
Samsung Ballie robot in a room next to a dog feeder.

Samsung's rolling home robot has been the industry's longest-running "will it ever actually ship" joke, and I'll admit I'd mostly given up on it. Now, there's finally a glimmer of hope.

Samsung first unveiled Ballie as a concept at CES 2020. Then, it showed it as a significantly upgraded version four years later. However, the company never confirmed a release date or committed to releasing it at all. 

Read more
Polar is yet another AI browser, but it goes beyond just automating the mundane web chores
Polar wants to turn your browser into an AI-powered productivity tool
Polar AI browser

The AI browser race is entering a new phase. After spending much of 2025 trying to reinvent web search with built-in chatbots, startups are increasingly shifting their attention toward browser agents that can automate repetitive work instead of simply answering questions. The latest company to embrace that transition is Polar, a startup founded by former Perplexity engineer Kevin Zhang, which has raised $5.7 million in seed funding led by Madrona.

Unlike the first generation of AI browsers that targeted everyday consumers, Polar is designed specifically for knowledge workers. Its premise is straightforward: instead of replacing Google Search, the browser aims to eliminate repetitive tasks that professionals perform across dozens of browser tabs every day.

Read more