Freak, please understand that you are talking about two seperate things here. Running lean, (air:fuel ratio) and detonation. You list running lean as a cause of detonation, and it simply is not. While it can aggravate a detonating engine, it will not cause detonation. Alrthough, and obscure happening while running lean, it will heat the bike up, and perhaps increase slightly the chance of detonation, but the piston will likely melt and smear the exhaust port long before the signs of detonation show up. Now, causes of detonation are what you have written, too much advance, too much compression, both of which are related to not having enough octane to combat these things. They aren't necessarily bad on their own, but with not running the proper fuel, it will cause problems. Now, one other thing that will cause detonation, and not have anything related to octane would be an improper squish. Something that must be checked at engine assembly. Now, running lean will aggravate an already detonating engine, but like said, most likely will not cause detonation on it's own. If you blow a hole in the center of the piston, detonation, melt the exhaust side of the piston, and smear the cylinder wall with aluminum, lean condition. But, at any rate, if the plugs are backing out, you have other issues.