  In nested Named entity recognition (NER), entities are nested with each
other, and thus requiring more data annotations to address. This leads to the
development of few-shot nested NER, where the prevalence of pretrained language
models with in-context learning (ICL) offers promising solutions. In this work,
we introduce an effective and innovative ICL framework for the setting of
few-shot nested NER. We improve the ICL prompt by devising a novel example
demonstration selection mechanism, EnDe retriever. In EnDe retriever, we employ
contrastive learning to perform three types of representation learning, in
terms of semantic similarity, boundary similarity, and label similarity, to
generate high-quality demonstration examples. Extensive experiments over three
nested NER and four flat NER datasets demonstrate the efficacy of our system.
