You save their randomly generated attributes and apply them when the companion is respawned.
When you spawn the companion, you know whether it needs to be generated from scratch or you’re recalling an existing one. Here you decide how it’s spawned from class - either allow for random generation or use a set of saved variables that define your character.
You need a save game if you need that companion to persists between game sessions. If it’s only for the duration of this one game, it’s enough to store the generated data in variables and feed them to the newly spawned companion.