diff --git "a/data_all_eng_slimpj/shuffled/split2/finalzzkdwt" "b/data_all_eng_slimpj/shuffled/split2/finalzzkdwt" new file mode 100644--- /dev/null +++ "b/data_all_eng_slimpj/shuffled/split2/finalzzkdwt" @@ -0,0 +1,5 @@ +{"text":"\\subsection{WebNLG+ 2020}\n\\label{sec:webnlg_data}\nThe WebNLG+ corpus v3.0 is part of the 2020 WebNLG Challenge that offers two tasks: the generation of text from a set of RDF triples (subject-predicate-object), and the opposite task of semantic parsing for converting textual descriptions into sets of RDF triples. \nWe preprocess the data to remove any underscores and surrounding quotes, in order to reduce noise in the data. Moreover, due to a mismatch of T5 vocabulary and the WebNLG dataset, some characters in WebNLG are not present in T5 vocabulary and ignored during tokenization. We normalize the data mapping the missing characters to the closest available, e.g., `\\o' is converted to `o', or `\\~a' is mapped to `a'. \n\n\n\n\n\nTo prepare data for Grapher training, we split the triples into nodes (extracting subjects and objects) and edges (extracting predicates). The nodes are then either sequentially joined as $\\langle \\textsc{pad} \\rangle ~\\textsc{node}_1~ \\langle \\textsc{node\\_sep}\\rangle ~\\textsc{node}_2~ \\langle\/\\textsc{s}\\rangle$ for Text Nodes or passed separately as $\\langle \\textsc{pad} \\rangle ~\\textsc{node}_1~ \\langle\/\\textsc{s}\\rangle$, $\\langle \\textsc{pad} \\rangle ~\\textsc{node}_2~ \\langle\/\\textsc{s}\\rangle$ for Query Nodes, padding with $\\langle \\textsc{no\\_node}\\rangle$, if necessary. For edges, each element $i, j$ of the adjacency matrix is filled with $\\langle \\textsc{pad} \\rangle ~\\textsc{edge}_{i,j}~ \\langle\/\\textsc{s}\\rangle$ if there is an edge between $\\textsc{node}_i$ and $\\textsc{node}_j$ or with $\\langle \\textsc{pad} \\rangle ~\\textsc{no\\_edge}~ \\langle\/\\textsc{s}\\rangle$ otherwise. In case sparse edges are used, we first sparsify the adjacency matrix, and then flatten it to a sequence of edges, similar as for the nodes. Finally, for the classification edge head we scan the training set and collect all the unique predicates to be the edge class list. There are 407 edge classes in our train split, including the $\\langle \\textsc{no\\_edge}\\rangle$ class.\n\n\n\\subsection{\\tekgen}\n\\label{sec:tekgen_data}\n\n\\tekgen is a large-scale parallel text-graph dataset built by aligning Wikidata KG to Wikipedia text, and its statistics is shown in Table \\ref{tab:tekgen_stat}.\n\n\n\n\\begin{table}\n\\centering\n\\caption{Statistics of the \\tekgen dataset.}\n\\label{tab:tekgen_stat}\n\\begin{tabular}{llll}\n & Train & Dev & Test \\\\ \\hline\nOriginal & 6,383,051 & 797,881 & 797,882 \\\\ \\hline\nProcessed & 5,391,944 & 673,953 & 678,233 \\\\\n\\end{tabular}\n\\end{table}\n\n\n\n\\begin{table}\n\\centering\n\\caption{Statistics of the NYT dataset.}\n\\label{tab:nyt_stat}\n\\begin{tabular}{llll}\n & Train & Dev & Test \\\\ \\hline\nNormal & 46,409 & 4,150 & 4,021\n\\end{tabular}\n\\end{table}\n\nThe data was preprocessed by filtering out triples containing more than 7 predicates, with triple components longer than 100 characters, and with corresponding textual descriptions longer than 200 characters. This was done to match the settings of the WebNLG data and to reduce the computational complexity of the scoring. The final statistics of the dataset is shown in the second row of Table~\\ref{tab:tekgen_stat}. In total, the training set contains 1003 predicates\/graph edges, which is more than twice larger than in the WebNLG dataset. Note that to match the evaluation to the baseline \\cite{dognin2021regen}, and to further manage the limited computational resources, we limit the Test split to 50K sentence-triples pairs.\n\n\\subsection{NYT}\n\\label{sec:nyt_data}\nAs a third evaluation dataset, we selected the New York Times (NYT) corpus for our experiments, originally proposed by \\cite{riedel2010modeling}, consisting of 1.18M sentences. We used an adapted version of the dataset pre-processed by \\cite{zeng2018extracting}, referred as \"normal\", and contains the non-overlapping entities (i.e., head\/tail pair has only single edge connecting them), and 25 relation types (the smallest set as compared to WebNLG and \\tekgen). Table \\ref{tab:nyt_stat} shows the statistics of the dataset. \n\n\\subsection{Grapher Setup}\nFor our base pre-trained language model we used T5 ``large'', for a total number of 770M parameters, from HuggingFace, Inc \\cite{wolf2020transformers} (see Appendix for the results using other model sizes). For Query Node generation we also defined the learnable query embedding matrix $M \\in \\mathbb{R}^{H \\times N}$, where $H = 1024$ is the hidden size of T5 model, and $N = 8$ is the maximum possible number of nodes in a graph. The node generation head uses single-layer GRU decoder with $H_{\\textsc{GRU}}=1024$ followed by linear transformation projecting to the vocabulary of size $32,128$. The same GRU setup is used for the edge generation head, where we also set the maximum number of edges to be 7. Finally, for the edge classification head, we defined four fully-connected layers with ReLU non-linearities and dropouts with probability 0.5, projecting the output to the space of edge classes.\n\nDuring training we fine-tuned all the model's parameters, using the AdamW optimizer with learning rate of $10^{-4}$, and default values of $\\beta=[0.9, 0.999]$ and weight decay of $10^{-2}$. The batch size was set to 10 samples using a single NVIDIA A100 GPU for WebNLG and NYT training, while for \\tekgen training we employed distributed training over 10 A100 GPUs, thus making the effective batch size of 100. Under these settings, it takes approximately 3,500 steps to complete a training epoch for WebNLG, together with the validations done every 1,000 steps, we get a model that reaches its top performance in approximately 6-7 hours. For NYT, the epoch takes approximately 4,600 mini-batches, achieving top performance in about 15 epochs (24 hours). Finally, \\tekgen, each epoch takes approximately 54,000 steps, with the evaluations done every 1,000 steps we trained and validated the model for 150,000 iterations, taking approximately 14 days of compute time. \n\n\\subsection{Baselines}\n\nTo evaluate the performance of Grapher, for baselines we selected the top performing teams reported on the WebNLG 2020 Challenge Leaderboard, and briefly describe them here:\n\\textbf{Amazon AI (Shanghai)} \\cite{guo-etal-2020-2} was the Challenge winner for Text-to-RDF task. They followed a simple heuristic-based approach that first does entity linking to match the entities present in the input text with the DBpedia ontology, and then query the DBpedia database to extract the relation between them.\n\\textbf{BT5} \\cite{agarwal-etal-2020-machine} came in second place and used large pre-trained T5 model to generate KG in a linearized form, where the object-predicate-subject triples are concatenated together and the entire text-to-graph problem is viewed as a traditional sequence-to-sequence modeling.\n\\textbf{CycleGT} \\cite{Guo2020CycleGTUG}, third place contestant, followed an unsupervised method for text-to-graph and graph-to-text generation, where the KB construction part relies on off-the-shelf entity extractor to identify all the entities present in the input text, and a multi-label classifier to predict the relation between pairs of entities.\n\\textbf{Stanford CoreNLP Open IE} \\cite{manning-etal-2014-stanford}: This is an unsupervised approach that was run on the input text part of the test set to extract the subjects, relations, and objects to produce the output triplets to give a baseline performance for the WebNLG 2020 Challenge.\n\\textbf{ReGen} \\cite{dognin2021regen}: Recent work that leverages T5 pretrained language model and Reinforcement Learning (RL) for bidirectional text-to-graph and graph-to-text generation, which, similarly to \\citet{agarwal-etal-2020-machine}, also follows the linearized graph representation approach. \n\n\n\\begin{table}[t!]\n\\centering\n\\caption{Evaluation results on the test set of the WebNLG+ 2020 dataset. The top four block-rows are the results taken from the WebNLG 2020 Challenge Leaderboard \\cite{Ferreira2020The2B}. The bottom part shows the results of our proposed Grapher system for several architectural choices, as discussed in Section \\ref{sec:method}. Bold font shows the best performing systems.}\n\\label{tbl:webnlg}\n\\resizebox{0.48\\textwidth}{!}{\n\\begin{tabular}{ccclccc}\n\\multicolumn{1}{l}{} & \\multicolumn{1}{l}{} & \\multicolumn{1}{l}{} & \\textbf{M.} & \\multicolumn{1}{l}{\\textbf{F1}} & \\multicolumn{1}{l}{\\textbf{Prec.}} & \\multicolumn{1}{c}{\\textbf{Rec.}} \\\\ \\hline\n\\multicolumn{3}{l|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Amazon AI \\end{tabular}}} & \\multicolumn{1}{l|}{E} & 0.689 & 0.689 & 0.690 \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{P} & 0.696 & 0.696 & 0.698 \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{S} & 0.686 & 0.686 & 0.687 \\\\ \\hline\n\\multicolumn{3}{l|}{\\multirow{3}{*}{BT5 }} & \\multicolumn{1}{l|}{E} & 0.682 & 0.670 & 0.701 \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{P} & 0.713 & 0.700 & 0.736 \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{S} & 0.675 & 0.663 & 0.695 \\\\ \\hline\n\\multicolumn{3}{l|}{\\multirow{3}{*}{CycleGT }} & \\multicolumn{1}{l|}{E} & 0.342 & 0.338 & 0.349 \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{P} & 0.360 & 0.355 & 0.372 \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{S} & 0.309 & 0.306 & 0.315 \\\\ \\hline\n\\multicolumn{3}{l|}{\\multirow{3}{*}{Stanford OIE }} & \\multicolumn{1}{l|}{E} & 0.158 & 0.154 & 0.164 \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{P} & 0.200 & 0.194 & 0.211 \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{S} & 0.127 & 0.125 & 0.130 \\\\ \\hline\n\\multicolumn{3}{l|}{\\multirow{3}{*}{ReGen}} & \\multicolumn{1}{l|}{E} & \\textbf{0.723} & \\textbf{0.714} & \\textbf{0.738} \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{P} & \\textbf{0.767} & \\textbf{0.755} & \\textbf{0.788} \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{S} & \\textbf{0.720} & \\textbf{0.713} & \\textbf{0.735} \\\\ \\hline \\\\ \\hline\n\\multirow{12}{*}{\\begin{tabular}[c]{@{}c@{}}\\rotatebox{90}{\\textbf{Grapher}}\\end{tabular}} &\n \\multirow{6}{*}{\\begin{tabular}[c]{@{}c@{}}Query\\\\ Nodes\\end{tabular}} &\n \\multicolumn{1}{c|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Gen\\\\ Edges\\end{tabular}}} & \\multicolumn{1}{l|}{E} & 0.395 & 0.391 & 0.400 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{P} & 0.325 & 0.318 & 0.337 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{S} & 0.289 & 0.285 & 0.294 \\\\ \\cline{3-7} \n & & \\multicolumn{1}{c|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Class\\\\ Edges\\end{tabular}}}\n & \\multicolumn{1}{l|}{E} & 0.466 & 0.463 & 0.469 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{P} & 0.360 & 0.356 & 0.368 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{S} & 0.347 & 0.345 & 0.351 \\\\ \\cline{2-7} \n & \\multirow{6}{*}{\\begin{tabular}[c]{@{}c@{}}Text\\\\ Nodes\\end{tabular}} & \\multicolumn{1}{c|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Gen\\\\ Edges\\end{tabular}}} \n & \\multicolumn{1}{l|}{E} & 0.683 & 0.675 & 0.695 \\\\\n & & \\multicolumn{1}{l|}{} & \\multicolumn{1}{l|}{P} & 0.713 & 0.702 & 0.730 \\\\\n & & \\multicolumn{1}{l|}{} & \\multicolumn{1}{l|}{S} & 0.681 & 0.673 & 0.693 \\\\ \\cline{3-7} \n & & \\multicolumn{1}{c|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Class\\\\ Edges\\end{tabular}}} \n & \\multicolumn{1}{l|}{E} & \\textbf{0.722} & \\textbf{0.715} & \\textbf{0.733} \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{P} & \\textbf{0.750} & \\textbf{0.741} & \\textbf{0.765} \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{S} & \\textbf{0.719} & \\textbf{0.712} & \\textbf{0.730}\n\\end{tabular}\n}\n\\end{table}\n\n\n\\subsection{Evaluation Metrics}\nFor scoring the generated graph, we used the evaluation scripts from WebNLG 2020 Challenge \\cite{Ferreira2020The2B}, which computes the Precision, Recall, and F1 scores for the output triples against the ground truth. In particular, since the order of generated and ground truth triples should not influence the result, the script searches for the optimal\nalignment between each candidate and the reference triple through all possible permutation of the hypothesis-reference pairs. Then, the metrics based on Named Entity Evaluation \\cite{SeguraBedmar2013SemEval2013T9} were used to measure the Precision, Recall, and F1 score in four different ways. \\textbf{Exact}: The candidate triple should match exactly the reference triple, while the type (subject, predicate, object) is not important. \\textbf{Partial}: The candidate triple should match at least partially with the reference\ntriple, while the type (subject, predicate, object) is irrelevant. \\textbf{Strict}: The candidate triple matches exactly the reference triple, and the element type (subject, predicate, object) should match exactly as well. \n\n\\subsection{WebNLG Results}\n\n\nThe main results for evaluating all the compared methods on WebNLG test set are presented in Table~\\ref{tbl:webnlg}. As one can see, our Grapher system, based on Text Nodes and Class Edges, achieved on par top performance, as the ReGen \\cite{dognin2021regen} model. Our system also uses the Focal loss to account for edge imbalance during training. We can also see that Grapher based on Text Nodes, where the T5-based model generates the nodes directly as a string, outperforms the alternative approach that generates the nodes through query vectors and permutes the features to get invariance to node ordering. A possible explanations is that the graphs at hand and the training data are both quite small. Therefore, the representational power of T5, pre-trained on textual corpora several orders of magnitude larger, can handle the entity extraction task much better. As we mentioned earlier, the ability to extract the nodes is very crucial to the overall success of the system, so if the query-based node generation constructs less reliable sets of nodes, the follow-up stage of edge generation will underperform as well.\n\n\\begin{figure}[th!]\n\\centering\n\\includegraphics[width=0.48\\textwidth]{figs\/attention.pdf}\n\\caption{Visualization of the cross-attention weights in the T5 model between the node query embedding vectors and the embeddings of the input text.}\n\\label{fig:node_attention}\n\\end{figure}\n\n\nComparing the edge generation versus classification, we see that the former approach already brings up the system to the level of the top two leaderboard performers, while the edge classification adds extra accuracy and makes Grapher one of the leading system. This again might be due to a smaller training set, in which case GRU edge decoder underperforms, generating less accurate edges, while the classifier just needs to predict a single class to construct an edge, making it a better alternative in the low-data scenarios. \n\n\n\n\\begin{table}[t!]\n\\centering\n\\caption{Evaluation results on the test set of \\tekgen dataset for different configurations of the Grapher system. The use of text-based nodes with generation edges performs the best. }\n\\label{tab:tekgen}\n\\bgroup\n\\def\\arraystretch{1.0}%\n\\resizebox{0.48\\textwidth}{!}{\n\\begin{tabular}{ccccccc}\n\\multicolumn{1}{l}{} & \\multicolumn{1}{l}{} & \\multicolumn{1}{l}{} & \\textbf{M.} & \\multicolumn{1}{l}{\\textbf{F1}} & \\multicolumn{1}{l}{\\textbf{Prec.}} & \\multicolumn{1}{c}{\\textbf{Rec.}} \\\\ \\hline\n\\multicolumn{3}{l|}{\\multirow{1}{*}{ReGen }} & \\multicolumn{1}{l|}{E} & 0.623 & 0.610 & 0.647 \\\\ \\hline\n\\multirow{12}{*}{\\begin{tabular}[c]{@{}c@{}}\\rotatebox{90}{\\textbf{Grapher}}\\end{tabular}} &\n \\multirow{6}{*}{\\begin{tabular}[c]{@{}c@{}}Query\\\\ Nodes\\end{tabular}} &\n \\multicolumn{1}{c|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Gen\\\\ Edges\\end{tabular}}} & \\multicolumn{1}{l|}{E} & 0.386 & 0.361 & 0.430 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{P} & 0.438 & 0.405 & 0.496 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{S} & 0.386 & 0.361 & 0.430 \\\\ \\cline{3-7} \n & & \\multicolumn{1}{c|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Class\\\\ Edges\\end{tabular}}}\n & \\multicolumn{1}{l|}{E} & 0.361 & 0.338 & 0.401 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{P} & 0.408 & 0.378 & 0.463 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{S} & 0.360 & 0.337 & 0.401 \\\\ \\cline{2-7} \n & \\multirow{6}{*}{\\begin{tabular}[c]{@{}c@{}}Text\\\\ Nodes\\end{tabular}} & \\multicolumn{1}{l|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Gen\\\\ Edges\\end{tabular}}} \n & \\multicolumn{1}{l|}{E} & \\textbf{0.707} & \\textbf{0.693} & \\textbf{0.730}\\\\\n & & \\multicolumn{1}{l|}{} & \\multicolumn{1}{l|}{P} & \\textbf{0.741} & \\textbf{0.723} & \\textbf{0.771} \\\\\n & & \\multicolumn{1}{l|}{} & \\multicolumn{1}{l|}{S} & \\textbf{0.706} & \\textbf{0.692} & \\textbf{0.729}\\\\\\cline{3-7} \n & & \\multicolumn{1}{c|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Class\\\\ Edges\\end{tabular}}} \n & \\multicolumn{1}{l|}{E} & 0.700 & 0.686 & 0.722 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{P} & 0.735 & 0.717 & 0.764 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{S} & 0.700 & 0.685 & 0.721\n\\end{tabular}\n}\n\\egroup\n\\end{table}\n\n\nFinally, note that although the query-based node generation did not perform well in our evaluations, it is still informative to examine the behaviour of these vectors learned during the training. For this, we analyze the cross-attention weights in the T5 model between the node query vectors and the embeddings of the input text; the results are shown in Fig.~\\ref{fig:node_attention}. The ground truth nodes for this sentence are `Agra Airport', `India' and `T.S. Thakur'. It can be seen that each query vector focuses on a set of words that can potentially become a node. For example, the first query vector emphasizes the words `Agra', `Airport', `T.S.' and `Thakur', but since the weight on the first two words is higher, the resulting feature vector sent to the Node GRU module correctly decodes it as `Agra Airport'. The same process happens for the third and forth query vectors. It is also interesting to see that the rest of the queries were also correctly decoded as $\\langle \\textsc{no\\_node}\\rangle$ token, even though they had high attention weights on some of the words (e.g., weight of 0.2 on `Agra' and 0.18 on `India' for the second query vector). One potential explanation is that since no causal mask is used when feeding query vectors to the decoder, T5 has an opportunity to exchange the information between all of the query vectors across all the layers and heads. Thus, once the found nodes are assigned to specific vectors, the rest of them are suppressed and decoded into $\\langle \\textsc{no\\_node}\\rangle$, irrespective of the attention weights.\n\n\n\n\n\\subsubsection{\\tekgen Results}\n\n\nThe results on the test set of the \\tekgen dataset \\cite{agarwal2021knowledge} are shown in Table~\\ref{tab:tekgen}. To compute the graph generation performance, we use the same scoring functions as in WebNLG 2020 Challenge \\cite{Ferreira2020The2B}. As in Table~\\ref{tbl:webnlg}, in this experiment we observe a similar pattern in which the Grapher based on Text Nodes outperforms the query-based system. At the same time we see now that the GRU-based edge decoding performs better than the classification edge head. Recall that for the smaller-size WebNLG dataset the classification edge head performed better, while now on the larger-size \\tekgen dataset, the GRU edge generation is more accurate, outperforming the simpler classification edge head. Also, our Grapher model now outperforms the ReGen baseline from \\cite{dognin2021regen}, which is based on the linearization technique to represent the graph, showing advantage of the proposed multi-stage generation approach.\n\n\n\n\\subsubsection{NYT Results}\nFinally, Table \\ref{tab:nyt} shows the results on NYT dataset. Similar as for the \\tekgen, Grapher based on text nodes and generation edges performs the best, outperforming the other architectural choices and the baseline (note that this baseline is our own implementation similar to \\cite{dognin2021regen} and \\cite{agarwal-etal-2020-machine}, which uses T5 pre-trained language model on the linearized graph representation). Comparing with the results from Tables \\ref{tbl:webnlg} and \\ref{tab:tekgen}, we can see that for smaller datasets, the classification head has a clear advantage, while as more training data becomes available, the GRU edge decoder becomes more accurate, outperforming the classifier edge head. \n\n\\begin{table}[t!]\n\\centering\n\\caption{Evaluation results on the test set of NYT dataset for different configurations of the Grapher system. Text-based nodes with generation edges performs the best.}\n\\label{tab:nyt}\n\\bgroup\n\\def\\arraystretch{1.0}%\n\\resizebox{0.48\\textwidth}{!}{\n\\begin{tabular}{ccccccc}\n\\multicolumn{1}{l}{} & \\multicolumn{1}{l}{} & \\multicolumn{1}{l}{} & \\textbf{M.} & \\multicolumn{1}{l}{\\textbf{F1}} & \\multicolumn{1}{l}{\\textbf{Prec.}} & \\multicolumn{1}{l}{\\textbf{Rec.}} \\\\ \\hline\n\\multicolumn{3}{l|}{\\multirow{3}{*}{T5 + Linearized Graph}} & \\multicolumn{1}{l|}{E} & 0.832 & 0.831 & 0.834 \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{P} & 0.834 & 0.832 & 0.837 \\\\\n\\multicolumn{3}{c|}{} & \\multicolumn{1}{l|}{S} & 0.824 & 0.822 & 0.826 \\\\\n\\hline\n\\multirow{6}{*}{\\begin{tabular}[c]{@{}c@{}}\\rotatebox{90}{\\textbf{Grapher}}\\end{tabular}}\n & \\multirow{6}{*}{\\begin{tabular}[c]{@{}c@{}}Text\\\\ Nodes\\end{tabular}} \n & \\multicolumn{1}{c|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Gen\\\\ Edges\\end{tabular}}} \n & \\multicolumn{1}{l|}{E} & \\textbf{0.918} & \\textbf{0.917} & \\textbf{0.920} \\\\\n & & \\multicolumn{1}{l|}{} & \\multicolumn{1}{l|}{P} & \\textbf{0.919} & \\textbf{0.918} & \\textbf{0.921} \\\\\n & & \\multicolumn{1}{l|}{} & \\multicolumn{1}{l|}{S} & \\textbf{0.913} & \\textbf{0.911} & \\textbf{0.914} \\\\ \\cline{3-7} \n & & \\multicolumn{1}{c|}{\\multirow{3}{*}{\\begin{tabular}[c]{@{}c@{}}Class\\\\ Edges\\end{tabular}}} \n & \\multicolumn{1}{l|}{E} & 0.870 & 0.867 & 0.872 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{P} & 0.871 & 0.869 & 0.874 \\\\\n & & \\multicolumn{1}{c|}{} & \\multicolumn{1}{l|}{S} & 0.860 & 0.858 & 0.862\n\\end{tabular}\n}\n\\egroup\n\\end{table}\n\n\n\n\\section{Introduction}\n\\label{sec:introduction}\n\\input{introduction}\n\n\\section{Method}\n\\label{sec:method}\n\\input{Method}\n\n\\section{Data}\n\\label{sec:data}\n\\input{data}\n\n\\section{Experiments}\n\\label{sec:experiments}\n\\input{experiments}\n\n\n\\section{Conclusion}\nIn this work, we proposed Grapher, a novel multi-stage KG generation system, that separates the overall graph generation into two steps. In the first step, the nodes are generated from the input text using a pretrained language model. The resulting node features are then used for edge generation to construct the output graph. We proposed several architectural choices for each stage. In particular, graph nodes can either be generated as a sequence of text tokens or as a set of query-based feature vectors decoded into tokens through generation head (e.g., GRU). Edges can be either generated by a GRU decoding head or selected by a classification head. We also addressed the problem of skewed edge distribution, where the token\/class corresponding to the missing edge is over-represented, leading to inefficient training. For this, we proposed to use of either the focal loss, or the sparse adjacency matrix. The experimental evaluations showed that Grapher matched state-of-the-art performance on smaller WebNLG dataset, and showed strong overall performance, outperforming existing baselines, on NYT and \\tekgen datasets, serving as a viable alternative to the existing baselines. \n\n\\section*{Limitations}\nThere are several limitations of this work that need to be addressed in the future work. The first is the computational complexity of edge generation, which is quadratic in the number of edges, and this sets the limit on the sizes of the graphs that the systems can process. Moreover, since the nodes are generated using transformer-based models, which have quadratic complexity of the attention mechanism, there is a limit on the size of the input text the system can handle. Therefore, the current algorithm is suitable for small or medium size graphs and text passages. The extension to large scale is important and will be a part of the future effort. Moreover, the current setup was applied only to English domain datasets, which is a limitation, given that there is a benefit of multi- and cross-lingual training of language systems as ours. Finally, although not being our objective, the current model is designed to handle only the direction from text to knowledge graph, and the reverse direction has not been explored yet but can be a part of the future investigation. \n\n\n\n\\subsection{Node Generation: Text Nodes}\n\\label{sec:node_gen}\n\nGiven text input, the objective of this module is to generate a set of unique nodes, which define the foundation of the graph. As we mentioned in Section \\ref{sec:introduction}, the node generation is key to the successful operation of Grapher, therefore for this task we use a pre-trained encoder-decoder language model (PLM), such as T5. Using a PLM, we can now formulate the node generation as a sequence-to-sequence problem, where the system is fine-tuned to translate textual input to a sequence of nodes, separated with special tokens, \n$\\langle \\textsc{pad} \\rangle ~\\textsc{node}_1~ \\langle \\textsc{node\\_sep}\\rangle ~\\textsc{node}_2~ \\cdots \\langle \/\\textsc{s}\\rangle$, where $\\textsc{node}_i$ represents one or more words.\n\n\\begin{figure}[th!]\n\\begin{minipage}[b]{0.48\\textwidth}\n\\centering\n\\includegraphics[width=0.85\\textwidth]{figs\/text_nodes.pdf}\n\\caption{Node generation using traditional sequence-to-sequence paradigm based on T5 language model, where the input text is transformed into a sequence of text entities. The features corresponding to each entity (node) is extracted and sent to the edge generation module.}\n\\label{fig:text_nodes}\n\\end{minipage}\n\\hspace{0.5em}\n\\begin{minipage}[b]{0.48\\textwidth}\n\\centering\n\\includegraphics[width=0.99\\textwidth]{figs\/query_nodes.pdf}\n\\caption{Node generation using learned query vectors. Here the input text and the query vectors (in the form of embedding matrix) is transformed into node features. Those are then decoded into graph nodes using node generation head (e.g, LSTM or GRU). The same features are also sent to the edge construction module.}\n\\label{fig:query_nodes}\n\\end{minipage}\n\\end{figure}\n\n\nAs seen in Fig.~\\ref{fig:text_nodes}, in addition to node generation, this module supplies node features for the downstream task of edge generation. Since each node can have multiple associated words, we greedy-decode the generated string and utilize the separation tokens $\\langle \\textsc{node\\_sep}\\rangle$ to delineate the node boundaries and mean-pool the hidden states of the decoder's last layer. Note that in practice we fix upfront the number of generated nodes and fill the missing ones with a special $\\langle \\textsc{no\\_node}\\rangle$ token.\n\n\\subsection{Node Generation: Query Nodes}\n\\label{sec:query_nodes}\n\nOne issue with the above approach is ignoring that the graph nodes are permutation invariant, since any permutation of the given set of nodes should be treated equivalently. To address this limitation, we propose a second architecture, inspired by DETR \\cite{Carion2020EndtoEndOD}. See Fig.~\\ref{fig:query_nodes} for an illustration\n\n\\textit{Learnable Node Queries} The decoder receives as input a set of learnable node queries, represented as an embedding matrix. We also disable causal masking, to ensure that the Transformer is able to attend to all the queries simultaneously. This is in contrast to the traditional encoder-decoder architecture that usually gets as an input embedding of the target sequence with the causal masking during training or the embedding of the self-generated sequence during inference. The output of the decoder can now be directly read-off as $N$ (number of nodes) $d$-dimensional node features $F_n \\in \\mathbb{R}^{d\\times N}$ and passed to a prediction head (LSTM or GRU) to be decoded into node logits $L_n \\in \\mathbb{R}^{S\\times V\\times N}$, where $S$ is the generated node sequence length and $V$ is the vocabulary size. \n\n\\textit{Permutation Matrix} To avoid the system to memorize the particular target node order and enable permutation-invariance, the logits and features are permuted as\n\\begin{align}\n L_n^\\prime(s) = L_n(s)P, ~~F_n^\\prime = F_nP,\n\\end{align}\nfor $s = 1,\\ldots,S$ and where $P \\in \\mathbb{R}^{N \\times N}$ is a permutation matrix obtained using bipartite matching algorithm between the target and the greedy-decoded nodes. We used cross-entropy loss as the matching cost function. The permuted node features $F_n^\\prime$ are now target-aligned and can be used in the edge generation stage. \n\n\\subsection{Edge Generation}\n\\label{sec:edge_gen}\n\n\nThe generated set of node features from previous step is then used in this module for the edge generation. Fig.~\\ref{fig:edges_full} shows a schematic description of this step.\nGiven a pair of node features, a prediction head decides the existence (or not) of an edge between their respective nodes.\nOne option is to use a head similar to the one in Section \\ref{sec:query_nodes} (LSTM or GRU) to generate edges as a sequence of tokens. The other option is to use a classification head to predict the edges. The two choices have their own pros and cons and the selection depends on the application domain. The advantage of generation is the ability to construct \\emph{any} edge sequence, including ones unseen during training, at the risk of not matching the target edge token sequence exactly. On the other hand, if the set of possible relationships is fixed and known, the classification head is more efficient and accurate, however if the training has limited coverage of all possible edges, the system can misclassify during inference. We explore both options in Section \\ref{sec:experiments}.\n\n\n\\begin{figure}[th!]\n\\begin{minipage}[b]{0.48\\textwidth}\n\\centering\n\\includegraphics[width=0.99\\textwidth]{figs\/edges_full.pdf}\n\\caption{Edge construction, using generation (e.g., GRU) or a classifier head. Blue circles represent the features corresponding to the actual graph edges (solid lines) and the white circles are the features that are decoded into $\\langle \\textsc{no\\_edge}\\rangle$ (dashed line).}\n\\label{fig:edges_full}\n\\end{minipage}\n\\hspace{0.5em}\n\\begin{minipage}[b]{0.48\\textwidth}\n\\centering\n\\includegraphics[width=0.99\\textwidth]{figs\/edges_sparse.pdf}\n\\caption{Edge generation with sparse adjacency matrix, using same decoder heads as in Fig.~\\ref{fig:edges_full}. Here while keeping all the actual edges, we remove most of the $\\langle \\textsc{no\\_edge}\\rangle$ tokens, leaving only a few. This setup is only used during training to improve the edge imbalance problem and speedup the training.}\n\\label{fig:edges_sparse}\n\\end{minipage}\n\\end{figure}\n\nNote that since in general KGs are represented as directed graphs, it is important to ensure the correct order (subject-object) between two nodes. For this, we propose to use a simple difference between the feature vectors: $F_n^{\\prime}(:,i)- F_n^{\\prime}(:,j)$ for the case when the node $i$ is a parent of node $j$. We experimented with other options, including concatenation and adding position information but found the difference being the most effective, since the model learns that $F_n^{\\prime}(:,i)- F_n^{\\prime}(:,j)$ implies $i\\rightarrow j$, while $F_n^{\\prime}(:,j)- F_n^{\\prime}(:,i)$ implies $j\\rightarrow i$.\n\n\\subsection{Imbalanced Edge Distribution}\n\\label{sec:edge_imb}\n\nObserve that since we need to check the presence of edges between all pairs of nodes, we have to generate or predict up to $N^2$ edges, where $N$ is the number of nodes. There are small savings that can be done by ignoring self-edges as well as ignoring edges when one of the generated nodes is the $\\langle \\textsc{no\\_node}\\rangle$ token. When no edge is present between the two nodes, we denote this with a special token $\\langle \\textsc{no\\_edge}\\rangle$. Moreover, since in general the number of actual edges is small and $\\langle \\textsc{no\\_edge}\\rangle$ is large, the generation and classification task is imbalanced towards the $\\langle \\textsc{no\\_edge}\\rangle$ token\/class. To remedy this, we propose two solutions: one is a modification of the cross-entropy loss, and the other is a change in the training paradigm.\n\n\\textbf{Focal Loss} Here we replace the traditional Cross-Entropy (CE) loss with Focal (F) loss \\cite{Lin2020FocalLF}, whose main idea is down-weight the CE loss for well-classified samples ($\\langle \\textsc{no\\_edge}\\rangle$) and increase the CE loss for mis-classified ones, as illustrated below for a probability $p$ corresponding to a single edge and $t$ is a target class: \n\\begin{align*}\n \\text{CE} = \\scalebox{0.75}[1.0]{$-$}\\log(p_t), ~\\text{F} = \\scalebox{0.75}[1.0]{$-$}(1\\scalebox{0.75}[1.0]{$-$} p_t)^\\gamma\\log(p_t),\n\\label{eq:focal} \n\\end{align*}\nwhere $\\gamma \\geq 0$ is a weighting factor, such that $\\gamma = 0$ makes both losses equivalent. The application of this loss to the classification head is straightforward while for the generation head we modify it by first accumulating predicted probabilities over the edge sequence length to get the equivalent of $p_t$ and then apply the loss. In practice, we observed that Focal loss improved the accuracy for the classification head, while for the generation head the performance did not change significantly. \n\n\n\n\\textbf{Sparse Edges} To address the edge imbalance problem another solution is to modify the training settings by sparsifying the adjacency matrix to remove most of the $\\langle \\textsc{no\\_edge}\\rangle$ edges as shown in Fig.~\\ref{fig:edges_sparse}, therefore re-balancing the classes artificially. Here, we keep all the actual edges but then leave only a few randomly selected $\\langle \\textsc{no\\_edge}\\rangle$ ones. Note that this modification is done only to improve efficiency of the training, during inference the system still needs to output all the edges, as in Fig.~\\ref{fig:edges_full}, since their true location is unknown. In practice, besides seeing 10-20\\% improvement in accuracy, we also observed about 10\\% faster training time when using sparse edges as compared to using full adjacency matrix.","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\n\nAfter the spectacular discovery of a signal in the Higgs-boson searches\nat the LHC by ATLAS and CMS~\\cite{ATLASdiscovery,CMSdiscovery}, the\nexploration of the properties of the observed particle is meanwhile in\nfull swing. In particular, the observation in the $\\gamma \\gamma$ and the\n$ZZ^{(*)} \\to 4 \\ell$ channels made it possible to determine its mass\nwith already a remarkable precision. Currently, the combined mass\nmeasurement from ATLAS is\n$125.5 \\pm 0.2 \\pm 0.6 \\,\\, \\mathrm{GeV}$~\\cite{ATLAS:2013mma}, and the one\nfrom CMS is $125.7 \\pm 0.3 \\pm 0.3 \\,\\, \\mathrm{GeV}$~\\cite{CMS:yva}. The other\nproperties that have been determined so far (with significantly lower\naccuracy) are compatible with the minimal realisation of the Higgs\nsector within the Standard Model (SM)~\\cite{HiggsSMlike}, \nbut a large variety of other\ninterpretations is possible as well, corresponding to very different\nunderlying physics. While within the SM the Higgs-boson mass\nis just a free parameter,\nin theories beyond the SM (BSM) the mass of the particle that is\nidentified \nwith the signal at about $126 \\,\\, \\mathrm{GeV}$ can often be directly predicted,\nproviding an important test of the model. The most popular BSM model\nis the Minimal Supersymmetric\nStandard Model (MSSM)~\\cite{mssm}, whose Higgs sector consists of two\nscalar doublets accommodating five physical Higgs bosons. In\nlowest order these are the light and heavy ${\\cal CP}$-even $h$\nand $H$, the ${\\cal CP}$-odd $A$, and the charged Higgs bosons $H^\\pm$.\n\n\nThe parameters characterising the MSSM Higgs sector at lowest order \nare the gauge couplings, the mass of the ${\\cal CP}$-odd Higgs boson,\n$M_A$, and $\\tan \\beta \\equiv v_2\/v_1$, \nthe ratio of the two vacuum expectation values. Accordingly, \nall other masses and mixing angles can be predicted in terms of those\nparameters, leading to the famous\ntree-level upper bound for the mass of the light ${\\cal CP}$-even Higgs boson, \n$M_h \\le M_Z$, determined by the mass $M_Z$ of the $Z$~boson.\nThis tree-level upper bound, which arises from the gauge sector,\nreceives large corrections from the Yukawa sector of the theory, which\ncan amount up to \\order{50\\%} (depending on the model\nparameters) upon incorporating the full one-loop and the dominant\ntwo-loop contributions~\\cite{mhiggsAEC}.\nThe prediction for the light ${\\cal CP}$-even Higgs-boson mass in the MSSM is\naffected by two kinds of theoretical uncertainties, namely \nparametric uncertainties induced by\nthe experimental errors of the input parameters, and intrinsic\ntheoretical uncertainties that are due to unknown higher-order\ncorrections. Concerning the SM input parameters, the dominant source of\nparametric uncertainty is the experimental error on the top-quark mass,\n$m_t$. Very roughly, the impact of the experimental error on $m_t$ on\nthe prediction for $M_h$ scales like\n$\\deM_h^{{\\rm para,}m_t}\/\\dem_t^{\\rm exp} \\sim 1$~\\cite{deltamtILC}. \nAs a consequence, high-precision top-physics providing an accuracy on\n$m_t$ much below the GeV-level is a crucial ingredient for precision\nphysics in the Higgs sector~\\cite{deltamtILC}. \nConcerning the intrinsic theoretical uncertainties caused by unknown \nhigher-order corrections, an overall estimate of \n$\\deM_h^{\\rm intr} \\sim 3 \\,\\, \\mathrm{GeV}$ \nhas been given in \\citeres{mhiggsAEC,PomssmRep} (the more recent\ninclusion of the leading \\order{\\alpha_t\\alpha_s^2} 3-loop\ncorrections~\\cite{mhiggsFD3l} has slightly reduced this estimated\nuncertainty by few \\order{100 \\,\\, \\mathrm{MeV}}), while it was pointed out\nthat a more detailed estimate needs to take into account the dependence\non the considered parameter region of the model. In particular, the\nuncertainty of this fixed-order prediction is expected to be much larger \nfor scalar top masses in the multi-TeV range. This region of the\nparameter space has received considerable attention recently, partly\nbecause of the relatively high value of $M_h \\approx 126\\,\\, \\mathrm{GeV}$, which\ngenerically requires either large stop masses or large mixing in the\nscalar top sector, and partly because of the limits from searches for \nsupersymmetric (SUSY) particles at the LHC.\nWhile within the general MSSM the lighter scalar \nsuperpartner of the top quark is allowed to be relatively light (down to\nvalues even as low as $m_t$), both with respect to the direct searches \nand with respect to the prediction for $M_h$ (see\ne.g.\\ \\citere{Mh125}), the situation is different in more constrained\nmodels. For instance, global fits in the Constrained MSSM (CMSSM) prefer\nscalar top masses in the multi-TeV range~\\cite{mc8,fittino}. \n\nHere we present a significantly improved prediction for the\nmass of the light ${\\cal CP}$-even Higgs boson in the MSSM, which is expected\nto have an important impact on the phenomenology in the\nregion of large squark masses and on its confrontation \nwith the experimental results.\n\n\n\n\n\\section{Improved prediction for $\\bm{M_h}$}\n\nIn the MSSM with real parameters (we restrict to this case for\nsimplicity; for the treatment of complex parameters see\n \\citeres{mhcMSSMlong,mhcMSSM2L} and references therein),\nusing the Feynman diagrammatic (FD) approach,\n the higher-order corrected \n${\\cal CP}$-even Higgs boson masses are derived by finding the\npoles of the $(h,H)$-propagator \nmatrix. The inverse of this matrix is given by $-i \\times$\n\\begin{align}\n\\left( \\begin{array}{cc} p^2 - m_{h, {\\rm tr}}^2 + \\hat{\\Sigma}_{hh}(p^2) & \\hat{\\Sigma}_{hH}(p^2) \\\\\n \\hat{\\Sigma}_{hH}(p^2) & p^2 - m_{H, {\\rm tr}}^2 + \\hat{\\Sigma}_{HH}(p^2) \\end{array} \\right),\n\\label{higgsmassmatrixnondiag}\n\\end{align}\nwhere $m_{h,H, {\\rm tr}}$ denote the \ntree-level masses, \nand $\\hat{\\Sigma}_{hh,HH,hH}(p^2)$ are the renormalized Higgs boson\nself-energies evaluated at the squared external momentum~$p^2$\n(for the computation of the leading contributions to those\nself-energies it is convenient to use the basis of the fields $\\phi_1$,\n$\\phi_2$, which are related to $h$, $H$ via the (tree-level)\nmixing angle $\\alpha$: \n$h = - \\sin\\alpha \\, \\phi_1 + \\cos\\alpha \\, \\phi_2$, \n$H = \\cos\\alpha \\, \\phi_1 + \\sin\\alpha \\, \\phi_2$).\nThe status of higher-order corrections to these self-energies\nis quite advanced. The complete one-loop\nresult within the MSSM is known~\\cite{ERZ,mhiggsf1l}.\nThe by far dominant one-loop contribution is the \\order{\\alpha_t} term due\nto top and stop loops ($\\alpha_t \\equiv h_t^2 \/ (4 \\pi)$, $h_t$ being the\ntop-quark Yukawa coupling). The computation of the two-loop corrections\nhas meanwhile reached a stage where all the presumably (sub)dominant\ncontributions are available, see \\citere{mhiggsAEC} and references therein.\nThe public code {\\tt FeynHiggs}~\\cite{feynhiggs,mhiggslong,mhiggsAEC,mhcMSSMlong} \nincludes all of the above corrections, where the on-shell (OS) scheme for the\nrenormalization of the scalar quark sector has been used (another\npublic code, based on the Renormalization Group (RG) improved\nEffective Potential, is {\\tt CPsuperH}~\\cite{cpsh}).\nA full 2-loop effective potential calculation %\n(supplemented by the momentum dependence for the leading\npieces and the leading 3-loop corrections) has been\npublished~\\cite{mhiggsEP5}. However, no computer code \nis publicly available. Most recently another leading 3-loop\ncalculation at \\order{\\alpha_t\\alpha_s^2} became available (based on a\n\\ensuremath{\\overline{\\mathrm{DR}}}\\ or a ``hybrid'' renormalisation scheme for the scalar top\nsector), where the numerical\nevaluation depends on the various SUSY mass hierarchies~\\cite{mhiggsFD3l}, \nresulting in the code {\\tt H3m} (which\nadds the 3-loop corrections to the {\\tt FeynHiggs}\\ result).\n\n\\smallskip\nWe report here on an improved prediction for $M_h$ where we combine the\nfixed-order result obtained in the OS scheme with an all-order\nresummation of the leading and subleading contributions from the scalar\ntop sector. We have obtained the latter from an analysis of the \nRG Equations (RGEs) at the two-loop level~\\cite{SM2LRGE}.\nAssuming a common mass scale $\\ensuremath{M_S} = \\sqrt{m_{\\tilde{t}_1}\\,m_{\\tilde{t}_2}}$ \n($m_{{\\tilde t}_{1,2}}$ denote the two scalar top masses, and $\\ensuremath{M_S} \\gg M_Z$)\nfor all relevant SUSY mass parameters,\nthe quartic Higgs coupling $\\lambda$ can be evolved\nvia SM RGEs from \\ensuremath{M_S}\\ to the scale $Q$ \n(we choose $Q = m_t$ in the following)\nwhere $M_h^2$ is to be evaluated\n(see, for instance, \\citere{mhiggsBSE} and references therein),\n\\begin{align}\nM_h^2 = 2 \\lambda(m_t) v^2~.\n\\label{Mh2RGE}\n\\end{align}\nHere $v \\sim 174 \\,\\, \\mathrm{GeV}$ denotes the vacuum expectation value of the SM. \nThree coupled RGEs are relevant for this evolution, the ones for\n$\\lambda$, $h_t$\nand $g_s$ (the strong coupling constant, $\\alpha_s = g_s^2\/(4\\,\\pi)$). \nSince SM RGEs are used, the relevant parameters are given in the\n\\ensuremath{\\overline{\\mathrm{MS}}}\\ scheme.\nWe incorporate the one-loop threshold corrections to\n$\\lambda(\\ensuremath{M_S})$ as given in \\citere{mhiggsBSE}, with\n$x_t = X_t\/\\ensuremath{M_S}$, $h_t=h_t(M_S)$,\n\\begin{align}\n\\lambda(\\ensuremath{M_S}) = (3\\,h_t^4)\/(8\\,\\pi^2) x_t^2 \\left[ 1 - 1\/12\\, x_t^2 \\right]~, \n\\label{threshold}\n\\end{align}\nwhere as mentioned above $X_t$ is an \\ensuremath{\\overline{\\mathrm{MS}}}\\ parameter. \n\\refeq{threshold} ensures that \\refeq{Mh2RGE} consists of the ``pure loop\n correction'' that will be denoted $(\\DeM_h^2)^{\\rm RGE}$ below.\nUsing RGEs at two-loop order~\\cite{SM2LRGE}, \nincluding fermionic contributions from the top sector only, \nleads to a prediction for the corrections to $M_h^2$ including \nleading and subleading logarithmic contributions $L^n$ and $L^{(n-1)}$\nat $n$-loop order ($L \\equiv \\ln(\\ensuremath{M_S}\/m_t)$),\noriginating from the top\/stop sector of the MSSM.\nWe have obtained both analytic solutions of the RGEs up to the $7$-loop\nlevel as well as a numerical solution incorporating the leading and\nsubleading logarithmic contributions up to all orders.\nIn a similar way in \\citere{mhiggsRGE3l} the leading logarithms at\n3- and 4-loop order have been evaluated analytically.\n\n\n\\smallskip\nConcerning the combination of the higher-order logarithmic contributions\nobtained from solving the RGEs with the \nfixed-order FD result implemented in {\\tt FeynHiggs}\\ comprising corrections up to the\ntwo-loop level in the OS scheme, we have used the parametrisation of the\nFD result in terms of the running top-quark mass at the scale $m_t$, \n$\\overline{m_t} =\nm_t^{\\rm pole}\/(1 + 4\/(3 \\pi) \\alpha_s(m_t^{\\rm pole}) \n-1\/(2 \\pi) \\alpha_t(m_t^{\\rm pole}))$, \nwhere $m_t^{\\rm pole}$ denotes the top-quark pole mass. \nAvoiding double counting of the logarithmic contributions up to the\ntwo-loop level and consistently taking into account the different\nschemes employed in the FD and the RGE approach, the correction\n$\\DeM_h^2$ takes the form\n\\begin{align}\n\\DeM_h^2 &= (\\DeM_h^2)^{\\rm RGE}(X_t^{\\ensuremath{\\overline{\\mathrm{MS}}}}) \n - (\\DeM_h^2)^{\\rm FD, LL1,LL2}(X_t^{\\mathrm{OS}}) \\nonumber \\\\\nM_h^2 &= (M_h^2)^{\\rm FD} + \\DeM_h^2~.\n\\label{eq:combcorr}\n\\end{align} \nHere $(M_h^2)^{\\rm FD}$ denotes the fixed-order FD result,\n$(\\DeM_h^2)^{\\rm FD, LL1, LL2}$ are the logarithmic contributions up to\nthe two-loop level obtained with the FD approach in the OS scheme, while \n$(\\DeM_h^2)^{\\rm RGE}$ are the leading and sub-leading logarithmic\ncontributions (either up to a certain loop order or summed to all\norders) obtained in the RGE approach, as evaluated via \\refeq{Mh2RGE}. \nIn all terms of\n\\refeq{eq:combcorr} the top-quark mass is parametrised in terms of\n$\\overline{m_t}$;\nthe relation between $X_t^{\\ensuremath{\\overline{\\mathrm{MS}}}}$ and $X_t^{\\mathrm{OS}}$ is given by\n\\begin{align}\nX_t^{\\ensuremath{\\overline{\\mathrm{MS}}}} = X_t^{\\mathrm{OS}} \\left[1 + \n2 L\n\\left(\\alpha_s\/\\pi - (3 \\alpha_t)\/(16\\pi)\\right)\\right]\n\\end{align}\nup to non-logarithmic terms, and there are no logarithmic contributions \nin the relation between $\\ensuremath{M_S}^{\\ensuremath{\\overline{\\mathrm{MS}}}}$ and $\\ensuremath{M_S}^{\\mathrm{OS}}$. \n\nSince the higher-order corrections beyond 2-loop order\nhave been derived under the assumption\n$M_A \\gg M_Z$, to a good approximation these corrections\ncan be incorporated \nas a shift in the prediction for the $\\phi_2\\phi_2$ self-energy \n(where $\\DeM_h^2$ \nenters with a coefficient $1\/\\sin^2\\!\\beta$). In this way\nthe new higher-order contributions enter not only the prediction for\n$M_h$, but also all other Higgs sector observables that are evaluated in \n{\\tt FeynHiggs}. The latest version of the code, {\\tt FeynHiggs}\\,{\\tt 2.10.0}, which is\navailable at {\\tt feynhiggs.de}, contains those improved\npredictions as well as a refined estimate of the theoretical\nuncertainties from unknown higher-order corrections. Taking into account\nthe leading and subleading logarithmic contributions in higher orders\nreduces the uncertainty of the remaining unknown higher-order\ncorrections. Accordingly, the estimate of the uncertainties arising from\ncorrections beyond two-loop order in the top\/stop sector is adjusted\nsuch that the impact of replacing the running top-quark mass by the pole\nmass (see \\citere{mhiggsAEC}) is evaluated only for the non-logarithmic\ncorrections rather than for the full two-loop contributions implemented\nin {\\tt FeynHiggs}.\nFurther refinements of the RGE resummed result are possible, in\nparticular extending the result to the case of a large\nsplitting between the left- and right-handed soft\nSUSY-breaking terms in the scalar top sector~\\cite{mhiggsRGEsplitLR} and\nto the region of small values of $M_A$ (close to $M_Z$) as well as including\nthe corresponding contributions from the (s)bottom sector. We leave\nthose refinements for future work.\n\n\n\n\n\\vspace*{-1ex}\n\n\\section{Numerical analysis}\n\n\n\\begin{figure}[htb!]\n\\includegraphics[width=0.385\\textwidth,height=5cm]{Mh-logresum-11-Mstop}\\\\\n\\includegraphics[width=0.385\\textwidth,height=5cm]{Mh-logresum-15-Mstop}\n\\caption{\nUpper plot: $M_h$ as a function of $\\ensuremath{M_S}$ for $X_t = 0$ (solid) and \n$X_t\/\\ensuremath{M_S} = 2$ (dashed). The full result (``LL+NLL'') is compared with\nresults containing the logarithmic contributions up to the 3-loop,\n\\ldots 7-loop level and with\nthe fixed-order FD result (``FH295'').\nLower plot: comparison of {\\tt FeynHiggs}\\ (red) with {\\tt H3m} (blue). \nIn green we show the {\\tt FeynHiggs}\\ 3-loop result at \\order{\\alpha_t\\alpha_s^2} (full) as\ndashed (solid) line.\n}\n\\label{fig:plots}\n\\end{figure}\n\nIn this section we briefly analyze the phenomenological implications of\nthe improved $M_h$ prediction for large stop mass scales, as\nevaluated\nwith {\\tt FeynHiggs}\\,{\\tt 2.10.0}.\nThe upper plot of \\reffi{fig:plots} shows $M_h$ as a function of \n$\\ensuremath{M_S}$ for $X_t = 0$ and $X_t\/\\ensuremath{M_S} = 2$ (which corresponds to the minimum\nand the maximum value of $M_h$ as a function of $X_t\/\\ensuremath{M_S}$, respectively;\nhere and in the following $X_t$ denotes $X_t^{\\mathrm{OS}}$).\nThe other parameters are $M_A = M_2 = \\mu = 1000 \\,\\, \\mathrm{GeV}$,\n$m_{\\tilde{g}} = 1600 \\,\\, \\mathrm{GeV}$ ($M_2$ is the SU(2) gaugino mass term, $\\mu$ the\nHiggsino mass parameter and $m_{\\tilde{g}}$ the gluino mass) and $\\tan \\beta = 10$.\nThe plot shows for the two values of $X_t\/\\ensuremath{M_S}$ the\nfixed-order FD result containing corrections up to the two-loop level\n(labelled as ``FH295'', which refers to the previous version of the code\n{\\tt FeynHiggs}) as well as the latter result supplemented with the analytic\nsolution of the RGEs up to the 3-loop, \\ldots 7-loop level \n(labelled as ``3-loop'' \\ldots ``7-loop''). The curve labelled as\n``LL+NLL'' represents our full result where the FD contribution is\nsupplemented by the leading and next-to-leading logarithms summed to all\norders.\nOne can see that the impact of the higher-order logarithmic\ncontributions is relatively small for $\\ensuremath{M_S} = \\order{1 \\,\\, \\mathrm{TeV}}$, while\nlarge differences between the fixed-order result and the improved\nresults occur for large values of $\\ensuremath{M_S}$.\nThe 3-loop logarithmic\ncontribution is found to have the largest impact in this context, but \nfor $\\ensuremath{M_S} \\gsim 2500 (6000) \\,\\, \\mathrm{GeV}$ for\n$X_t\/\\ensuremath{M_S} = 2 (0)$ also contributions beyond 3-loop are important.\nA convergence of the higher-order logarithmic contributions towards the\nfull resummed result is visible.\nAt $\\ensuremath{M_S} = 20 \\,\\, \\mathrm{TeV}$ the \ndifference between the 7-loop result and the full resummed result is\naround $900 (200) \\,\\, \\mathrm{MeV}$ for $X_t\/\\ensuremath{M_S} = 2 (0)$. The corresponding\ndeviations stay below $100 \\,\\, \\mathrm{MeV}$ for $\\ensuremath{M_S} \\lsim 10 \\,\\, \\mathrm{TeV}$.\nThe plot furthermore shows that for $\\ensuremath{M_S} \\approx 10 \\,\\, \\mathrm{TeV}$ (and the value\nof $\\tan \\beta = 10$ chosen here) a predicted value of $M_h$ of about $126\n\\,\\, \\mathrm{GeV}$ is obtained even for the case of vanishing mixing in the scalar\ntop sector ($X_t = 0$). Since the predicted value of $M_h$ grows further\nwith increasing $\\ensuremath{M_S}$ it becomes apparent that the measured \nmass of the observed signal, when interpreted as $M_h$, can\nbe used (within the current experimental\nand theoretical uncertaintes) to derive an {\\em upper bound\\\/} on the\nmass scale $\\ensuremath{M_S}$ in the scalar top sector,\nsee also \\citere{StopUpperLimit}.\n\n\nIn the lower plot of \\reffi{fig:plots} we compare our result with the\none based on the code {\\tt H3m}~\\cite{mhiggsFD3l}\nusing a CMSSM scenario\nwith $m_0 = m_{1\/2} = 200 \\,\\, \\mathrm{GeV} \\ldots 15000 \\,\\, \\mathrm{GeV}$, \n$A_0 = 0$, $\\tan \\beta = 10$ and $\\mu > 0$. The spectra were generated with \n{\\tt SoftSusy\\,3.3.10}~\\cite{softsusy}.\nThe {\\tt H3m} result (blue line) is based on the {\\tt FeynHiggs}\\ result\nup to the two-loop order and incorporates the \\order{\\alpha_t\\alpha_s^2}\ncorrections containing also non-logarithmic contributions. Besides our \nresult where {\\tt FeynHiggs}\\ is supplemented by the leading and subleading logarithmic\ncorrections to all orders (red line) we also show the expansion of our\nresult up to the 3-loop level (green solid line), containing at this\nlevel the $L^3$ and $L^2$ terms, and the result restricting the\ncontributions at the 3-loop level to the ones of \\order{\\alpha_t\\alpha_s^2}\n(green dashed). We find that the latter result agrees rather well with\n{\\tt H3m}, with maximal deviations of \\order{1 \\,\\, \\mathrm{GeV}} for $\\ensuremath{M_S} \\lsim 10\n\\,\\, \\mathrm{TeV}$. The observed deviations can be attributed to the $L^1$ and\n$L^0$ terms contained in {\\tt H3m}, to the various SUSY mass\nhierarchies taken into account in {\\tt H3m}, and to the different\nrenormalization schemes employed. However, one can see that the 3-loop\ncontributions beyond the \\order{\\alpha_t\\alpha_s^2} terms, i.e.\\ corrections of \n\\order{\\alpha_t^2\\alpha_s, \\alpha_t^3} that are not contained in {\\tt H3m}, have a sizable\neffect giving rise to a (downward) shift in $M_h$ by $\\sim 5 \\,\\, \\mathrm{GeV}$\nfor $\\ensuremath{M_S} = 10 \\,\\, \\mathrm{TeV}$. The corrections beyond the 3-loop order yield an\nadditional \nshift of about $2 \\,\\, \\mathrm{GeV}$ for $\\ensuremath{M_S} = 10 \\,\\, \\mathrm{TeV}$, in\naccordance with our analysis above. Larger changes are found for $\\ensuremath{M_S} >\n10 \\,\\, \\mathrm{TeV}$.\n\n\n\\smallskip\nIn summary, we have obtained an improved prediction for the light\n${\\cal CP}$-even Higgs boson mass in the MSSM by combining the\nFD result at the one- and two-loop level with an\nall-order resummation of the leading and subleading logarithmic \ncontributions from the top\/stop sector obtained from solving the two-loop\nRGEs. Particular care has been taken\nto consistently match these two different types of corrections. The result,\nproviding the most precise prediction for $M_h$ in the presence of large\nmasses of the scalar partners of the top quark, has been implemented\ninto the public code {\\tt FeynHiggs}. We have found a sizable effect of the\nhigher-order logarithmic contributions for \n$\\ensuremath{M_S} \\equiv \\sqrt{m_{\\tilde{t}_1}m_{\\tilde{t}_2}} \\gsim 2 \\,\\, \\mathrm{TeV}$ which grows with increasing\n$\\ensuremath{M_S}$. \nIn comparison with {\\tt H3m}, which contains the\n \\order{\\alpha_t\\alpha_s^2} corrections to $M_h$, we find that additional \n3-loop corrections of\n\\order{\\alpha_t^2\\alpha_s,\\alpha_t^2} and also higher-loop corrections are both\nimportant for a precise $M_h$ prediction, amounting to effects of \n$\\sim 7 \\,\\, \\mathrm{GeV}$ for $\\ensuremath{M_S} = 10 \\,\\, \\mathrm{TeV}$ in our example.\nFinally,\nwe have shown that for sufficiently high $\\ensuremath{M_S}$ the predicted\nvalues of $M_h$ reach about $126 \\,\\, \\mathrm{GeV}$ even for vanishing mixing in the\nscalar top sector. As a consequence, even higher $\\ensuremath{M_S}$ values are\ndisfavoured by the measured mass value of the Higgs signal.\n\n\n\n\n\n\\bigskip\n{\\bf Acknowledgements: } \nWe thank \nH.~Haber, \nP.~Kant, \nP.~Slavich \nand \nC.~Wagner\nfor helpful discussions.\nThe work of S.H.\\ was supported by the \nSpanish MICINN's Consolider-Ingenio 2010 Program under Grant MultiDark No.\\ \nCSD2009-00064. \nThe work of G.W.\\ was supported by the Collaborative\nResearch Center SFB676 of the DFG, ``Particles, Strings, and the early\nUniverse\". \n\n\n\n\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\nFew-shot learning (FSL) is of great significance at least for the following two scenarios \\cite{FSL_survey}: Firstly, FSL can relieve the heavy needs for data gathering and labeling, which can boost the ubiquitous use of deep learning techniques, especially for users without enough resources. Secondly, FSL is an important solution for applications in which rare cases matter or image acquisition is costly because of high operation difficulty or ethical issues. Typical examples of such applications include computer assisted diagnosis with medical imaging, classification of endangered species, \\etc.\n\n\nThere have been lots of FSL methods, most of which are based on the assumption that knowledge can be well extracted from base (seen) classes and transferred to novel (unseen) classes. However, this is not always the case. The knowledge in a pre-trained backbone convolutional neural network (CNN), which computes features of an input image, may sometimes be useless when novel categories have significant visual differences from images of the base categories \\cite{yue2020interventional}.\nWhat makes matter worse is that we even have no way to see if the visual differences between the base and novel categories are significant \\textit{for an FSL model}. This raised one essential question: \\textit{Is there any way to see what is actually transferred?}\n\n\nActually, in the FSL task, most works only treat the convolutional layer as the image embedding tool, and do not pay attention to the reasons for the extracted features. In this paper, we redesign the mechanism of knowledge transfer for FSL tasks, which offers an answer to the above question. Our approach is inspired by what human beings actually do when trying to recognize a rarely seen object. That is, we usually try to find some patterns in the object and match them in a small number of seen examples in our memory. We adopt a recently-emerged explainable classifier, called SCOUTER \\cite{li2020scouter}, and propose a new FSL method, named match-them-up network (MTUNet{}) consisted of \\textit{pattern extractor} (PE) and \\textit{pairwise matching} (PM).\n\nPE is designed for finding discriminative and consistent patterns for image representation. The knowledge transferred from the base categories to the novel categories is the learned patterns. Owing to the explainability of SCOUTER, the extracted patterns themselves can be easily visualized by exemplifying them in the images as shown in Figure \\ref{fig_story}(a). This directly means that we have a way to see what is actually transferred in our FSL pipeline. The patterns extracted in each of the support and query images are aggregated to form discriminative image representation (overall attention), which is used for matching. As shown in Figure \\ref{fig_story}(b), the visualization of aggregated patterns collectively shows a consistent and meaningful clue for the images of the same category. For example, PE shows strong attention on the neck of the goose in the second column, which is consistent in both support and query images. Image representation based on the patterns from base categories makes matching between a pair of images much easier by incorporating only a small number of regions to pay attention to. \n\n\n\n\n\nOn top of the PE, PM is adopted to judge whether image pairs belong to the same category or not. Each pair consists of one image from a \\textit{support} set and one image from a \\textit{query} set. The category of the support image that gives the highest score is regarded as the query image's category. Together with PE, MTUNet{} can provide a matching score matrix to further relate the visualization and the model decision.\n\nThe main contributions of our work include:\n\\begin{compactitem}\n\t\\item a new FSL method that can output visual explanations besides classification results to find potential failures of the method,\n\t\\item a new image representation based on filtering original image features, given by a backbone CNN, to keep only informative regions, and relate the visualization with the model decision.\n\t\\item a new light-weighted model to perform accurate FSL image classification.\n\\end{compactitem}\n\n\\section{Related Work}\n\\subsection{Few-shot Learning}\nRecently, deep neural networks have achieved outstanding performance in various classification tasks, thanks to the availability of a sufficient number of images for each category. Such large datasets usually require lots of effort for their creation, and some tasks, such as medical tasks \\cite{prabhu2019few,feyjie2020semi}, may not inherently have enough supervising signals. For these tasks, we need a new paradigm that allows learning a model with a small number of labeled images. The popular FSL tasks \\cite{vinyals2016matching,snell2017prototypical,mishra2017simple} serve as a testbed for some certain aspects of such small tasks. Recent efforts toward FSL are summarized as follows. \n\n\n\\begin{figure*}[!t]\n\t\\centering\n\t\\includegraphics[width=\\textwidth]{zfig_structure.pdf}\n\t\\caption{Overall structure of MTUNet. One query is processed by CNN backbone and \\textit{pattern extractor} (PE) to provide exclusive patterns and then turned into an overall attention. Query will be concatenated to each support to make a pair for final discrimination through pairwise matching (PM). The dotted line represent each support image undergo the same calculation as query.}\n\t\\label{fig_structure}\n\n\\end{figure*}\n\n\n\\textbf{Image Embedding and Metric Learning.}\nMany works focus on how to transform images into vectors in embedding space, in which the distance between a pair of vectors represents the conceptual dissimilarity. An early approach uses Siamese networks \\cite{koch2015siamese} as a shared feature extractor to produce image embeddings for both support and query images. The weighted $\\ell_1$ distance is used for the classification criterion. Some use a multi-layer perceptron (MLP) to parameterize and learn a classifier \\cite{kim2019edge, garcia2017few, sung2018learning}. Metric learning can offer a better way to train the mapping into the embedding space \\cite{vinyals2016matching,snell2017prototypical}. Some works try to improve the discriminatory power of image embeddings. Simple Shot \\cite{wang2019simpleshot} applies $\\ell_2$ normalization and Central method to make the distance calculation easier.\n\n\\textbf{Meta-learning.}\nAnother major approach to FSL is to optimize models so that they can rapidly adapt to new tasks. It is a good thing that adapting feature extractor to new tasks at the novel test time. Fine-tuning transfer-learned networks \\cite{yosinski2014transferable} fine-tune the feature extractor using the task-specific support images.\nMAML \\cite{finn2017model} and its extensions \\cite{ravi2016optimization, nichol2018first} train a set of initialization parameters, and through one or more steps of gradient adjustment on the basis of the initial parameters, they can be easily adapted to a new task with only a small amount of data. Besides training a good parameter initialization, Meta-SGD \\cite{li2017meta} also trains the parameter update direction and step size.\n\n\\textbf{Data Augmentation.}\nData augmentation aims at introducing immutability to models to capture in both image and feature levels \\cite{ren2018meta, chen2019image}. Some works try to use samples which are weakly labeled or unlabeled \\cite{douze2018low, pfister2014domain}. ICI \\cite{wang2020instance} introduces a judgment mechanism to increase training samples. It is always worth increasing the training set by utilizing the unlabeled data with confidently predicted labels. In general, solving an FSL problem by augmenting $D_{train}$ is straightforward and easy to understand.\n\n\\textbf{Transductive or Semi-supervised Paradigm.} Transductive or semi-supervised approaches \\cite{hu2020leveraging,dhillon2019baseline} have gained popularity, which makes great progress in the past few years. They use the statistics of query examples or statistics across the few-shot tasks, which assumes that all novel images are ready beforehand. We only employ the original inductive paradigm to explore explainable feature extraction, but our idea can be easily adopted to the transductive paradigm\n\n\\subsection{Explainable AI}\nDeep neural networks are considered as a black-box technology, and explainable artificial intelligence (XAI) is a series of attempts to unveil them. Most XAI methods for classification tasks are based on back-propagation \\cite{Score-CAM,shrikumar2017learning,selvaraju2017grad,chattopadhay2018grad} or perturbation \\cite{IBA}. All these methods are \\textit{post-hoc}, which can not be added to the model structure during training.\n\nA few works \\cite{sunexplain,gengexplainable,karlinsky2020starnet} have tried XAI for FSL tasks. Geng \\emph{et al.} \\cite{gengexplainable} uses a knowledge graph to make an explanation for zero-shot tasks. Sun \\emph{et al.} \\cite{sunexplain} adopts layer-wise relevance propagation (LRP) \\cite{bach2015pixel} to explain the output of a classifier. StarNet \\cite{karlinsky2020starnet} realize visualization through heat maps derived from back-project. Recently, a new type of XAI, coined SCOUTER \\cite{li2020scouter}, has been proposed, which applies the self-attention mechanism \\cite{Transformer} to the classifier. This method can further extract the discriminant attentions for each category during training, which makes classification results explainable. We apply this technique to FSL tasks in order to explore a new explainable FSL paradigm. PE provides insights on why it classified an input image into a certain novel category. \n\n\\section{Methodology}\n\\subsection{Problem Definition}\\label{definition}\nThis paper addresses an inductive FSL task (\\cf, transductive one \\cite{dhillon2019baseline,hu2020leveraging}), in which we are given two disjoint sets $\\mathcal{D}_\\text{base}$ and $\\mathcal{D}_\\text{novel}$ of samples. The former is the base set that includes categories ($\\mathcal{C}_\\text{base}$) with many labeled images. The latter is the novel set and include categories ($\\mathcal{C}_\\text{novel}$) with a few labeled images. $\\mathcal{C}_\\text{base}$ and $\\mathcal{C}_\\text{novel}$ are disjoint. The FSL task is to find a mapping from a novel image $x$ into the corresponding category $y$.\n\nThe literature typically uses the $K$-way $N$-shot episodic paradigm for training\/evaluating FSL models. For each episode, we sample two subsets of $\\mathcal{D}_\\text{base}$ for training, namely, \\textit{support set} $\\mathcal{S} = \\{(x_i, y_i)|i=1,\\dots,K \\times N\\}$ and \\textit{query set} $\\mathcal{Q} = \\{(x_i^\\text{q}, y^\\text{q}_i)|i=1,\\dots,K\\times M\\}. $\nThese images are of the same $K$ categories in $\\mathcal{C}_\\text{base}$, and we sampled the same numbers of images ($N$ images for the support set and $M$ images for the query set). An FSL model is trained so that it can find a match between images in $\\mathcal{Q}$ (with abuse of notation) and $\\mathcal{S}$. The image in $\\mathcal{Q}$ is classified as the category of the matched image in $\\mathcal{S}$.\n\n\n\n\n\\subsection{Overview}\n\nThe overall process is illustrated in Figure \\ref{fig_structure}. In each episode, we extract feature maps $F=f_\\theta(x)\\in\\mathbb{R}^{c \\times h\\times w}$ from image $x$ in both $\\mathcal{S}$ and $\\mathcal{Q}$ using backbone convolutional neural network $f_\\theta$, where $\\theta$ is the set of learnable parameters. $F$ is then fed into the \\textit{pattern extractor} (PE) module, $f_\\phi$, with learnable parameter set $\\phi$. This module gives attention $A = f_\\phi(F) \\in \\mathbb{R}^{z \\times l}$ over $F$. Our \\textit{pair matching} (PM) module uses an MLP to compute the score of query image $x^q \\in \\mathcal{Q}$ belonging to the category of $x$'s in $\\mathcal{S}$. \n\nPE plays a major role in the FSL task. PE is designed to learn a transferable attention mechanism. This ends up in finding common patterns that are shared among different episodes sampled from $\\mathcal{D}_\\text{base}$. Consequently the patterns are shared also among $\\mathcal{D}_\\text{novel}$ given that $\\mathcal{D}_\\text{base}$ and $\\mathcal{D}_\\text{novel}$ are from similar domains. \n\n\n\\subsection{Pattern Extractor}\n\nSCOUTER is originally designed as an explainable classifier, of which decision is based directly on the existence of certain learned \\textit{patterns} in an image \\cite{li2020scouter}. It is built upon the self-attention mechanism \\cite{Transformer} to efficiently find common patterns in images of a certain category. In the context of FSL, we extend this idea to find common patterns to efficiently differentiate given sets of categories even across different episodes. The presence of a certain combination of these learned patterns gives a strong clue on the category of the image, facilitating classification even of novel categories. We implement our PE on top of SCOUTER.\n\nThe basic idea of PE is to find common patterns through the self-attention mechanism. Input feature maps $F$ is firstly fed into a $1\\times 1$ convolution layer followed ReLU nonlinearity to squeeze the dimensionality of $F$ from $c$ to $d$. We flatten the spatial dimensions of the squeezed features to form $F' \\in \\mathbb{R}^{d \\times l}$, where $l = hw$. To maintain the spatial information, position embedding $P$ \\cite{xie2017aggregated, locatello2020object, li2020scouter} is added to the features, \\ie, $\\tilde{F} = F' + P$.\n\nThe self-attention mechanism gives the attention over $F$ for the spatial dimension by the dot-product similarity between a set of $z$ learned patterns $W \\in \\mathbb{R}^{z \\times d}$ ($z$ is the number of the patterns) and $\\tilde{F}$ after nonlinear transformations $g_\\text{Q}$ and $g_{\\text{K}}$. PE repeats this process with updating the pattern with a gated recurrent unit (GRU) to refine the attention. That is, given \n\\begin{equation}\n g_\\text{Q}(W^{(t)}) \\in \\mathbb{R}^{z \\times d}, \\quad g_\\text{K}(\\tilde{F}) \\in \\mathbb{R}^{d \\times l},\n\\end{equation}\nfor the $t$-th repetition, the attention is given using certain normalization function $\\xi$ by\n\\begin{align}\n \\bar{A}^{(t)} &= g_\\text{Q}(W^{(t)}) g_\\text{K}(\\tilde{F}) \\quad \\in (0,1)^{z \\times l} \\\\\n A^{(t)} &= \\xi(\\bar{A}^{(t)}).\n\\end{align}\nPatterns $W^{(t)}$ is updated $T$ times (\\ie, $t=1,\\dots,T$) by \n\\begin{align}\n U^{(t)} &= A^{(t)} {F'}^\\top \\\\\n W^{(t+1)}&=\\operatorname{GRU}{(U^{(t)}, W^{(t)})}.\n\\end{align}\n\n\n\nPE adopts a different normalization strategy from the original SCOUTER. Let $\\text{Softmax}_\\text{R}(X)$ and $\\sigma(X)$ be softmax over respective row vectors of matrix $X$ and sigmoid. SCOUTER normalizes the attention map only over the flattened spatial dimensions, \\ie,\n\\begin{equation}\n A^{(t)} = \\sigma(\\bar{A}^{(t)}).\n\\end{equation}\nThis allows finding multiple patterns in a single image. MTUNet{} further modulates this map by \n\\begin{equation}\n A^{(t)} = \\sigma(\\bar A^{(t)}) \\odot \\text{Softmax}_\\text{R}(\\bar A^{(t)}), \\label{eq:att_mod}\n\\end{equation}\nwhich suppresses weak attention over different patterns at the same spatial location, where $\\odot$ is the Hadamard product. This enforces the network to find more specific yet discriminative patterns with fewer correlations among them and thus ends up with more pinpoint attentions. The learned patterns can be more responsive in different images with this modulation as an attention map only responds to a single pattern that does not include its peripheral region.\n\n\n\n\nThe input image is finally described by the overall attention corresponding to the extracted patterns, given by\n\\begin{equation}\n V = \\frac{1}{z}A^{(T)} F \\mathbf{1}_z,\n\\end{equation}\nwhere $\\mathbf{1}_z$ is the row vector with all $z$ elements being 1. $A^{(T)}$ is reshaped the $l$ into the same spatial structure as $F$. $V$ will then undergo an average pooling among spatial dimension and only keep the channel dimension $c$. \n\n\\subsection{Pairwise Matching}\n\nAn FSL classification can be solved by finding the membership of the query to one of the given support images. Some FSL methods use metric learning \\cite{snell2017prototypical, vinyals2016matching} to find matches between the query and the supports. The cosine similarity or the $\\ell_2$ distance are the typical choices \\cite{gidaris2018dynamic,wang2019simpleshot}. Learnable distances are another popular choice for the metric learning-based FSL methods \\cite{kim2019edge, garcia2017few, sung2018learning}. We use a learnable distance with an MLP.\n\nLet $V^\\text{q}$ be features of query image $x^\\text{q} \\in \\mathcal{Q}$ and $V_{kn}$ of support image $x_{kn} \\in \\mathcal{S}$, where the subscripts $k$ and $n$ stand for the $n$-th image of category $k$. For $n > 1$, the average over the $n$ images are taken to generate representative feature $\\bar{V}_k$; otherwise (\\ie, $n=1$), $\\bar{V}_k = V_{k1}$. For computing the membership score $s$ of query image $x^\\text{q}$ to category $k$, we use MLP $f_\\gamma$ with learnable parameters $\\gamma$:\n\\begin{equation}\ns(x^\\text{q}, \\mathcal{S}_k) = \\sigma(f_\\gamma([V^\\text{q}, \\bar{V}_k])), \\label{eq:cls}\n\\end{equation}\nwhere $[\\cdot, \\cdot]$ is concatenation of two vectors for the one-to-one pair and $\\mathcal{S}_k \\subset \\mathcal{S}$ contains images of category $k$. $x^\\text{q}$ is classified into the category with maximum $s$ over $\\mathcal{S}_k$ for $k = 1, 2, \\dots, K$.\n\n\\subsection{Training}\\label{training}\nAfter pre-training of the backbone CNN $f_\\theta$, we first train the PE module in the same way as \\cite{li2020scouter}. The area loss facilitates to find compact patterns. For this training, we further split $\\mathcal{D}_\\text{base}$ into two subsets $\\mathcal{D}_\\text{base,T}$ and $\\mathcal{D}_\\text{base,V}$. The former contains 90\\% of images of each category and the latter contains the rest. We sample $z$ categories from $\\mathcal{D}_\\text{base}$ and use images of these categories in $\\mathcal{D}_\\text{base,T}$ for training. The images of the same sampled categories in $\\mathcal{D}_\\text{base,V}$ is used for validation. With these sampled categories, the training is trying to find discriminative patterns together with our attention map modulation in Eq.~(\\ref{eq:att_mod}).\n\nWe then train MTUNet{} with the backbone and the PE module fixed. For $\\mathcal{Q}$ and $\\mathcal{S}$ sampled from $\\mathcal{D}_\\text{base}$ for each episode, we train $f_\\gamma$ with the binary cross-entropy loss:\n\\begin{equation}\n L = -\\sum_{(x^\\text{q}, y^\\text{q}) \\in \\mathcal{Q}} {y^\\text{q}}^\\top \\log(s(x^\\text{q},\\mathcal{S})),\n\\end{equation}\nwhere $s(x^\\text{q},\\mathcal{S}) = (s_1(x^\\text{q},\\mathcal{S}_1) , \\dots, s_K(x^\\text{q},\\mathcal{S}_K) )^\\top$.\n\n\n\\section{Experiments}\n\\subsection{Datesets}\nWe evaluate our approach on three commonly-used datasets, mini-ImageNet \\cite{vinyals2016matching}, tiered-ImageNet \\cite{ren2018meta}, and CIFAR-FS \\cite{bertinetto2018meta}. \\textbf{Mini-ImageNet} consists of 100 categories sampled from ImageNet with 600 images per class. These images are divided into the base $\\mathcal{D}_\\text{base}$, novel validation $\\mathcal{D}_\\text{val}$, and novel test $\\mathcal{D}_\\text{test}$ sets with 64, 16, and 20 categories, respectively, where both $\\mathcal{D}_\\text{val}$ and $\\mathcal{D}_\\text{test}$ corresponded to $\\mathcal{D}_\\text{novel}$ in Section \\ref{definition}. The images in miniImageNet are of size $84\\times84$. \\textbf{Tiered-ImageNet} consists of ImageNet 608 classes divided into 351 base classes, 97 novel validation classes, and 160 novel test classes. There are 779,165 images with size $84\\times84$. \\textbf{CIFAR-FS} is a dataset with images from CIFAR-100 \\cite{krizhevsky2009learning}. This dataset contains 100 categories with 600 images each. We follow the split given in \\cite{bertinetto2018meta}, which are 64, 16, and 20 categories for the base, novel validation, and novel test sets.\n\n\\subsection{Experimental Setup}\\label{experiment}\n\nFollowing the majority of the literature, we evaluate MTUNet{} on 10,000 episodes of 5-way classification created by first randomly sampling 5 categories from $\\mathcal{D}_\\text{base}$ and then sampling support and query images of these categories with $N = 1$ or $5$ and $M = 15$ per category. We report the average accuracy over $K\\times M = 75$ queries in the 10,000 episodes and the 95\\% confidence interval.\n\n\nWe employ two CNN architectures as our backbone $f_\\theta$, which are often used for FSL tasks, namely WRN-28-10 \\cite{zagoruyko2016wide} and ResNet-18 \\cite{ResNet}.\nFor ResNet-18, we remove the first two down-sampling layers and change the kernel of the first $7\\times7$ convolutional layer to $3\\times3$. We use the hidden vector of the last convolutional layer after ReLU as feature maps $F$, where the numbers of feature maps are 512 and 640 for ResNet-18 and WRN-28-10 respectively.\n\n\\renewcommand{\\thefootnote}{\\fnsymbol{footnote}}\n\\setcounter{footnote}{2}\n\\footnotetext{Results are reported in \\cite{wang2019simpleshot}}\n\\setcounter{footnote}{2}\n\n\\begin{table}[!t]\n\\caption{Average accuracy of 10000 sampling 5-ways task on test set of mini-ImageNet.}\n\\centering\n\\resizebox{0.95\\columnwidth}{!}{\n\\begin{tabular}{lcc}\n\\toprule\n\\textbf{Approach} &\\textbf{One shot} &\\textbf{Five shots}\\\\\n\\midrule\nMetaLSTM \\cite{ravi2016optimization} &43.44$\\pm$0.77 &60.60$\\pm$0.71 \\\\\nMatchingNet \\cite{vinyals2016matching} &43.56$\\pm$0.84 &55.31$\\pm$0.73 \\\\\nMAML \\cite{finn2017model} &48.70$\\pm$1.84 &63.11$\\pm$0.92\\\\\nLLAMA \\cite{grant2018recasting} &49.40$\\pm$1.83 &-\\\\\nProtoNet \\cite{snell2017prototypical} &49.42$\\pm$0.78 &68.20$\\pm$0.66\\\\\nPLATIPUS \\cite{finn2018probabilistic} &50.13$\\pm$1.86 &-\\\\\nGNN \\cite{garcia2017few} &50.33$\\pm$0.36 &66.41$\\pm$0.63\\\\\nRelationNet \\cite{sung2018learning} &50.44$\\pm$0.82 &65.32$\\pm$0.70\\\\\nMeta SGD \\cite{li2017meta} &50.47$\\pm$1.87 &64.03$\\pm$0.94\\\\\nR2-D2 \\cite{bertinetto2018meta} &51.20$\\pm$0.60 &68.20$\\pm$0.60\\\\\nRelationNet \\cite{sung2018learning} &52.48$\\pm$0.86 &69.83$\\pm$0.68\\\\\nGidaris \\cite{gidaris2018dynamic} &55.45$\\pm$0.89 &70.13$\\pm$0.68\\\\\nSNAIL \\cite{mishra2017simple} &55.71$\\pm$0.99 &68.88$\\pm$0.92\\\\\nadaCNN \\cite{munkhdalai2018metalearning} &56.88$\\pm$0.62 &71.94$\\pm$0.57\\\\\nSimpleShot(UN) \\cite{wang2019simpleshot} &57.81$\\pm$0.21 &\\textbf{80.43$\\pm$0.15}\\\\\nQiao \\cite{qiao2018few} &59.60$\\pm$0.41 &73.74$\\pm$0.19\\\\\nLEO \\cite{rusu2018meta} &\\textbf{61.76$\\pm$0.08} &77.59$\\pm$0.12\\\\\n\\midrule\nMTUNet{}+ResNet-18 &55.03$\\pm$0.49 &70.22$\\pm$0.35\\\\\nMTUNet{}+WRN &56.12$\\pm$0.43 &71.93$\\pm$0.40\\\\\n\\bottomrule\n\\end{tabular}\n}\n\\label{results_mini}\n\\end{table}\n\n\\begin{table}[!t]\n\\caption{Average accuracy of 10000 sampling 5-ways task on test set of tiered-ImageNet.}\n\\centering\n\\resizebox{0.95\\columnwidth}{!}{\n\\begin{tabular}{lcc}\n\\toprule\n\\textbf{Approach} &\\textbf{One shot} &\\textbf{Five shots}\\\\\n\\midrule\nReptile \\cite{nichol2018first}\\footnotemark[\\value{footnote}] &48.97$\\pm$0.21 &66.47$\\pm$0.21\\\\\nMAML \\cite{finn2017model} &51.67$\\pm$1.81 &70.30$\\pm$0.08\\\\\nProtoNet \\cite{snell2017prototypical}\\footnotemark[\\value{footnote}] &53.31$\\pm$0.20 &72.69$\\pm$0.74\\\\\nRelationNet \\cite{sung2018learning} &54.48$\\pm$0.93 &71.32$\\pm$0.78\\\\\nMeta SGD \\cite{li2017meta}\\footnotemark[\\value{footnote}] &62.95$\\pm$0.03 &79.34$\\pm$0.06\\\\\nSimpleShot(UN) \\cite{wang2019simpleshot} &64.35$\\pm$0.23 &\\textbf{85.69$\\pm$0.15}\\\\\nLEO \\cite{rusu2018meta} &\\textbf{66.33$\\pm$0.05} &81.44$\\pm$0.09\\\\\n\\midrule\nMTUNet{}+ResNet-18 &61.27$\\pm$0.50 &77.82$\\pm$0.41\\\\\nMTUNet{}+WRN &62.42$\\pm$0.51 &80.05$\\pm$0.46\\\\\n\\bottomrule\n\\end{tabular}\n}\n\\label{results_tiered}\n\\end{table}\n\n\n\\setcounter{footnote}{3}\n\\footnotetext{Results are reported in \\cite{bertinetto2018meta}}\n\\setcounter{footnote}{3}\n\n\\begin{table}[!t]\n\\caption{Average accuracy of 10000 sampling 5-ways task on test set of CIFAR-FS.}\n\\centering\n\\resizebox{0.95\\columnwidth}{!}{\n\\begin{tabular}{lcc}\n\\toprule\n\\textbf{Approach} &\\textbf{One shot} &\\textbf{Five shots}\\\\\n\\midrule\nRelationNet \\cite{sung2018learning}\\footnotemark[\\value{footnote}] &55.00$\\pm$1.00 &69.30$\\pm$0.80\\\\\nProtoNet \\cite{snell2017prototypical}\\footnotemark[\\value{footnote}] &55.50$\\pm$0.70 &72.00$\\pm$0.60\\\\\nMAML \\cite{finn2017model}\\footnotemark[\\value{footnote}] &58.90$\\pm$1.90 &71.50$\\pm$1.00\\\\\nGNN \\cite{garcia2017few}\\footnotemark[\\value{footnote}] &61.90 &75.30\\\\\nR2-D2 \\cite{bertinetto2018meta} &65.30$\\pm$0.20 &78.30$\\pm$0.20\\\\\n\\midrule\nMTUNet{}+ResNet-18 &66.31$\\pm$0.50 &80.16$\\pm$0.39\\\\\nMTUNet{}+WRN &\\textbf{68.34$\\pm$0.49} &\\textbf{82.93$\\pm$0.37}\\\\\n\\bottomrule\n\\end{tabular}\n}\n\\label{results_CIFAR-FS}\n\\end{table}\n\n\\begin{figure*}[!t]\n\t\\centering\n\t\\includegraphics[width=\\textwidth]{xslots.pdf}\n\t\\caption{Visualization of each pattern and the average features for a sampled task in mini-ImageNet. a is the class of lock and c is the horizontal bar. Overall is the overall attention among all patterns. The third to ninth columns are the visualization of the re-gions corresponding to the learned patterns.}\n\t\\label{fig:xslot}\n\n\\end{figure*}\n\nAs noted in \\cite{li2020scouter}, pre-training of the backbone CNNs is important for our PE module. We adopted a distance-based strategy, which is similar to SimpleShot \\cite{wang2019simpleshot}. We train the backbone CNNs with all images in $\\mathcal{D}_\\text{base}$. The performance of a simple nearest-neighbor-based method is then evaluated over $\\mathcal{D}_\\text{val}$ with 2,000 episodes of 5-way FSL task, and the best model is adopted. The learning rate for training starts with $10^{-3}$ and is divided by 10 every 20 epochs. It has total of 50 epochs.\n\nAs for the PE module, we set $d$ to 64. We set the maximum update $T$ as 3. For the number $z$ of the patterns is empirically set to $1\/10$ of the number of the base set categories, which are 7, 36, and 7 for mini-ImageNet, tiered-ImageNet, and CIFAR-FS, respectively. The importance of this choice is discussed in Section \\ref{sec:discussion}. SCOUTER's loss has two hyper-parameters $e$ and $\\lambda$, which controls over positive\/negative explanation and over the preference to smaller attention areas, respectively. We set $e=1$ (\\ie, positive explanation) and $\\lambda=1$ following \\cite{li2020scouter}. Both $g_\\text{Q}$ and $g_\\text{K}$ have three FC layers with ReLU nonlinearities between them. All the parameters in the backbone $f_\\theta$ are fixed. We adopt the training strategy described in \\ref{training}. The learning rate for training starts with $10^{-4}$ and is divided by 10 every 40 epochs. It is trained for total of 60 epochs.\n\nFor training the whole MTUNet, the learnable parameters in backbone CNNs and PE are frozen.\nIn a single epoch of training, we sample 1,000 episodes of 5-way tasks. The model is trained for 20 epochs with an initial learning rate $10^{-3}$, which is divided by 10 at the 10-th epoch. We use the model with the best performance with 2,000 episodes sampled from $\\mathcal{D}_\\text{val}$.\n\nOur model is implemented with PyTorch. AdaBelief \\cite{zhuang2020adabelief} is adapted as optimizer. Input images are resized into $80\\times80$, going through data augmentation including random flip and affine transformation following \\cite{wang2019simpleshot}. A GPU workstation with two NVIDIA Quadro GV100 (32GB memory) GPUs are used for all experiments.\n\n\\subsection{Results}\\label{sota}\nMTUNet{} is compared with state-of-the-art (SoTA) FSL methods. We exclude ones in semi-supervised and transductive paradigms, which use the statistics of novel set across different FSL tasks. We also do not adopt any post-processing methods like $\\ell_2$ normalization in \\cite{wang2019simpleshot}.\n\nWe report our best model by randomly sampling 10,000 1-shot and 5-shot tasks over $\\mathcal{D}_\\text{test}$ in Tables \\ref{results_mini}--\\ref{results_CIFAR-FS} for the three datasets. We select the category for PE pre-training by sampling every 10 categories from the base set category list. The results demonstrate that MTUNet{} outperforms or is comparable with SoTA methods. \n\nThe different architectures of the backbone CNNs affect the performance. The variants with WRN always give a better performance than those with ResNet-18. Asides from the difference in the network architecture, the size of feature maps may be one of the factors. For mini-ImageNet, the WRN variants has $20 \\times 20$ feature maps, while the ResNet-18 variants has $10 \\times 10$. Such larger feature maps not only provides more information to the PM{} module but also give a better basis of patterns as higher resolutions may help find more specific patterns. \n\n\n\\subsection{Explainability}\\label{explain}\nIn addition to the classification performance, MTUNet{} is designed to be explainable in two different aspects. Firstly, MTUNet{}'s decision is based on certain combinations of learned patterns. These patterns are localized in both query and support images through $A^{(T)}$, which can be easily visualized. This visualization offers intuition on the learned patterns and how much these patterns are shared among the query and support images. Secondly, thanks to the one-to-one matching strategy formulated as a binary classification problem in Eq.~(\\ref{eq:cls}), the distributions (or appearances) of learned patterns in query and support images give a strong clue on MTUNet{}'s matching score $s$. \n\n\n\\paragraph{Pattern-based visual explanation.}\nMTUNet{}'s decision is based on the learned patterns, \\ie, it is solely based on how much shared patterns (or features) appear in both a query and a support. This design in turn means that, by pinpointing each pattern in the images, we can obtain an intuition behind the decision made by the model. This can be done by merely visualizing $A^{(T)}$. \n\nFigures \\ref{fig:xslot} (a) and (b) respectively show a pair of support and query images in a 5-way task in mini-ImageNet. The pairs (a) and (b) are of categories \\texttt{lock} and \\texttt{horizontal bar}, respectively. The second column shows the visualization of averaged attention, given by\n\\begin{equation}\n A' = \\frac{1}{z} A^{(T)} \\mathbf{1}_z.\n\\end{equation}\nThe third to ninth columns are the visualization of the regions corresponding to the learned patterns in $A^{(T)}$ (\\ie, the $i$-th row vectors of $A^{(T)}$ represents the appearance of the $i$-th learned pattern at the respective spatial location).\n\nFor (a) with category \\texttt{lock}, the support image is a small golden combination lock used for storage cabinets or post boxes. Among all 7 patterns, only pattern 5 shows a strong response, whereas the others are not observed. We can see that pattern 5 pays attention to the discs of the lock. It also gives a strong response at the words on the left which shows similar morphological characteristics. The query image of (a) is a black combination lock often used for bicycles. The attention maps show almost the same distributions as the support: Only pattern 5 has a response on the discs. From these visualizations, we can infer that pattern 5 represents periodical changes in colors. Although these two locks have different functions, MTUNet{} finds a shared pattern among them. \n\nFor (b), the support image is the gymnast wearing red. Multiple patterns are observed in the image. We can see that the visualization of pattern 1 identifies the part of the human body (head), and pattern 3 appears around the hands grabbing the horizontal bar. The query image is the gymnast in blue. Patterns 1 and 3 respond in a similar way to the support image. Patters 4 and 5 appear in the background and around other parts of the body, however their responses are relatively weak compared to patterns 1 and 3. Patterns 1 and 3 may responsible for human heads and hands grabbing the horizontal bar, lead to the successful classification of novel categories.\n\n\n\\begin{figure}[!t]\n\t\\centering\n\t\\includegraphics[width=.9\\columnwidth]{matrix.pdf}\n\t\\caption{Matching point matrix of one sampled task in mini-ImageNet. Row and column are consisted with the overall attention visualization for support and query of each category.}\n\t\\label{fig:score}\n\n\\end{figure}\n\n\n\\paragraph{Visualization of pairwise matching scores}\nFigure \\ref{fig:score} shows the visualization of the pairwise matching score of a 5-way 1-shot task over mini-ImageNet, compiled in a matrix. Through the pairwise matching module, an FSL task is cast into a binary classification problem. The output for each pair is a value between 0 to 1 due to the sigmoid function, whereas the scores are shown in percentage in the figure. The first row and the first column are the visualization of overall attention for the support and query images of each category.\n\nAmong all pairwise combinations, the combination of the support and query images of \\texttt{catamaran} makes the full score (100\\%). The visualization of overall attention covers the hulls, especially the masts, in both images, which are the main characteristics of this category, explaining the high score. Category \\texttt{goose} gets a low matching score. The query is a close-up of a goose on the ground from its front side, which captures the goose's blackhead or beak. The support image is an overall view of a goose about to fly from its backside. The visualization of overall attention captures the leg. With this combination, finding a shared pattern may not be easy, although these two extracted patterns are both representative parts of a bird. This problem stems from the difference in viewing angles, which can be relieved in 5-shot tasks, giving more supports from different viewing angles. Surprisingly, the query image for \\texttt{goose} gets 81\\% for the support image for \\texttt{beetle}. This may suggest that one of the patterns responds to black regions and this pattern is solely used as the clue of \\texttt{goose}. This is a negative result for FSL tasks but clearly demonstrates MTUNet{}'s explainability on the relationship between visual patterns and the pairwise matching scores.\n\n\\subsection{Discussion}\\label{sec:discussion}\n\n\\begin{figure}[!t]\n\t\\centering\n\t\\includegraphics[width=1.0\\columnwidth]{ablation.pdf}\n\t\\caption{Results of patterns number settings for mini-ImageNet, tiered-ImageNet, and CIFAR-FS. The horizontal axis represents the number of patterns and the vertical axis represents the average accuracy. We report all the results with 10,000 sampled 5-way episodes in the novel test set.}\n\t\\label{fig:ablation}\n\n\\end{figure}\n\n\\begin{figure}[!t]\n\t\\centering\n\t\\includegraphics[width=0.9\\columnwidth]{scatter.pdf}\n\t\\caption{Performance of 50 turns random categories sampling for PE pre-training with 7 patterns. All the experiments are implemented in mini-ImageNet using ResNet-18 as the backbone. Result of the sample for our experiments is marked in green.}\n\t\\label{fig:scatter}\n\n\\end{figure}\n\n\\paragraph{The number $z$ of patterns.} The number of patterns can be another crucial factor for MTUNet{}. Intuitively, a larger $z$ makes the model more discriminative. To show the impact of $z$, we uniformly sample categories in $\\mathcal{C}_\\text{base}$ (\\ie, default as sampling every $I$ categories from the category list, where $I=10, 8, 7, 5, 4, 3, 2,$ and $1$); thus, $I=1$ ends up with using all categories in $\\mathcal{C}_\\text{base}$. \n\nThe test accuracies are shown in Figure \\ref{fig:ablation} for 5-way 1-shot and 5-way 5-shot tasks in 10,000 sampled episodes over $\\mathcal{D}_\\text{test}$ of the three datasets. The horizontal axis represents the number of patterns and the vertical axis represents the average accuracy. Interestingly, the results show no clear tendency with respect to $z$. We would say that the performance is slightly decreased in mini-ImageNet with a larger $z$, whereas slightly increased in CIFAR-FS. For tiered-ImageNet, when setting $I$ as 1 and use all 351 base categories for patterns, the PE module can not be trained successfully. This situation is also reported in \\cite{li2020scouter}. Other settings also show no obvious differences. In general, tuning over $z$ may help gain performance, but its impact is not significant. \n\n\\paragraph{Selection of categories for training PE.}\nOur PE module is supposed to learn common visual patterns. We use images of a certain subset of categories in $\\mathcal{C}_\\text{base}$ to learn such patterns in our experiments. The selection of this subset thus affects the performance of downstream FSL tasks. To clarify the impact of the choice of the subset, we randomly sample seven categories in $\\mathcal{C}_\\text{base}$ of mini-ImageNet for 50 times and use the corresponding images for training PE on top of ResNet-18. The trained PE is used for training MTUNet{}, which is evaluated over 2,000 episodes of FSL tasks with both the validation and test sets. \n\nThe mean and the 95\\% confidence interval over the 50 test accuracies are 54.63\\% and 0.16\\%, respectively. This implies that our model benefits from a better choice of categories for training PE. For this choice, we only have access to the validation set; however, since the validation set and the test set have disjoint categories, the best choice for the validation set is not necessarily the best choice for the test set. Figure \\ref{fig:scatter} shows the scatter plot of the validation accuracies and corresponding test accuracies, over 50 different random samples of seven categories. The plot empirically shows that the validation and test accuracies are highly correlated to each other, with Pearson's correlation coefficient of 0.64. This leads to the conclusion that, at least for mini-ImageNet, we can use the validation set to find the better choice. The green square in the plot is the choice that we adopted in our experiments, which shows that it is a better choice but not the best. \n\n\n\n\\section{Conclusion}\nIn this paper, we propose MTUNet{} designed for explainable FSL. We achieved comparable performance on three benchmark datasets and qualitatively demonstrated its strong explainability through patterns in images. The approach taken in our model might be analogous to human beings as we usually try to find shared patterns when making a match between images of an object that one has never seen before. This can be advantageous as the explanation given by MTUNet{} can provide an intuitive interpretation of what the model actually does. Our future work includes testing our model in a practical application scenario of FSL, such as computer-assisted diagnoses. \n\n\\section{Acknowledgements}\nThis work was supported by Council for Science, Technology and Innovation (CSTI), cross-ministerial Strategic Innovation Promotion Program (SIP), ``Innovative AI Hospital System'' (Funding Agency: National Institute of Biomedical Innovation, Health and Nutrition (NIBIOHN)). This work was also supported by JSPS KAKENHI Grant Number 19K10662 and 20K23343.\n\n\n{\\small\n\\bibliographystyle{ieee_fullname}\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\n\nThe electromagnetic spectrum of an open optical system is characterized by its resonances, which is evident for optical cavities such as dielectric toroid~\\cite{ArmaniN03} or micro-sphere resonators~\\cite{CollotEPL93}. Resonances are characterized by their spectral positions and linewidths, corresponding to, respectively, the real and imaginary part of the complex eigenfrequencies of the system. Finite linewidths of resonances are typical for open systems and are due to energy leakage from the system to the outside. Objects in close proximity of the cavity modify the electromagnetic susceptibility and perturb the cavity resonances, changing both their position and linewidth, most noticeably for the high-quality (i.e. narrow-linewidth) resonances. This effect is the basis for resonant optical biosensors~\\cite{VollmerNMe08,LuttiAPL08,ChantadaJOSAB08} in which the changes in the spectral properties of resonators in the presence of perturbations can be used to characterize the size and shape of attached nanoparticles~\\cite{ZhuNPho10}. The whispering gallery mode (WGM) resonances in microdisks and spherical microcavities have been used in sensors for the characterization of nanolayers~\\cite{NotoOL05}, protein~\\cite{VollmerAPL02} and DNA molecules~\\cite{VollmerBJ03}, as well as for single atom~\\cite{RosenblitPRA04} and nanoparticle detection~\\cite{HeNNa11,AltonNP13}.\nFurthermore, the long photon lifetime of WGMs can result in their strong coupling to atoms~\\cite{VernooyPRA98}.\nRecently, optical resonances have become the core element of a more accurate modeling of multimode and random lasers \\cite{TureciS08,HischPRL13} and of light propagation through random media~\\cite{WangN11}.\nIn nanoplasmonics, the resonances of metal nanoparticles are used to locally enhance the electromagnetic field~\\cite{DanthamNL13}.\n\nDue to the lack of a suited theory, the electromagnetic properties of such open systems were up to now modeled by using finite element method (FEM) and finite difference in time domain (FDTD) solvers. Only recently, approximate approaches using resonance modes have been reported~\\cite{TureciPRA06,RubinPRA10,WiersigPRA12,SauvanPRL13,VialPRA14}. While the eigenmodes of resonators for a few highly symmetric geometries can be calculated exactly, determining the effect of perturbations which break the symmetry presents a significant challenge as the popular computational techniques in electrodynamics, such as the FDTD~\\cite{TafloveBook00} or FEM~\\cite{WiersigJOA03}, need large computational resources~\\cite{BoriskinJOSAA08} to model high quality WGMs.\n\nTo treat such perturbations more efficiently, we have developed~\\cite{MuljarovEPL10} a rigorous perturbation theory called resonant state expansion (RSE) and applied it to spherical resonators reducible to effective one-dimensional (1D) systems. We have demonstrated on exactly solvable examples in 1D that the RSE is a reliable tool for calculation of wavenumbers and electromagnetic fields of resonant states (RSs)~\\cite{DoostPRA12}, as well as transmission and scattering properties of open optical systems. We have recently developed the RSE also for effectively two-dimensional (2D) systems~\\cite{DoostPRA13}, and planar waveguides~\\cite{LewisARX13}.\n\nIn this paper we extend the RSE formulation to arbitrary three-dimensional (3D) open optical systems, compare its performance with FDTD and FEM, and introduce a local perturbation approach. The paper is organized as follows. In \\Sec{sec:RSE} we give the general formulation of the RSE for an arbitrary 3D system. In \\Sec{sec:Sphere} we treat the homogeneous dielectric sphere as unperturbed system and introduce the basis for the RSE, which consists of normalized transverse electric (TE) and transverse magnetic (TM) modes and is complemented by longitudinal zero frequency modes. This is followed by examples given in \\Sec{sec:application3D} A--C illustrating the method and comparing results with existing analytic solutions, as well as numerical solutions provided by using available commercial software. In \\Sec{subsec:local} we demonstrate the performance of the RSE as a local perturbation method for a chosen group of modes by introducing a way to select a suitable subset of basis states. Some details of the general formulation of the method including mode normalization and calculation of the matrix elements are given in Appendices A and B.\n\\section{Resonant state expansion}\\label{sec:RSE}\nResonant states of an open optical system with a local time-independent dielectric susceptibility tensor $\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})$ and permeability $\\mu=1$ are defined as the eigensolutions of Maxwell's wave equation,\n\\begin{equation}\n\\label{me3D}\n\\nabla\\times\\nabla\\times\\mathbf{E}_n(\\mathbf{r})=k_n^2\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})\\mathbf{E}_n(\\mathbf{r})\\,,\n\\end{equation}\nsatisfying the {\\it outgoing wave} boundary conditions. Here, $k_n$ is the wave-vector eigenvalue of the RS numbered by the index $n$, and $\\mathbf{E}_n(\\mathbf{r})$ is its electric field eigenfunction in 3D space. The time-dependent part of the RS wave function is given by $\\exp(-i\\omega_n t)$ with the complex eigenfrequency $\\omega_n=c k_n$, where $c$ is the speed of light in vacuum. As follows from \\Eq{me3D} and the divergence theorem, the RSs are orthogonal according to\n \\begin{eqnarray}\n0&=&(k_{n'}^2-k_{n}^2)\\int _V d{\\bf r}\\mathbf{E}_n(\\mathbf{r})\\cdot \\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})\\mathbf{E}_{n'}(\\mathbf{r})\\nonumber\\\\\n&&+\\oint _{S_V} dS \\left(\\mathbf{E}_n\\cdot\\frac{\\partial\\mathbf{E}_{n'}}{\\partial s}-\\mathbf{E}_{n'}\\cdot\\frac{\\partial\\mathbf{E}_n}{\\partial\ns}\\right)\\,,\n \\label{orthog}\n \\end{eqnarray}\nwhere the first integral in Eq.\\,(\\ref{orthog}) is taken over an arbitrary simply connected volume $V$ which includes all system inhomogeneities of $\\hat{\\boldsymbol{\\varepsilon}}({\\bf r})$ while the second integral is taken over the closed surface $S_V$, the boundary of $V$, and contains the gradients $\\partial\/\\partial s$ normal to this surface.\n\nThe RSs of an open system form a complete set of functions. This allows us to use RSs for expansion of the Green's function (GF) $\\hat{\\mathbf{G}}_k(\\mathbf{r},\\mathbf{r}')$ satisfying the same outgoing wave boundary conditions and Maxwell's wave equation with a delta function source term,\n\\begin{equation}\n- \\nabla\\times\\nabla\\times \\hat{\\mathbf{G}}_k(\\mathbf{r},\\mathbf{r}')+k^2\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})\\hat{\\mathbf{G}}_k(\\mathbf{r},\\mathbf{r}')=\\hat{\\mathbf{1}}\\delta(\\mathbf{r}-\\mathbf{r}')\\,,\n \\label{GFequ}\n\\end{equation}\nwhere $\\hat{\\mathbf{1}}$ is the unit tensor and $k=\\omega\/c$ is the wave vector of the electromagnetic field in vacuum determined by the frequency $\\omega$, which is in general complex. The GF expansion in terms of the direct (dyadic) product of the RS vector fields is given by Ref.\\cite{DoostPRA13}\n\\begin{equation} \\hat{\\mathbf{G}}_k(\\mathbf{r},\\mathbf{r}')=\\sum _n\\frac{\\mathbf{E}_n(\\mathbf{r})\\otimes\\mathbf{E}_n(\\mathbf{r}')}{2 k(k-k_n)}\\,.\n\\label{ML4}\\end{equation}\nThis expansion requires that the RSs are normalized according to\n\\begin{eqnarray} \\label{normaliz}\n1+\\delta_{k_n,0}&=&\\int_V d{\\bf r}\\mathbf{E}_n(\\mathbf{r})\\cdot\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})\\mathbf{E}_n(\\mathbf{r})\\\\\n && +\\lim_{k\\to k_n}\\frac{\\displaystyle \\oint _{S_V} dS\n\\left(\\mathbf{E}_n\\cdot\\frac{\\partial\\mathbf{E}}{\\partial s}-\\mathbf{E}\\cdot\\frac{\\partial\\mathbf{E}_n}{\\partial\ns}\\right)}{k^2-k_n^2}\\,,\n\\nonumber\n \\end{eqnarray}\nwhere ${\\bf E}(k, \\mathbf{r})$ is an analytic continuation of the RS wave function $\\mathbf{E}_n(\\mathbf{r})$ around the point $k_n$ in the complex $k$-plane and $\\delta_{k_n,0}$ is the Kronecker delta accounting for a factor of two in the normalization of $k_n=0$ modes.\nFor any spherical surface $S_R$ of radius $R$, the limit in \\Eq{normaliz} can be taken explicitly leading for $k_n\\neq0$ modes to\n\\begin{equation}\n\\!1\\!\\!=\\!\\!\\int_{V_R} \\!\\!\\!\\!d{\\bf r}\\mathbf{E}_n\\cdot\\hat{\\boldsymbol{\\varepsilon}}\\mathbf{E}_n+\\frac{1}{2k^2_n}\\oint_{S_R}\\!\\!\\!\\! dS \\left[\\mathbf{E}_n\\!\\cdot\\!\\frac{\\partial}{\\partial r}r\\frac{\\partial\\mathbf{E}_n}{\\partial r}-r\\!\\left(\\frac{\\partial \\mathbf{E}_n}{\\partial r}\\right)^{\\!2}\\! \\right]\n\\label{normk}\n\\end{equation}\nwhere $r=|\\mathbf{r}|$, with the origin at the center of the chosen sphere. Static $k_n=0$ modes, if they exist in the GF spectrum, are normalized according to\n\\begin{equation}\n2=\\int\\!\\!d{\\bf r}\\mathbf{E}_n\\cdot\\hat{\\boldsymbol{\\varepsilon}}\\mathbf{E}_n\\,.\n\\label{normk0}\n\\end{equation}\nTheir wave functions decay at large distances as $1\/r^2$ or quicker, and the volume of integration in \\Eq{normaliz} can be extended to the full space for which the surface integral is vanishing. The proofs of Eqs.\\,(\\ref{normaliz}) and (\\ref{normk}) are given in Appendix A.\n\nThe completeness of RSs allows us to treat exactly a modified (perturbed) problem\n\\begin{equation}\n\\label{me3Dpert}\n\\nabla\\times\\nabla\\times\\mbox{\\boldmath ${\\cal E}$}\\hspace*{-1.5pt}_\\nu(\\mathbf{r})=\\varkappa_\\nu^2\\bigl[\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})+\\Delta\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})\\bigr]\\mbox{\\boldmath ${\\cal E}$}\\hspace*{-1.5pt}_\\nu(\\mathbf{r})\\,,\n\\end{equation}\nin which the RS wave vector $\\varkappa_\\nu$ and the electric field $\\mbox{\\boldmath ${\\cal E}$}\\hspace*{-1.5pt}_\\nu$ are modified as compared to $k_n$ and $\\mathbf{E}_n$, respectively, due to a perturbation $\\Delta\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})$ with compact support. We treat this problem by (i) solving \\Eq{me3Dpert} with the help of the GF,\n\\begin{equation}\n\\mbox{\\boldmath ${\\cal E}$}\\hspace*{-1.5pt}_\\nu(\\mathbf{r})=-\\varkappa_\\nu^2 \\int d{\\bf r}' \\hat{\\mathbf{G}}_{\\varkappa_\\nu}(\\mathbf{r},\\mathbf{r}')\\Delta\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r}')\\mbox{\\boldmath ${\\cal E}$}\\hspace*{-1.5pt}_\\nu(\\mathbf{r}')\\,,\n\\label{GFsol}\n\\end{equation}\n(ii) using in \\Eq{GFsol} the spectral representation \\Eq{ML4},\n\\begin{equation}\\label{GFexpansion} \\mbox{\\boldmath ${\\cal E}$}\\hspace*{-1.5pt}_\\nu(\\mathbf{r}) = -\\varkappa_\\nu^2\\sum_n\\mathbf{E}_n(\\mathbf{r})\\frac{\\int d{\\bf r}'\\mathbf{E}_n(\\mathbf{r}')\\cdot\\Delta\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r}') \\mbox{\\boldmath ${\\cal E}$}\\hspace*{-1.5pt}_\\nu(\\mathbf{r}') }{2\\varkappa_\\nu(\\varkappa_\\nu - k_n)}\\,,\\end{equation}\nand (iii) expanding\nthe perturbed wave functions into the unperturbed ones,\n\\begin{equation} \\mbox{\\boldmath ${\\cal E}$}\\hspace*{-1.5pt}_\\nu(\\mathbf{r}) = \\sum _n b_{n\\nu} \\mathbf{E}_n(\\mathbf{r})\\,.\n\\label{expansion}\n\\end{equation}\nThis is the {\\it RSE method}. The use of the of the unperturbed GF is an essential element of the RSE as \\Eq{GFsol} guarantees that the perturbed wave functions satisfy the outgoing boundary condition. The result of using \\Eq{expansion} in \\Eq{GFexpansion} is\na linear matrix eigenvalue problem\n\\begin{equation} \\varkappa_\\nu\\sum _{n'} (\\delta_{nn'}+V_{nn'}\/2)b_{n'\\nu}=k_n b_{n\\nu}\\,, \\label{RSE1}\n\\end{equation}\nwhich is reduced, using a substitution $b_{n\\nu}=c_{n\\nu}\\sqrt{\\varkappa_\\nu\/k_n}$\\,, to the matrix equation~\\cite{MuljarovEPL10}\n\\begin{equation} \\sum _{n'}\n\\left(\\frac{\\delta_{nn'}}{k_n}+\\frac{V_{nn'}}{2\\sqrt{k_n k_{n'}}}\\right)\nc_{n'\\nu}=\\frac{1}{\\varkappa_\\nu} c_{n\\nu}\\,. \\label{RSE} \\end{equation}\nThis allows us to find the wave vectors $\\varkappa_\\nu$ and the expansion coefficients $c_{n\\nu}$ of the perturbed RSs by diagonalizing a complex symmetric matrix. The matrix elements of the perturbation are given by\n\\begin{equation} V_{nn'}=\\int \\mathbf{E}_n(\\mathbf{r})\\cdot\\Delta\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})\\mathbf{E}_{n'}(\\mathbf{r})\\,d \\mathbf{r}\\,. \\label{Vnm} \\end{equation}\n\nIn our previous works on RSE~\\cite{MuljarovEPL10,DoostPRA13} we derived the intermediate result \\Eq{GFexpansion} using Dyson's equation for the perturbed GF. The present way to obtain \\Eq{GFexpansion} is equivalent, but is simplifying the treatment by not dealing explicitly with the perturbed GF. We note that in 2D systems the set of RSs of a system is complemented with a continuum of states on the cut of the GF~\\cite{DoostPRA13}. In this case, all summations in the above equations include states on the cut which are discretized in numerics to produce a limited subset of isolated poles.\n\n\n\n\\section{Eigenmodes of a dielectric sphere as basis for the RSE}\\label{sec:Sphere}\n\nTo apply the RSE to 3D systems we need a known basis of RSs. We choose here the RSs of a dielectric sphere of radius $R$ and refractive index $n_R$, surrounded by vacuum, since they are analytically known.\nFor any spherically symmetric system, the solutions of Maxwell's equations split into four groups: TE, TM, and longitudinal electric (LE) and longitudinal magnetic (LM) modes~\\cite{StrattonBook41}. TE (TM) modes have no radial components of the electric (magnetic) field, respectively. Longitudinal modes are curl free static modes satisfying Maxwell's wave equation for $k_n=0$. Longitudinal magnetic modes have zero electric field, and since we limit ourself in this work to perturbations in the dielectric susceptibility only, they are not mixed by the perturbation to other types of modes and are thus ignored in the following. Furthermore, owing to the spherical symmetry, the azimuthal index $m$ and longitudinal index $l$ are good quantum numbers of the angular momentum operator and take integer values corresponding to the number of field oscillations around the sphere. For each $l$ value there are $2l+1$ degenerate modes with $m=-l..l$.\n\nSplitting off the time dependence $\\propto e^{-i\\omega t}$ of the electric fields ${\\bf E}$ and ${\\bf D}$ and magnetic field ${\\bf H}$, the first pair of Maxwell's equations can be written in the form\n\\begin{equation}\n\\nabla\\times\\mathbf{E}=i k {\\bf H}\\,,\\ \\ \\ \\ \\ \\nabla\\times{\\bf H}=-i k {\\bf D}\n\\label{MEpair1}\n\\end{equation}\nwhere $k=\\omega\/c$ and ${\\bf D}(\\mathbf{r})=\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r}){\\bf E}(\\mathbf{r})$. Combining them leads to \\Eq{me3D} for the RSs and to \\Eq{GFequ} for the corresponding GF. For $k\\neq0$ states the second pair of Maxwell's equations,\n\\begin{equation}\n\\nabla\\cdot {\\bf D}=0\\,\\ \\ \\ {\\rm and }\\ \\ \\ \\nabla\\cdot {\\bf H}=0\\,,\n\\label{MEpair2}\n\\end{equation}\nis automatically satisfied, since $\\nabla\\times\\nabla=0$. However, if $k=0$, it is not guaranteed that solutions of \\Eq{MEpair1} satisfy also \\Eq{MEpair2}. The spectrum of the GF given by \\Eq{ML4} however includes all modes obeying \\Eq{MEpair1}, no matter whether \\Eq{MEpair2} is satisfied of not. We find that the LE modes actually do not satisfy \\Eq{MEpair2} on the sphere surface, such that Maxwell's boundary condition of continuity of the normal component of ${\\bf D}$ across the boundary of the dielectric sphere is not fulfilled. The LE modes are therefore just formal solutions of \\Eq{me3D} not corresponding to any physical modes of the system. However, they have to be taken into account for the completeness of the basis used in the RSE.\n\nFollowing \\Onlinecite{StrattonBook41}, the three groups of modes of a homogeneous dielectric sphere can be written as\n\\begin{eqnarray}\n{\\rm TE:}&\\mathbf{E}=-\\mathbf{r}\\times \\nabla f\\ & \\mbox{and}\\ \\ i{\\bf H}=\\frac{\\nabla\\times\\mathbf{E}}{k}\\,, \\nonumber\\\\\n{\\rm TM:} & i{\\bf H}=-\\mathbf{r}\\times \\nabla f & \\mbox{and}\\ \\ {\\bf E}=\\frac{\\nabla\\times i{\\bf H}}{\\varepsilon k}\\,,\n\\\\\n{\\rm LE:}&\\mathbf{E}=-\\nabla f &\\mbox{and}\\ \\ {\\bf H}=0\\,, \\nonumber\n\\end{eqnarray}\nwhere $f(\\mathbf{r})$ is a scalar function satisfying the Helmholtz equation\n\\begin{equation}\n\\nabla^2 f+k^2\\varepsilon f=0\\,,\n\\label{Helm}\n\\end{equation}\nwith the permeability of the dielectric sphere in vacuum given by\n\\begin{equation}\n\\varepsilon(r)= \\left\\{\n\\begin{array}{cl}\nn_R^2 & {\\rm for}\\ \\ r\\leqslant R \\\\\n1 & {\\rm for}\\ \\ r>R\\,.\\\\\n\\end{array} \\right.\n\\label{eps}\n\\end{equation}\nOwing to the spherical symmetry of the system, the solution of \\Eq{Helm} splits in spherical coordinates \\mbox{$\\mathbf{r}=(r,\\theta,\\varphi)$} into the radial and angular components:\n\\begin{equation}\nf(\\mathbf{r})=R_l(r,k)Y_{lm}(\\Omega)\\,,\n\\end{equation}\nwhere $\\Omega=(\\theta,\\varphi)$ with the angle ranges $0\\leqslant \\theta \\leqslant\\pi$ and $0\\leqslant\\varphi\\leqslant 2\\pi$. The angular component is given by the spherical harmonics,\n\\begin{equation}\\label{Spherical_Harmonic} Y_{lm}(\\Omega) = \\sqrt{\\frac{2l+1}{2}\\frac{(l-|m|)!}{(l+|m|)!}}P^{|m|}_{l}(\\cos\\theta)\\chi_m(\\varphi)\\,, \\end{equation}\nwhich are the eigenfunctions of the angular part of the Laplacian,\n\\begin{equation}\n\\hat{\\Lambda}(\\Omega) Y_{lm}(\\Omega)=-l(l+1)Y_{lm}(\\Omega)\\,,\n\\end{equation}\nwhere $P^m_l(x)$ are the associated Legendre polynomials.\nNote that the azimuthal functions are defined here as\n\\begin{equation} \\chi_m(\\varphi)=\\left\\{\n\\begin{array}{lll}\n\\pi^{-1\/2}\\sin(m\\varphi) & {\\rm for} & m<0\\, \\\\\n(2\\pi)^{-1\/2} & {\\rm for} & m=0\\, \\\\\n\\pi^{-1\/2}\\cos(m\\varphi) & {\\rm for} & m>0\\,,\n\\end{array}\n\\right. \\label{chi-n} \\end{equation}\nin order to satisfy the orthogonality condition without using the complex conjugate, as required by \\Eq{orthog}.\nThe radial components $R_l(r,k)$ satisfy the spherical Bessel equation,\n\\begin{equation}\n\\left [\\frac{d^2}{dr^2}+\\frac{2}{r}\\frac{d}{dr}-\\frac{l(l+1)}{r^2}+\\varepsilon(r) k^2\\right] R_l(r,k) =0\n\\end{equation}\nand have the following form\n\\begin{equation}\nR_l(r,k)= \\left\\{\n\\begin{array}{lll}\nj_l(n_R k r)\/j_l(n_R k R) & {\\rm for} & r\\leqslant R\\, \\\\\nh_l(kr)\/h_l(kR) & {\\rm for} & r>R\\,, \\\\\n\\end{array}\n\\label{R-analyt} \\right. \\end{equation}\nin which $j_l(z)$ and $h_l(z)\\equiv h_l^{(1)}(z)$ are, respectively, the spherical Bessel and Hankel functions of the first kind.\n\nIn spherical coordinates, a vector field $\\mathbf{E}(\\mathbf{r})$ can be written as\n$$ \\mathbf{E}(r,\\theta,\\varphi)=E_{r}{\\bf e}_r+E_{\\theta}{\\bf e}_{\\theta}+E_{\\varphi}{\\bf e}_{\\varphi}= \\begin{pmatrix}\nE_{r} \\\\\nE_{\\theta}\\\\\nE_{\\varphi}\\\\\n\\end{pmatrix}\\,,\n$$\nwhere ${\\bf e}_r$, ${\\bf e}_{\\theta}$, and ${\\bf e}_{\\varphi}$ are the unit vectors. The electric field of the RSs then has the form\n\n\\noindent\n\\begin{equation}\\mathbf{E}^{\\rm TE}_n(\\mathbf{r})=A_l^{\\rm TE}R_l(r,k_n)\\begin{pmatrix}\n0\\\\[5pt]\n\\dfrac{1}{\\sin\\theta}\\dfrac{\\partial}{\\partial\\varphi}Y_{lm}(\\Omega)\\\\[10pt]\n-\\dfrac{\\partial}{\\partial\\theta}Y_{lm}(\\Omega)\\\\\n\\end{pmatrix} \\label{eqn:E_TE} \\end{equation}\nfor TE modes,\n\\begin{equation} \\mathbf{E}^{\\rm TM}_n(\\mathbf{r})=\\dfrac{A_l^{\\rm TM}(k_n)}{\\varepsilon(r) k_n r}\\left(\n\\begin{array}{ccc}\nl(l+1)R_l(r,k_n)Y_{lm}(\\Omega)\\\\[5pt]\n\\dfrac{\\partial}{\\partial r} r R_l(r,k_n)\\dfrac{\\partial}{\\partial\\theta}Y_{lm}(\\Omega)\\\\[10pt]\n\\dfrac{\\partial}{\\partial r} \\dfrac{r R_l(r,k_n)}{\\sin\\theta}\\dfrac{\\partial}{\\partial\\varphi}Y_{lm}(\\Omega)\\\\\n\\end{array}\n\\right) \\label{eqn:E_TM} \\end{equation}\nfor TM modes, and\n\\begin{equation} \\mathbf{E}^{\\rm LE}_n(\\mathbf{r})=A^{\\rm LE}_l \\begin{pmatrix}\n\\dfrac{\\partial}{\\partial r} R_l(r,0)Y_{lm}(\\Omega) \\\\[10pt]\n\\dfrac{R_l(r,0)}{r}\\dfrac{\\partial}{\\partial\\theta}Y_{lm}(\\Omega)\\\\[10pt]\n\\dfrac{R_l(r,0)}{r\\sin\\theta}\\dfrac{\\partial}{\\partial\\varphi}Y_{lm}(\\Omega)\\\\\n\\end{pmatrix}\\,\\label{eqn_E_LE} \\end{equation}\nfor LE modes. All the wave functions are normalized according to Eqs.\\,(\\ref{normaliz})--(\\ref{normk0}), leading to the following normalization constants:\n\\begin{eqnarray}\nA^{\\rm TE}_{l}&=&\\sqrt{\\frac{2}{l(l+1)R^3(n_R^2-1)}}\\,,\\nonumber\\\\\n\\frac{n_R A^{\\rm TE}_{l} }{A^{\\rm TM}_{l}(k)}&=&\\sqrt{\\left[\\frac{j_{l-1}(n_R kR)}{j_l(n_R kR)}-\\frac{l}{n_R kR}\\right]^2+\\frac{l(l+1)}{k^2R^2}}\\,,\\nonumber\\\\\nA^{\\rm LE}_{l}&=&\\sqrt{\\frac{2}{R(n_R^2 l+l+1)}}\\,.\n\\label{A-norm}\n\\end{eqnarray}\n\nThe Maxwell boundary conditions following from \\Eq{MEpair1}, namely the continuity of the tangential components of ${\\bf E}$ and ${\\bf H}$ across the spherical dielectric-vacuum interface, lead to the following secular equations determining the RS wavenumbers $k_n$:\n\\begin{equation}\n\\frac{n_R j_l'(n_R z)}{j_l(n_R z)}-\\frac{h_l'(z)}{h_l(z)}=0\\,\n\\label{secularTE}\n\\end{equation}\nfor TE modes and\n\\begin{equation}\n\\frac{n_Rj_l'(n_Rz)}{j_l(n_Rz)}-\\frac{n^{2}_{R}h_l'(z)}{h_l(z)}-\\frac{n^{2}_{R}-1}{z}=0\\,\\label{secularTM}\n\\end{equation}\nfor TM modes, where $z=k_nR$ and $j_l'(z)$ and $h_l'(z)$ are the derivatives of $j_l(z)$ and $h_l(z)$, respectively. While the LE modes are the RSs easiest to calculate due to a simple power-law form of their radial functions,\n\\begin{equation}\nR_l(r,0)= \\left\\{\n\\begin{array}{lll}\n(r\/R)^l & {\\rm for} & r\\leqslant R \\\\\n(R\/r)^{l+1} & {\\rm for} & r>R\\,, \\\\\n\\end{array}\n\\label{R0} \\right.\n\\end{equation}\nit is convenient to treat them in the RSE as part of the TM family of RSs. Indeed, for $r \\leqslant R$ they coincide\nwith the TM modes taken in the limit $k_n\\to 0$:\n\\begin{equation}\n\\mathbf{E}_n^{\\rm LE}(\\mathbf{r})=\\sqrt{l(n_R^2-1)} \\lim_{k_n\\to 0}\\mathbf{E}_n^{\\rm TM}(\\mathbf{r})\\,.\n\\label{TM2TE}\\end{equation}\nNote that $k_n=0$ is not a solution of the secular equation (\\ref{secularTM}) for TM modes. However, using the analytic dependence of the wave functions of TM modes on $k_n$ [see Eqs.\\,(\\ref{R-analyt}), (\\ref{eqn:E_TM}), and (\\ref{A-norm})], the limit \\Eq{TM2TE} can be taken in the calculation of the matrix elements containing LE modes. The same limit $k_n\\to 0$ has to be carefully approached in the matrix eigenvalue problem \\Eq{RSE} of the RSE, as the matrix elements are divergent, due to the $1\/\\sqrt{k_n}$ factor introduced in the expansion coefficients.\nWe found that adding a finite negative imaginary part to static poles, $k_nR=-i\\delta$, with $\\delta$ typically of order $10^{-7}$ (determined by the numerical accuracy) is suited for the numerical results presented in the following section. We have verified this by comparing the results with the ones of the RSE in the form of a generalized linear eigenvalue problem \\Eq{RSE1}, which has no such divergence, but its numerical solution is a factor of 2-3 slower in the NAG library implementation.\n\n\\section{Application to 3D systems with scalar dielectric susceptibility}\\label{sec:application3D}\n\nIn this section we discuss the application of the RSE to 3D systems described by a scalar dielectric function $\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})+\\Delta\\hat{\\boldsymbol{\\varepsilon}}(\\mathbf{r})=\\hat{\\mathbf{1}} [\\varepsilon(r)+\\Delta\\varepsilon(\\mathbf{r})]$. As unperturbed system we use the homogeneous dielectric sphere of radius $R$ with $\\varepsilon(r)$ given by \\Eq{eps}, having the analytical modes discussed in \\Sec{sec:Sphere}.\nWe use the refractive index $n_R=2$ of the unperturbed sphere throughout this section and consider several types of perturbations, namely, a homogeneous perturbation of the whole sphere in \\Sec{sec:Hom}, a half-sphere perturbation in \\Sec{sec:Halfmoon}, and a quarter-sphere perturbation in \\Sec{sec:quartermoon}. We demonstrate in \\Sec{subsec:local} the performance of the RSE as a local perturbation method for a chosen group of modes by introducing a way to select a suitable subset of basis states. Explicit forms of the matrix elements used in these calculations are given in Appendix B.\n\n\\begin{figure}[t]\n\\includegraphics*[width=\\columnwidth]{FIG1}\n\\caption{TM RSs with $l=5$ (and a fixed $m$) for the homogeneous perturbation \\Eq{eps-hom} with $\\Delta\\epsilon=5$. (a) perturbed RSs wavenumbers calculated using RSE with $N=1000$ with (+) and without ($\\times$) the LE mode, as well as using the exact secular equation (open squares). The wavenumbers of the unperturbed system are shown as open circles with dots. Inset: Dielectric constant profile of the unperturbed (black line) and perturbed (red line) systems. (b) Relative error of the perturbed wavenumbers calculated with (+) and without ($\\times$) contribution of the LE mode, as well as with the LE mode and extrapolation (crossed heptagons). }\\label{fig:F1}\n\\end{figure}\n\n\\begin{figure}[t]\n\\includegraphics*[width=\\columnwidth]{FIG2}\n\\caption{As \\Fig{fig:F1} but for TE RSs, for which the LE modes have no influence.}\\label{fig:F2}\n\\end{figure}\n\n\\subsection{Homogeneous sphere perturbation}\n\\label{sec:Hom} The perturbation we consider here is a homogeneous change of\n$\\varepsilon$ over the whole sphere, given by\n\\begin{equation} \\Delta\\varepsilon(\\mathbf{r})=\\Delta\\epsilon\\Theta(R-r)\\,,\n\\label{eps-hom}\n\\end{equation}\nwhere $\\Theta$ is the Heaviside function, with the strength $\\Delta\\epsilon=5$ used in the numerical calculation. For\nspherically symmetric perturbations, RSs of different angular quantum numbers $(l,m)$, and different transverse polarizations are not mixed, and are denenerate in $m$. We show here for illustration the $l=5$ modes. The matrix elements of the perturbation \\Eq{eps-hom} are given by Eqs.(\\ref{App:TE1})--(\\ref{App:F}) of Appendix B. The homogeneous perturbation does not change the symmetry of the system, so that the perturbed modes obey the same secular equations \\Eq{secularTE} and \\Eq{secularTM} with the refractive index $n_R$ of the sphere changed to $\\sqrt{n_R^2+\\Delta\\epsilon}$, and the perturbed wavenumbers $\\varkappa_\\nu$ calculated using the RSE can be compared with the exact values $\\varkappa^{\\rm (exact)}_\\nu$ obtained from the secular equations.\n\nWe choose the basis of RSs for the RSE in such a way that for a given orbital number $l$ and $m$ we select all RSs with $|k_n|