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…
AMD just gave PC gamers a reason to stop worrying about upgrades
Electronics, Hardware, Computer Hardware, Ryzen, CPU

At a time when many PC gamers are wondering how often they’ll need to replace major components, AMD is leaning into a different message: buy once, upgrade later.

At Computex 2026, AMD unveiled two new gaming-focused processors, confirmed that the AM5 platform will remain supported through 2029, and introduced a new Radeon graphics card aimed at mainstream 1440p gamers. 

Read more
NBA will put AI in charge to tackle bad ref calls and fan fury
NBA games could soon have AI helping officials make calls
NBA Referee

Bad referee calls have become one of the NBA’s most frustrating recurring storylines, especially during the playoffs when every possession gets dissected online within seconds. Now, the league appears ready to lean much harder into artificial intelligence in an attempt to reduce controversial officiating decisions and calm growing fan anger around inconsistent calls.

According to recent comments from Adam Silver, the NBA is actively exploring how AI can improve officiating, replay analysis, and decision-making during games. The discussion comes at a time when criticism surrounding referees has intensified across the league, particularly as social media clips and slow-motion replays make every missed whistle instantly visible to millions of fans.

Read more
Gemini Spark is now rolling out and it hopes you will trust an AI more than apps
Gemini Spark in action

For years, AI assistants have mostly lived in chat windows. You ask a question, they answer it, and the interaction ends there. Google appears ready to push that idea much further with Gemini Spark, a new AI agent that is now rolling out to all Google AI Ultra subscribers in the U.S. So, instead of opening multiple apps and manually managing tasks, you hand the job to Gemini Spark and let it work in the background.

According to Google, Gemini Spark can operate autonomously across your digital ecosystem, handling tasks even when your phone or laptop is turned off. Users can either watch it work in real time or let it run quietly in the background. Importantly, Google says the system remains under user control and is designed to seek approval before taking significant actions.

Read more