Quadcopter stabilization algorithm

Be careful there is more than one version of the hardware.
Within each, there is more than one version of the firmware.
Look here under the Files tab:

Or Google kk board firmware v2.1?
I cannot see a reason to change the firmware that comes loaded when you buy it. But you can look at the code to learn how it works. Unless you want to download X configuration.