# Domain-Specific Few-Shot Table Prompt Question Answering via Contrastive Exemplar Selection
## 3 Methodology
### Exemplar Retrieval Approach
\begin{table}
\begin{tabular}{c c} \hline \hline
**Models** & **Result** \\ \hline \multicolumn{3}{c}{Question-1} \\ The expansion joint device on the Dongdagou Bridge was evaluated at what time? \\ \hline \multirow{3}{*}{Golden} & SELECT ’Evaluation time’ FROM evaluate\_bridge\_part\_evaluation \\  & WHERE ’Bridge name’ = ’Dongdagou Bridge’ AND ’Bridge component \\  & name’ = “Expansion joint” \\ \hline \multirow{3}{*}{ZERO SHOT} & NOSQL \\ \hline \multirow{3}{*}{RANDOM} & SELECT ’Evaluation time’ FROM evaluate\_bridge\_part\_evaluation \\  & WHERE ’Bridge name’ = ’Dongdagou Bridge’ AND ’Bridge component \\  & code’ = “Expansion joint” \\ \hline \multirow{3}{*}{BM25} & SELECT SUM (’Evaluation time’) FROM \\  & evaluate\_bridge\_part\_evaluationWHERE’ Bridge name’ = ’Dongdagou \\  & Bridge’ AND ’Bridge component name’ = “Expansion joint” \\ \hline \multirow{3}{*}{EPR(Ours)} & SELECT ’Evaluation time’ FROM evaluate\_bridge\_part\_evaluation \\  & WHERE ’Bridge name’ = ’Dongdagou Bridge’ AND ’Bridge component \\  & name’ = “Expansion joint” \\ \hline \multirow{3}{*}{The minimum abnormal value collected for anchor cable gauge 28-9 on Yuehai Bridge is how much?} \\ \hline \multirow{3}{*}{Golden} & SELECT MIN (’The abnormal value collection amount’) FROM \\  & analy\_monitor\_type WHERE ’Bridge name’ = “Yuehai Bridge’ AND \\  & ‘Sensor name’ = “Anchor cable gauge 28-9” \\ \hline \multirow{3}{*}{ZERO SHOT} & SELECT MIN (’The abnormal value collection amount’) FROM \\  & analy\_monitor\_type WHERE ’Bridge code’ = “Yuehai Bridge” AND \\  & ‘Sensor code’ = “Anchor cable gauge 28-9” \\ \hline \multirow{3}{*}{RANDOM} & SELECT MIN (’The abnormal value collection amount’) FROM \\  & analy\_monitor\_type WHERE ’Bridge name’ = “Yuehai Bridge’ AND \\  & ‘Sensor code’ = “Anchor cable gauge 28-9” \\ \hline \multirow{3}{*}{BM25} & SELECT AVG (’The abnormal value collection amount’) FROM \\  & analy\_monitor\_type WHERE ’Bridge name’ = “Yuehai Bridge’ AND \\  & ‘Sensor name’ = “Anchor cable gauge 28-9” \\ \hline \multirow{3}{*}{EPR(Ours)} & SELECT MIN (’The abnormal value collection amount’) FROM \\  & analy\_monitor\_type WHERE ’Bridge name’ = “Yuehai Bridge’ AND \\  & ‘Sensor code’ = “Anchor cable gauge 28-9” \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Case analysis of comparative models on the SMI-SQL dataset. ### Model Performance

From the experimental results, it is evident that the exemplar retrieval method proposed in this paper achieved excellent performance on both the ESQL and SMI-SQL datasets, reaching comprehensive optimality. This section will summarize the method's performance and, to better illustrate the performance comparison of various strategies, visualize the experimental results on the two datasets. As shown in Figures 2 and 3, the method proposed in this paper achieved better results than other comparative methods on both ESQL and SMI-SQL tasks. The proposed strategy retrieval method can select exemplars that are close to the input question in terms of question type and semantics, thus effectively guiding the model output. In contrast, the random sampling method randomly selects exemplars from relevant samples, but its consistency with the current problem cannot be guaranteed, making its guidance relatively weak. The BM25 retrieval strategy only filters based on surface semantic relevance, and when the main subject of the problem changes, the relevance of the selected exemplars may decrease, leading to lower accuracy of the selected exemplars. The prompt retrieval strategy proposed in this paper relies on the large language model itself to score each exemplar and retrieves exemplars with high relevance through comparative learning as input, thus guiding the model output more efficiently during testing.