Once you choose a path (specifically between transactional work and litigation), it can be difficult to veer off and would likely involve accepting cuts in your year level and salary.
You choose a direction and start to build your experience in that area. When is the proper time to further define your practice and move to specialize? There is no perfect, definitive moment for this, but rather a balance that you need to weigh within yourself. Ideally, the opportunity to specialize will come once you have had the opportunity to fully explore a variety of areas within your practice and one particular type of matter continues to peak your interest and enthusiasm. When you do this sort of work, you enjoy your day a little bit more. You look forward to handling these sorts of cases. You find the subject matter intriguing and would be happy (and not bored) handling these matters day-in and day-out.
In terms of your career track, I would suggest that the ideal time to specialize is around your 2nd or 3rd year as an associate. Essentially, the sooner you recognize that you want to focus on a certain area and begin courting the appropriate clients, the better for your career in the long-term.
Specializing is a terrific way to "make a name for yourself" and increase your future marketability to particular clients and potential future employers (whether other firms or in-house). You'll find that as you rise in seniority, clients and future employers generally prefer an expert in one field as opposed to a "jack of all trades."
As a second or third year, you should already be thinking about how to market yourself to clients and create relationships that will lead to business generation for your firm. By specializing, you focus in on your client base and can aim your business developing efforts toward this particular audience. As you grow into your specialty, it becomes more likely that you will be considered a "go to" person for that certain area. This absolutely increases your potential client base through repeat business, referrals, and reputation while elevating your value and clout within your firm. You potentially earn a higher degree of market visibility.
My single caveat to "the sooner the better" answer on this topic is that I caution any attorney starting their first year of practice in a group that is too highly specialized, unless this attorney is thoroughly confident that this is the area he/she wants to live. It can be extremely difficult to transition out of a niche practice area, especially without foundation of at least one year in a more general practice.
All of this considered, if you reach your third year and you do not have one particular area that you thoroughly enjoy, it may be best to stay within a general practice. Specialization is not something that should be forced or taken lightly. This decision will affect the remainder of your career, not only with respect to the type of work you will be doing, but the kinds of clients with which you'll be interfacing, opportunities for growth, prospects of lateraling in-house or to another firm, the type of firm or company that values you skill, as well as where you will be living physically.
Specializing is a great way to advance your career within the legal community. However, for genuine success, you need to love what you do. If you're not happy with your work, that will most definitely affect your future prosperity.