It depends on what type of rattle you're hearing.
As suggested, you might be hearing a "detonation" rattle. This would normally occur under high load conditions, ie: when accelarating hard, or climbing a hill. If this is the case, then firstly try higher octane fuel. Detonation can put a hole in a piston pretty quickly.
Another possible option to check is the Cam Chain - if it is badly worn, it could be making noise. Check your chain tensioner and/or inspect the cam chain for wear.
Let us know what you find.