We use algorithmic methods from online learning to explore some important objects at the intersection of model theory and combinatorics, and find natural ways that algorithmic methods can detect and explain (and improve our understanding of) stable structure in the sense of model theory. The main theorem deals with existence of
ϵ
\epsilon
-excellent sets (which are key to the Stable Regularity Lemma, a theorem characterizing the appearance of irregular pairs in Szemerédi’s celebrated Regularity Lemma). We prove that
ϵ
\epsilon
-excellent sets exist for any
ϵ
>
1
2
\epsilon > \frac {1}{2}
in
k
k
-edge stable graphs in the sense of model theory (equivalently, Littlestone classes); earlier proofs had given this only for
ϵ
>
1
/
2
2
k
\epsilon > 1/{2^{2^k}}
or so. We give two proofs: the first uses regret bounds from online learning, the second uses Boolean closure properties of Littlestone classes and sampling. We also give a version of the dynamic Sauer-Shelah-Perles lemma appropriate to this setting, related to definability of types. We conclude by characterizing stable/Littlestone classes as those supporting a certain abstract notion of majority: the proof shows that the two distinct, natural notions of majority, arising from measure and from dimension, densely often coincide.