  The goal of this work is to train effective representations for keyword
spotting via metric learning. Most existing works address keyword spotting as a
closed-set classification problem, where both target and non-target keywords
are predefined. Therefore, prevailing classifier-based keyword spotting systems
perform poorly on non-target sounds which are unseen during the training stage,
causing high false alarm rates in real-world scenarios. In reality, keyword
spotting is a detection problem where predefined target keywords are detected
from a variety of unknown sounds. This shares many similarities to metric
learning problems in that the unseen and unknown non-target sounds must be
clearly differentiated from the target keywords. However, a key difference is
that the target keywords are known and predefined. To this end, we propose a
new method based on metric learning that maximises the distance between target
and non-target keywords, but also learns per-class weights for target keywords
\`a la classification objectives. Experiments on the Google Speech Commands
dataset show that our method significantly reduces false alarms to unseen
non-target keywords, while maintaining the overall classification accuracy.
