Denoising Cosine Similarity: A Theory-Driven Approach for Efficient Representation Learning