arXiv:2610.31966cs.CLOct 2026

Manuscript Offprint

arXiv:2610.31966

POS-Signature Demonstration Retrieval for In-Context Dependency Parsing

Muhammad Azam Afridi, Rajab Ali, Marco Passarotti

Abstract

Demonstrations for in-context learning are often retrieved by semantic similarity, which may be a poor proxy for relevance in structured prediction. We study demonstration selection for Universal Dependencies parsing with a POS-signature policy that represents sentences with weighted part-of-speech statistics and retrieves three length-compatible, gold-parsed examples from the labeled training split. We evaluate two open-weight language models without fine-tuning on all 2,077 sentences of the UD English Web Treebank test set, comparing the policy with shot- and format-matched fixed and semantic three-shot baselines, as well as zero-shot, chain-of-thought, and critique-refinement systems. POS-signature retrieval yields the highest labeled attachment score among the tested prompting systems for both models (72.4 and 73.2), outperforming semantic retrieval by 1.9 and 2.7 points; paired-bootstrap 95% confidence intervals exclude zero for both contrasts. Chain-of-thought and refinement comparisons vary across models. These exploratory results favor the tested POS-signature retrieval approach on English-EWT. We release the prompts, archived outputs, and evaluation code.

1 Introduction

Retrieval-based in-context learning commonly selects demonstrations whose text is semantically similar to the query (Liu et al., 2022). Demonstration selection can be viewed as a form of context engineering: selecting and organizing the information supplied to an LLM at inference time (Mei et al., 2025). Semantic proximity is useful for topic-sensitive tasks, but it may be a poor proxy for relevance when outputs depend on structure: sentences about different topics can share a POS pattern, while topically similar sentences can require different structural analyses.

Dependency parsing makes this distinction concrete. Given a tokenized sentence, a parser assigns every token a syntactic head and dependency relation, producing a rooted tree under an annotation scheme such as Universal Dependencies (UD; Nivre et al., 2016). Large language models can emit dependency and constituency structures, but their accuracy depends strongly on prompt design, demonstrations, and task decomposition (Tian et al., 2024; Ezquerro et al., 2025; Matsuda et al., 2025; Ginn and Palmer, 2025). We ask whether a POS-signature retrieval policy produces more accurate parses than general semantic retrieval under the same prompt scaffold and three-example budget.

Our policy uses a supervised Stanza tagger to predict the query’s POS sequence and represents it through weighted features of sentence length, POS composition, and adjacent POS transitions. It first restricts the labeled English-EWT training pool by length compatibility, then retrieves the three signatures with highest cosine similarity and inserts their gold parses as demonstrations. Predicted query tags control retrieval only and are not shown to the language model. Because the semantic baseline searches the full training pool, our central comparison evaluates complete retrieval policies rather than isolating the representation itself.

We compare six prompting conditions on all 2,077 English-EWT test sentences using OpenAI's gpt-oss-120b and Qwen's Qwen2.5-72B-Instruct, without fine-tuning. Fixed selection uses the same three training examples for every query, whereas POS-signature and semantic retrieval select query-specific examples using POS-pattern similarity with length filtering and sentence-embedding similarity, respectively. Fixed, POS-signature, and semantic few-shot conditions are shot- and format-matched; zero-shot, chain-of-thought (CoT), and critique-refinement provide broader system comparisons. The primary metric is token-weighted labeled attachment score (LAS) over 21,998 non-punctuation tokens, with paired sentence-bootstrap inference for designated contrasts.

POS-signature retrieval achieves the highest LAS among the tested prompting systems for both models; all four primary retrieval contrasts remain significant after Holm correction. CoT instead improves over zero-shot for gpt-oss but reduces accuracy for Qwen, showing a model-dependent difference between these bundled systems.

This paper makes three contributions:

  1. POS-signature demonstration retrieval: an interpretable policy that selects three gold-parsed examples using explicit POS statistics and length compatibility.

  2. Cross-model policy comparison: six conditions over the full English-EWT test split, including three shot- and format-matched demonstration policies.

  3. Evidence and diagnostics: exploratory retrieval-policy results across two models, alongside analyses of relation-level accuracy and changes introduced by refinement. We release all prompts, archived outputs, evaluation code, and reproduction instructions. 1^{1}

The reported LLM results can be reproduced from the archived outputs without additional model API calls. The findings are scoped to two hosted models, one English treebank, gold tokenization, and labeled in-domain demonstrations.

References (18)