For me it was trial and error. I was told to start off using 1u : 10g for each meal. I worked out how much insulin that would be for my usual evening meal and pointed out that 1 : 10 would make me hypo, as I was already using 1 : 12 which gave good results. I was told that 1 : 10 was just a starting point and everyone was different.
If you find that 1u : 10g makes you high, 2 hours after eating, then you need more insulin. Try 1 : 9 or 1 : 8. I found a half unit pen helped, as increases/decreases of 1 unit was too much (I'm insulin sensitive) but many people are fine with 1 unit.