Skip to main content

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

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
Former Digital Trends Contributor
I'm a UK-based tech writer covering Cool Tech at Digital Trends. I've also written for Fast Company, Wired, the Guardian…
Kia EV9 and EV6 now fully qualify for the $7,500 tax credit – except for one trim
Kia EV 9

As Kia reported record first-quarter sales, Eric Watson, Kia America VP of sales, made a point of painting a rosy picture for the future: Now that the latest versions of its two best-selling electric vehicles, the EV9 and the EV6, are in full-scale production at Kia’s plant in Georgia, the road is paved for further sales growth.
After all, when Kia announced it was switching production of the EV9 to the U.S. from South Korea in 2023, it largely based its decision on its EVs being eligible for the $7,500 tax credit on new EV purchases offered under President Biden’s Inflation Reduction Act (IRA).
But the EV9’s battery still came from South Korea and China, which meant it would only receive a partial tax credit of $3,750. Starting this year, the EV9 can qualify for the full $7,500 credit, as Kia switched the sourcing of its battery to its Georgia plant.
As for the EV6, 2025 marks the first time its production takes place stateside, and most of its trims have also become eligible for the full tax credit.
However, there are notable exceptions: Both the EV6 and EV9 GT trims, which are known for providing more horsepower - ie, being faster – and offering a “more aggressive styling and accents”, won’t qualify at all for the tax credit: That’s because production for those vehicles remains based in South Korea, according to CarsDirect, which cited a Kia bulletin to its dealers.
The full credit should still be available for those who lease the vehicles, as leasing does not have the same sourcing requirements under the IRA.
Another big unknown for the GT trims is whether the U.S.’ 25% tariffs on all imported vehicles will again be applied. On Wednesday, President Donald Trump paused most tariffs announced in early April for 90 days.
While prices for the new EV6 and EV9 have yet to be revealed, the combination of the tariffs and the inegibility for the tax credit could seriously dent the appeal of the GT trims.

Read more
Subaru’s electric comeback starts now: Trailseeker EV to debut in NYC
subaru trailseeker ev debut 2026 4  thumb

Subaru is finally accelerating into the EV fast lane. The automaker is officially teasing the 2026 Trailseeker, an all-new electric SUV set to debut at the New York International Auto Show next week. While details are still scarce, the Trailseeker marks Subaru’s long-awaited second entry into the EV space, joining the Solterra — and the expectations couldn't be higher.
The teaser image offers only a glimpse of the Trailseeker’s rear badge and taillight, but the name alone suggests rugged ambitions. It's a clear nod to Subaru’s outdoorsy heritage. But in the EV space, the outdoors belongs to brands like Rivian, whose upcoming R2 compact SUV is already turning heads. The Trailseeker is Subaru’s chance to reassert its identity in an electric age.
Currently, Subaru’s only EV is the Solterra, a joint venture with Toyota that shares a platform with the bZ4X. While the Solterra nails some Subaru essentials — all-wheel drive, spaciousness, and off-road capability — it falls short on key EV metrics. Reviewers have pointed to its modest 225-mile range, slow 100kW charging, and unremarkable acceleration, especially compared to rivals like the Hyundai Ioniq 5  or Ford Mustang Mach-E.
The hope is that Subaru has learned from these criticisms and is poised to deliver a more competitive product. The Trailseeker could either be a variation of a newer Toyota EV (possibly the next-gen C-HR+), or something entirely new under the shared platform strategy. Subaru previously announced that its next three EVs would be co-developed with Toyota, before launching four in-house EVs by 2028.
Given how long Subaru has waited to expand its EV offerings, the Trailseeker has to deliver. It's not just about adding a second electric model — it's about keeping pace with a market rapidly leaving legacy automakers behind. If the Trailseeker can improve on the Solterra's shortcomings and channel that classic Subaru ruggedness into a truly modern EV, it might just be the spark the brand needs.

Read more
I tested the world-understanding avatar of Gemini Live. It was shocking
Scanning a sticker using Gemini Live with camera and screen sharing.

It’s somewhat unnerving to hear an AI talking in an eerily friendly tone and telling me to clean up the clutter on my workstation. I am somewhat proud of it, but I guess it’s time to stack the haphazardly scattered gadgets and tidy up the wire mess. 

My sister would agree, too. But jumping into action after an AI “sees” my table, recognizes the mess, and doles out homemaker advice is the bigger picture. Google’s Gemini AI chatbot can now do that. And a lot more. 

Read more