# Margin and Shared Proxies: Advanced Proxy Anchor Loss for Out-of-Domain Intent Classification
## 3 Proposed Method
### Advanced Proxy-Anchor Loss
We divide each sample into intra-samples and inter-samples according to whether the sample exists inside each decision boundary in the embedding space. Figure 2 shows the process used to train inter-samples and intra-samples in our proposed method. First, since the positive intra-sample (\(d>0\) in Equation (4)) is already inside the decision boundary, it does not need to be moved further. In this case, the space in which OOD samples can exist is limited, as the distance between the margin proxy and samples has been made small but is still large enough to include the intra-sample. By contrast, the negative intra-sample (\(d>0\) in Equation (5)) is in the wrong location and should be moved outside the decision boundary. Thus, Advanced Proxy-Anchor loss makes the distance between the sample and the centroid proxy greater than the distance between the sample and margin proxy. We now describe the inter-sample case where each sample exists outside the positive or negative decision boundary. Since the positive inter-sample (\(d\leq 0\) in Equation (4)) is outside the decision boundary, it is desirable for the sample to move inside the positive decision boundary. Therefore, the distance between the sample and the centroid proxy should be closer than the distance between the sample and the margin proxy. In contrast, the negative inter-sample (\(d\leq 0\) in Equation (5)) already exists outside the decision boundary. In this case, we increase the distance between the sample and margin proxy to ensure that each decision boundary is distinct. If all the mentioned equations exist separately, the decision boundary becomes extremely large or small; thus, the OOD intent classification cannot be performed properly. However, in our method, since all equations are computed together, it is possible to obtain an appropriate decision boundary. As shown in the gray decision boundary in Figure 2b, the decision boundary of the shared proxy is positive for all samples, so it becomes large enough to include samples of all embedding spaces at the end of the training. As mentioned earlier, since all IND samples are in a multi-label state that is positive for each centroid proxy and shared proxy, the two decision boundaries overlap with each other. However, since the embedding vector of the OOD sample does not have the features of the IND intent, it exists outside the decision boundary of all IND proxies, and it is only located inside the decision boundary of the shared proxy or outside all decision boundaries. Since the embedding space is created as detailed above, our proposed method is effective in learning the discriminative features between IND intents and the OOD intent as well as distinguishing them in the embedding space. Figure 2: Figure showing the embedding space before and after training with Advanced Proxy-Anchor loss. Dashed arrows indicate the direction of each vector. In (**a**), in the light of the red intent class, the red star outside the decision boundary (positive inter-samples) moves to a location inside the red decision boundary, and the blue star inside the red decision boundary (negative intra-samples) move to the blue decision boundary. Moreover, the blue star outside the decision boundary (negative inter proxy) moves away from the red margin proxy. Finally, the red margin proxy is trained to reduce the distance to red stars (positive intra proxies) inside the red decision boundary. The shared proxy’s decision boundary grows to enclose all samples and serves to include OOD samples.After the previous training process, the vectors ultimately position themselves as shown in (**b**).