  The generation of radiation from free electrons passing a grating, known as
Smith-Purcell radiation, finds various applications including non-destructive
beam diagnostics and tunable light sources, ranging from terahertz towards
X-rays. So far, the gratings used for this purpose have been designed manually,
based on human intuition and simple geometric shapes. Here we apply the
computer-based technique of nanophotonic inverse design to build a 1400nm
Smith-Purcell radiator for sub-relativistic 30 keV electrons. We demonstrate
that the resulting silicon nanostructure radiates with a 3-times-higher
efficiency and 2.2-times-higher overall power than previously used rectangular
gratings. With better fabrication accuracy and for the same electron-structure
distance, simulations suggest a superiority by a factor of 96 in peak
efficiency. While increasing the efficiency is a key step needed for practical
applications of free-electron radiators, inverse design also allows to shape
the spectral and spatial emission in ways inaccessible with the human mind.
