code-sits-over-a-background-photo-of-quantum-computing-hardware

Twist is a novel programming language for quantum computing developed by a team of researchers at MIT’s Computer Science and Artificial Intelligence Laboratory (CSAIL). Twist is intended to make it easier for developers to detect which data components are entangled, allowing them to write quantum algorithms with fewer errors and better debugging.

Twist’s foundations lie in identifying entanglement, a phenomenon wherein the states of two pieces of data inside a quantum computer are linked to each other

Whenever you perform an action on one piece of an entangled piece of data, it may affect the other one. You can implement powerful quantum algorithms with it, but it also makes it unintuitive to reason about the programs you write and easy to introduce subtle bugs

 says Charles Yuan, a Ph.D. student in computer science at MIT CSAIL and lead author on the paper about Twist, published in the journal Proceedings of the ACM on Programming Languages.

“What Twist does is it provides features that allow a developer to say which pieces of data are entangled and which ones aren’t,” Yuan says. “By including information about entanglement inside a program, you can check that a quantum algorithm is implemented correctly.”

A type system is one of the language’s characteristics, allowing developers to designate which expressions and pieces of data in their programs are pure. According to Yuan, a pure piece of data is free of entanglement, and thus free of potential errors and unintuitive effects generated by entanglement. Twist also includes purity assertion operators to ensure that an expression is not entangled with any other data, as well as static analysis and run-time checks to back up these claims.

To evaluate the language, the team wrote programs in Twist for a set of well-known quantum algorithms and executed them on a quantum simulator.

“We performed experiments that showed the overhead of running these runtime checks is no more than 3.5 percent overrunning the base program, which we believe is fairly low and a good trade-off for the safety guarantees the language gives you,” Yuan says.

The team also introduced small bugs to some of the programs and found that Twist can detect those bugs and reject the erroneous programs.

“We hope that when people use our language or design new quantum languages for their specific use cases, they’ll be able to look at our work and say that the idea of purity and having entanglement as a feature is something they want because it will give them more confidence that their programs are correct without having to run a lot of expensive simulation and testing,” says Yuan.

Twist attempts to address the gap in quantum software, while many researchers are focused on developing efficient and optimized quantum hardware.

“Drawing some parallels to what we’re seeing with machine learning and other high-performance computing applications—where with every new phase of hardware development we get a new system and potentially new capabilities— there are perhaps many incredible opportunities to be had by harnessing the hardware. But it almost always is the software that stands in the way of people having access to that hardware and being able to deploy it and use it widely in different software systems,” says Michael Carbin, an associate professor at MIT and coauthor of the paper about Twist. “A lot of the work we’re doing is laying some of the foundations and trying to tease out what some of the core abstractions are that may make these types of devices more programmable.” 

Subscribe to Newsletter !!

Sign up for Newsletter to receive awesome content in your inbox, every week.

We don’t spam! Read our privacy policy for more info.

Yet one of the challenges the team faced in building Twist is the lack of a standard for what quantum programs should look like.

“Over the years, people have developed core algorithms to solve individually complex tasks like factoring integers, but it’s less clear how we can build an entire ecosystem of software for it,” Yuan says. “With Twist, we were able to build the language around our best consensus of the tasks we want to perform on quantum computers and make it as expressive as possible for those tasks.” 

In terms of limitations, Twist can only tell you whether or not a piece of data is entangled with other pieces of data, but not how they’re entangled. “The exact way they’re entangled is what will determine whether a quantum algorithm is correct, but there are an infinite number of ways in which data can be entangled,” says Yuan. “It’s a real challenge to be able to give that finer-grained detail, and it’s something we’ll need to do in the future.”

The team is now working on a new language based on Twist that will address other quantum phenomena like phase and superposition, but they hope Twist will pave the way for stronger quantum programs.

“For a developer trying to implement a quantum algorithm, they need the tools built into the language to tell them something is happening in their program that’s caused by entanglement,” Yuan says. “If we can build core language principles and features that allow a developer to reason about entanglement, we can make it so entanglement is less of a cognitive burden, and allow developers to write more intuitive programs.”

Subscribe to Newsletter !!

Sign up for Newsletter to receive awesome content in your inbox, every week.

We don’t spam! Read our privacy policy for more info.

heshmore logo

Sign up to Newsletter receive Top Technology Stories in your inbox, every week.

We don’t spam! Read our privacy policy for more info.