I don't know the specific compounds produced that are acrid, but I do know that maltsters rest their dark malts for 3-4 weeks, less for light malt.
The compounds produced are from Maillard reactions - the name for a whole series of reactions between amino acids and reducing sugars. Many of the reactions are still not fully understood - this page shows the initial reactions that can lead to the complex mixtures that form melanoidins, and this page shows one of the proposed pathways for melanoidin production.
Many other compounds are also produced in Maillard reactions
Other byproducts include aldehydes (furans, thiophenes,
polysulfides, thiols) which can contribute to the desired smells
(furfural which is an aromatic aldehyde has an almost almond smell),
Diacetyl (buttery flavor…also produced and consumed in the
fermentation process), acrylamide which is shown to be harmful, and
many more. Some of the byproducts, harmful and beneficial are
volatile and will evaporate during the process or upon the weeks of
rest the grains should undergo after roasting. One amino acid reacted
with Glucose or Fructose can be shown to produce over 20 different
aroma-active compounds and countless other volatile and non-volatile
compounds, malted barley has many hundreds of possible amino acids and
though maltose is the main reducing sugar there are many more
Acrylamide is formed by the Maillard reactions above 180C, 350F and is present in dark grains. It is carcinogenic in animals, and according to the article above, volatile, so a rest is necessary to reduce the levels of this compound in the grain.