The contract sets the retainage rate and the release terms. The general contractor normally holds the same share from each subcontractor.
An early trade feels it most. A site work sub can finish in the first months. Its retainage may stay held until the whole building is done.
Retainage does not change your cost. It changes your cash flow. Read the supplementary conditions for the rate and for any reduction partway through the job.
Many states have laws on retainage. Check the bid documents and your state. Ask the GC about early release if your work finishes early.