These counterweights are found on all piston-driven steam locomotives (not just Soviet designs), and even a few types of diesel locomotive using connecting-rod drive. As other answers note, their purpose is to balance the weight and momentum of the connecting and drive rods, which would otherwise cause heavy vibration when running at speed, to the extent of lifting the wheels off the track.
Here's a diesel example; the weights are relatively small here, but they can be seen on all three wheels to the lower left of the axle. On this shunting locomotive, the traction motors are connected to the front and rear axles, while the centre axle is driven through the connecting rods which also prevent any single axle from slipping under load.
On this more elegant steam loco, designed for express passenger service, there are both strengthening webs on the crank side of the wheel, and balance counterweights on the opposite side. There's actually a second pair of cylinders between the frames, driving the leading axle, so the counterweighting is different for all three pair of driving wheels. Part of the counterweighting for the leading axle is built into the inner crank, rather than having it all on the wheels. Here you can also see that the carrying wheels on the leading bogie are not counterweighted, because they don't have any cranks.