We generate and characterize entangled states of a register of 20 individually controlled qubits, where each qubit is encoded into the electronic state of a trapped atomic ion. Entanglement is generated amongst the qubits during the out-of-equilibrium dynamics of an Ising-type Hamiltonian, engineered via laser fields. Since the qubit-qubit interactions decay with distance, entanglement is generated at early times predominantly between neighboring groups of qubits. We characterize entanglement between these groups by designing and applying witnesses for genuine multipartite entanglement. Our results show that, during the dynamical evolution, all neighboring qubit pairs, triplets, most quadruplets, and some quintuplets simultaneously develop genuine multipartite entanglement. Witnessing genuine multipartite entanglement in larger groups of qubits in our system remains an open challenge.
Quantum error correction is widely thought to be the key to fault-tolerant quantum computation. However, determining the most suited encoding for unknown error channels or specific laboratory setups is highly challenging. Here, we present a reinforcement learning framework for optimizing and fault-tolerantly adapting quantum error correction codes. We consider a reinforcement learning agent tasked with modifying a family of surface code quantum memories until a desired logical error rate is reached. Using efficient simulations with about 70 data qubits with arbitrary connectivity, we demonstrate that such a reinforcement learning agent can determine near-optimal solutions, in terms of the number of data qubits, for various error models of interest. Moreover, we show that agents trained on one setting are able to successfully transfer their experience to different settings. This ability for transfer learning showcases the inherent strengths of reinforcement learning and the applicability of our approach for optimization from off-line simulations to on-line laboratory settings.