Obviously the amount of protein and carbohydrates in the diet are crucial while you're going in a deficit.
First of all, training with weights is going to decrease the catabolism in your muscle tissue ( catabolism is a wide concept, and always occur in your body in different contexts ).
This is due to the molecular axe Akt-mTORC1 and their downstreams. The anabolic nature of this axe will prevent you from loosing more lean tissue than you would if you didn't actually train while you are in a deficit.
This particular pathway is enhanced also by the pulsatile secretion of testosterone due to training, and so has a good protective effect.
You have to consider that this process is happening even while you are on a hypercaloric regimen and trying to bulk up. But in this particular scenario you're in its blunted depending on you dieting pattern.
I'll explain you how:
- Caloric deficit amplitude: If your caloric deficit is too high you will not replenish efficiently your muscle glycogen stores; this substrate is actually of prime need when you have to train and its the first choice of the muscle in caloric deficit. Only after a large part of your glycogen is replenished you will actually start build muscle tissue.
This is because of AMPK that is hierarchically higher than mTORC1. If AMPK senses that the energetic status of the muscle cell is too low, it will phosphorylate TSC2 ( another protein complex ) that will in sequence block mTORC1 from inducing its anabolic benefits.
- Macronutrients ratio: If you go really high on proteins ( thus amminoacids ) you will have ( expecially from leucine ) a positive stimulant effect on the axe Akt-mTOR, but take in consideration that this is hierarchially INFERIOR to the action of AMPK ( this has some biological fundation - a cell will never go through mitosis, even though its not the case of muscle cell, if energy levels are not high enough to support its course ). So you want to have a high carbs/protein:fats ratio. Never understimate the power of carbohydrates.
What you want to do is having the smaller deficit possible and recharge your glycogen stores on rest days ( you can do this by having a calorie/week deficit but eating more, and expecially carbs, on rest days ).
To answer your question: yes, you can and will lose muscle mass but the magnitude and the onset of this loss will depend by several factors you didnt even mention.
- How long you've been training
- How is your weekly calorie deficit
- What is the bodyfat you're aiming to
- How is your training ( very important )