As Castlehollow has advised have a look at pitching rate calculators like
Yeastcalc and
MrMalty.
The amount of yeast you should pitch is determined by volume and OG of the brew and the age of the yeast.
Broadly speaking a Wyeast pack or a Whitelabs vial will only have around 100bn cells which will likely be just about right for direct pitching into 2.5 gallons.
An 11gm pack of dry yeast on the other hand if properly rehydrated at pitching time will give you around 220bn cells and as such will suffice for most 5 gallon brews of low to average OG. In other words pitching half a pack of dry or a one full liquid pack/vial for most 2.5g batches will be fairly close to ideal in most cases.
One 11gm dry pack will usually be right for 5 gallons but the best approach if using liquid yeast is to make a starter to boost the population and also to confirm viability of the yeast.