The Science of Sleep is a title that lends itself to abuse by wisecracking moviegoers, should they have difficulty digesting Michel Gondry’s alternately beguiling and frustrating follow-up to his nearly miraculous Eternal Sunshine of the Spotless Mind. Indeed, the first time I saw Gondry’s new film, it was in January on the final day of a sleep-deprived week at Sundance, and I struggled to remain awake.

Recently, I saw this tale of a socially inept young man again after a good night’s sleep and a full tank of coffee, and found the movie much as I remembered it, for better and for worse. The Science of Sleep is a tale of an artist as a young calendar illustrator in Paris, as Gondry was many years ago. But, as this is a Gondry film, The Science of Sleep is, first and foremost, a vehicle for his love of visual invention, the use of spatial effects and rear-projection, and the creation of puppets, clouds, animated buildings, motorized stuffed horses and time machines, all made with everyday items. Gondry’s homely animation effects are truly marvelous, even when they–as the director has acknowledged–preempt the demands of the film’s narrative.

In a departure from his past collaborations with Charlie Kaufman, Gondry wrote the screenplay to The Science of Sleep himself, and with good reason, for the story is highly autobiographical. Gael García Bernal plays Stéphane, a young French-Mexican artist who returns to his mother’s home in Paris after the death of his father. As we will learn, Stéphane is a sheltered, sensitive boy who has trouble distinguishing dreams from reality, and his immaturity is complete enough that his mother has to find an illustrating job for him.

Quite by accident on his first day back home, Stéphane makes the acquaintance of two young female neighbors. Initially attracted to the conventionally sexy Zoe, Stéphane soon realizes that he has more in common with her roommate, Stéphanie (Charlotte Gainsbourg), whose similar personal sensibility is reflected in the likeness of her name. Perhaps our first indication that something is a little off-balance about Stéphane, however, is his curious need to hide the fact that he lives next door–an inept ruse that inspires much mirth between the women.

Still, a friendship begins to bloom between Stéphane and Stéphanie, one that revolves around their shared interest in handmade puppetry. We eventually learn, however, that there is a crucial difference between the two: Stéphane cannot draw clear boundaries between his imagination and reality, and he cannot clearly communicate his feelings for Stéphanie. When he presents her with 3-D glasses for looking at the everyday world, she remarks, “Life is already in 3-D.” Similarly, Stéphane’s elaborate device to connect their brains is a Rube Goldberg substitute for merely talking.

Although there are a handful of other performers–including an excellent comic turn by Alain Chabat as a vulgar co-worker–The Science of Sleep is fundamentally a two-hander between Bernal and Gainsbourg. The glamorous Mexican actor Bernal may not seem like one’s first choice to play a maladjusted French artist, but his foreignness actually abets the story as Stéphane’s discomfort with the French language further inhibits his ability to connect with Stéphanie. (Most of their relationship is conducted in English, a second language for both actors and their characters.) Gainsbourg, herself an English-French hybrid, is also counter-intuitively but successfully cast. The hipster daughter of musician Serge Gainsbourg and actress Jane Birkin, she brings a finely calibrated combination of world-weariness and innocence to her role.

But The Science of Sleep also shows that storytelling is not Gondry’s strong suit. He is a specialist of the short form of music videos (White Stripes and Bjork, among many others) and television commercials, where visual invention and emotional effects are more highly prized than narrative. Eternal Sunshine of the Spotless Mind was a brilliant marrying of two similar sensibilities operating in the two media that work in tandem in movies: the written word, derived from theatrical drama, and the moving image. The premise of Eternal Sunshine was Gondry’s, but it was Charlie Kaufman who brought a finely honed dramatic craftsmanship to the material. As convoluted as that narrative was, it was fundamentally a (very dark) romantic comedy, with a boy meeting his girl, losing her and regaining her. Furthermore, Kaufman fleshed out the story in classical style with a parallel subplot and half a dozen expertly drawn supporting characters. In The Science of Sleep, Gondry’s narrative is comparatively impoverished, with little relief from the yin and yang of Stéphane and Stéphanie, dream life and waking life.

Still, for all of its erratic execution, The Science of Sleep succeeds as an expression of Gondry’s art and passions. He was committed enough to his autobiographical component to shoot in the actual apartment building that he once lived in while working a miserable illustrating job. (He can be seen in the film, in fact, as Stéphane’s late father in home movies.) The Science of Sleep also provides a window into what may have been Gondry’s own youthful whimsy, as when Stéphane pitches a portfolio of gruesome paintings of plane crashes and earthquakes, explaining to his humorless publisher that he could call the calendar “Disasterology.”

Even as he indulges his greatest talents, Gondry is giving us a revealing and occasionally scathing self-portrait. And though the results aren’t entirely successful, The Science of Sleep is littered with felicitous bits of wondrous invention, and it’s a revealing self-examination by one of the most inventive film artists working today.

The Science of Sleep opens Friday in select theaters.