  An ultimate goal of materials science is to deliver materials with desired
properties at will. In the theoretical study, a standard approach consists of
constructing a Hamiltonian based on phenomenology or first principles,
calculating physical observables, and improving the Hamiltonian through
feedback. However, there is also an approach that bypasses such a cumbersome
procedure, namely, to obtain an appropriate Hamiltonian directly from the
desired properties. Solving the inverse problem has the potential to reach
qualitatively different principles, but most research to date has been limited
to quantitative determination of parameters within known models. Here, we
present a general framework that enables the inverse design of Hamiltonians by
optimizing numerous parameters using automatic differentiation. By applying it
to the quantum anomalous Hall effect (AHE), we show that our framework can not
only rediscover the Haldane model but also automatically generate a new
Hamiltonian that exhibits a six-times larger AHE. In addition, the application
to the photovoltaic effect (PVE) gives an optimal Hamiltonian for electrons
moving on a noncoplanar spin texture, which can generate $\sim 900$~A/m$^2$
under solar radiation. This framework would accelerate materials exploration by
establishing unprecedented models and principles beyond human intuition and
empirical rules.
