smbakeresq
Explorer
I would suggest that the sword only levels up once certain important honorable goals have been completed. Maybe the sword has a mind of its own, and telepathically lets the wielder know what it wants to do. The DM can then decide which objectives are important enough for the sword to gain new power.
This way you can tie the mechanical side of the sword directly to role playing.
This works also. It could also level up when you kill a certain creature.
Another neat way is for the sword to be intelligent from the get go, but not have all its power available except for the voice inside the sword that constantly harangues the PC. A wise mentor doesn’t have to quiet or likeable. This helps because the sword can help the PC and group stay on the rails