  Unwanted interaction between a quantum system and its fluctuating environment
leads to decoherence and is the primary obstacle to establishing a scalable
quantum information processing architecture. Strategies such as environmental
and materials engineering, quantum error correction and dynamical decoupling
can mitigate decoherence, but generally increase experimental complexity. Here
we improve coherence in a qubit using real-time Hamiltonian parameter
estimation. Using a rapidly converging Bayesian approach, we precisely measure
the splitting in a singlet-triplet spin qubit faster than the surrounding
nuclear bath fluctuates. We continuously adjust qubit control parameters based
on this information, thereby improving the inhomogenously broadened coherence
time ($T_{2}^{*}$) from tens of nanoseconds to above 2 $\mu$s and demonstrating
the effectiveness of Hamiltonian estimation in reducing the effects of
correlated noise in quantum systems. Because the technique demonstrated here is
compatible with arbitrary qubit operations, it is a natural complement to
quantum error correction and can be used to improve the performance of a wide
variety of qubits in both metrological and quantum-information-processing
applications.
