This repository contains our solution for the UNLP 2026 Shared Task on Multi-Domain Document Understanding.
Our system is a retrieval-augmented multiple-choice QA pipeline for Ukrainian PDF documents. Given a question with six answer options, it predicts:
- the correct answer (
A-F) - the supporting document
- the supporting page
The final approach combines:
- structure-aware PDF chunking
- dense retrieval over contextualized chunks
- reranking
- constrained answer generation from top reranked evidence
Our best submission achieved:
| Split | Score |
|---|---|
| Public leaderboard | 0.9452 |
| Private leaderboard | 0.9598 |
This was obtained with:
- Retriever:
Qwen3-Embedding-8B - Reranker:
Qwen3-Reranker-8Bfine-tuned on UA-SQuAD - Answer model:
Qwen3-32B-AWQ
We do not treat PDF pages as plain text.
Instead, each chunk includes:
- a document prefix with global context
- the heading path / section context
- the local chunk body
Final chunking settings used in the strongest setup:
max_tokens = 512overlap_tokens = 64doc_prefix_tokens = 128
This preserves document-level structure and gives each chunk enough context to be retrievable on its own.
We use Qwen3-Embedding-8B to retrieve the top-20 candidate chunks.
The retriever query is built from the full multiple-choice instance:
- question
- answer options
A-F - instruction focused on finding the correct supporting document and page
This was important: retrieving with only the question was weaker than retrieving with question + options.
The retrieved top-20 chunks are reranked with Qwen3-Reranker-8B.
The reranker sees:
- the question
- all answer options
- the candidate chunk
In the final system, we keep only the top-2 reranked passages.
The final answer is selected by Qwen3-32B-AWQ using:
- the question
- answer options
- the top-2 reranked passages
Decoding is constrained to a single token from A-F, which makes inference stable and efficient.
The predicted document and page are taken from the highest-ranked selected chunk.
unlp2026_shared_task/
├── inference/ # Final Kaggle submission notebooks
│ ├── unlp26-sota-no-train.ipynb # Strong no-training baseline
│ └── emb-3-8b-reranker-3-8b-squad-q-a-llm-32b.ipynb # Best final pipeline
├── notebooks/ # Development and experiment notebooks
│ ├── reranker/
│ │ ├── train_reranker.ipynb # Reranker fine-tuning on UA-SQuAD
│ │ └── reranker_datasets_merge.ipynb # Hard-negative dataset construction
│ ├── baseline-vllm.ipynb # Early RAG baseline (vLLM)
│ ├── baseline-no-vllm.ipynb # Kaggle-compatible baseline (no vLLM)
│ ├── chunking_example.ipynb # Contextual chunker walkthrough
│ ├── create_summaries.ipynb # Document title/summary prefix generation
│ ├── rerank-vllm.ipynb # Reranking experiment with vLLM
│ ├── summary_wcontextual_chunk_eval_qwen3emb8b_reranker8b.ipynb # Summary-injection evaluation
│ ├── agentic_exp.ipynb # Agentic pipeline experiment
│ ├── pplx_context.ipynb # Page-level context experiment
│ └── train_rerank.ipynb # Early reranking experiment
├── src/unlp26/ # Core library
│ ├── chunker/contextual.py # Contextual PDF chunker
│ ├── embedding/ # Embedding model training scripts
│ ├── reranker/ # Reranker training scripts
│ └── retriever/ # Retriever training scripts
├── data/
│ ├── competition/ # Official train/test splits and PDFs
│ └── unlp2026_domain_extended/ # Extended domain_1 PDFs + train split
└── kaggle/ # Kaggle dataset upload helpers
This repository is centered around two main notebooks.
Inference-only strong baseline with fully off-the-shelf models:
Qwen3-Embedding-8BQwen3-Reranker-8BQwen3-32B-AWQ
This corresponds to our strong no-training pipeline and matches the paper’s baseline setup.
Paper result for this setup:
| Variant | Public | Private |
|---|---|---|
| Baseline | 0.9426 | 0.9592 |
Final improved pipeline with:
Qwen3-Embedding-8B- fine-tuned
Qwen3-Reranker-8B + squad Qwen3-32B-AWQ
This is our best final configuration.
Paper result for this setup:
| Variant | Public | Private |
|---|---|---|
| Final pipeline (fine-tuned reranker) | 0.9452 | 0.9598 |
The notebooks/ directory contains experiment and training notebooks used during development.
Fine-tunes Qwen3-Reranker-8B (and 0.6B) on UA-SQuAD using the FlagEmbedding training framework:
- loads the UA-SQuAD dataset via
ua-datasets - mines BM25 hard negatives for each question–passage pair
- runs a single-GPU contrastive training loop with
FlagLLMReranker - evaluates the fine-tuned model on a held-out dev split
This notebook produces the Qwen3-Reranker-8B + squad checkpoint used in the final best run.
Constructs the merged training dataset for reranker fine-tuning:
- chunks all competition PDFs with
doclingHybridChunker - encodes chunks and MCQ-style queries with
Qwen3-Embedding-0.6B - mines hard negatives using dense retrieval (ANN over chunk embeddings)
- aligns gold passages using doc ID + page number from the competition labels
- merges the competition-derived pairs with UA-SQuAD examples into a single JSONL file ready for
train_reranker.ipynb
| Notebook | Purpose |
|---|---|
baseline-vllm.ipynb |
Early end-to-end RAG pipeline with vLLM serving |
baseline-no-vllm.ipynb |
Kaggle-compatible baseline (HuggingFace Transformers, no vLLM) |
chunking_example.ipynb |
Walkthrough of the contextual chunker on competition PDFs |
create_summaries.ipynb |
Generates per-document title and summary prefixes via an LLM |
rerank-vllm.ipynb |
Reranking pipeline experiment with vLLM-served reranker |
summary_wcontextual_chunk_eval_qwen3emb8b_reranker8b.ipynb |
Ablation: summary-prefix injection with Qwen3-Embedding-8B + Reranker-8B |
agentic_exp.ipynb |
Agentic pipeline prototype using a self-hosted Qwen model |
pplx_context.ipynb |
Page-level perplexity context experiment |
train_rerank.ipynb |
Early reranking experiment (prior to the FlagEmbedding approach) |
With fixed reranker and generator:
| Model | Public | Private |
|---|---|---|
| Qwen3-Embedding-8B | 0.9426 | 0.9592 |
| Qwen3-Embedding-8B + squad | 0.9414 | 0.9591 |
| Qwen3-Embedding-0.6B + 80k + squad | 0.9390 | 0.9581 |
| Qwen3-Embedding-0.6B + squad | 0.9345 | 0.9534 |
| Qwen3-Embedding-0.6B | 0.9370 | 0.9507 |
| pplx-embed-v1-4b | 0.8737 | 0.8759 |
Conclusion: the off-the-shelf 8B embedder was the strongest retrieval backbone, but the much smaller 0.6B embedder fine-tuned on our translated retrieval dataset and UA-SQuAD nearly matched 8B performance, making it a strong efficiency-quality trade-off under tighter compute constraints.
With fixed Qwen3-Embedding-8B retriever and Qwen3-32B-AWQ generator:
| Model | Public | Private |
|---|---|---|
| Qwen3-Reranker-8B | 0.9426 | 0.9592 |
| Qwen3-Reranker-8B + unlp | 0.9286 | 0.9477 |
| Qwen3-Reranker-8B + squad | 0.9452 | 0.9598 |
| Qwen3-Reranker-8B + squad + unlp | 0.9330 | 0.9514 |
| Qwen3-Reranker-8B + 80k + squad | 0.9456 | 0.9590 |
| Qwen3-Reranker-4B | 0.9429 | 0.9562 |
| Qwen3-Reranker-0.6B | 0.9172 | 0.9395 |
| No reranker | 0.9099 | 0.9243 |
Conclusion: reranking was one of the biggest contributors to end-to-end quality, and 8B + squad gave the best private score.
| Variant | Public | Private |
|---|---|---|
| Generator only (no RAG) | 0.3352 | 0.3392 |
| Early system (BM25, Qwen2.5-32B) | 0.9035 | 0.9114 |
| w/o document-context prepending | 0.8610 | 0.8891 |
| w/ summary injection (1024→80) | 0.9177 | 0.9408 |
| 14B generator, top-10→1 | 0.9346 | 0.9483 |
| Rerank Q+A only, retrieval with Q only | 0.9397 | 0.9570 |
| Baseline | 0.9426 | 0.9592 |
| Final pipeline | 0.9452 | 0.9598 |
Important finding: removing document-context prepending caused a huge drop:
- from 0.9452 to 0.8610 on public
- from 0.9598 to 0.8891 on private
This confirms that document structure preservation was one of the most important parts of the whole system.
The final system worked well because it aligned all stages with the actual competition objective:
- chunking preserved the structure of long PDFs
- retrieval searched using the full MCQ instance
- reranking judged relevance using question + answer options
- generation was forced to choose only among valid answer letters
- localization was inherited from the best selected evidence chunk
In short, we treated the task as evidence-grounded multiple-choice reasoning over long structured documents, not just as plain text generation.
The solution was designed for the Kaggle code competition setting:
- no internet access
- strict runtime budget
- hidden larger test set
- hidden unseen
domain_3
Because of this, we prioritized:
- robustness
- simple multi-stage inference
- efficient vLLM-based serving
- minimal brittle domain-specific heuristics
Final retained configuration:
-
Chunking
- contextual chunking
512max tokens64overlap128document-prefix tokens
-
Retrieval
Qwen3-Embedding-8B- top-
20chunks
-
Reranking
Qwen3-Reranker-8B- fine-tuned on
UA-SQuADin the final best run - keep top-
2chunks
-
Generation
Qwen3-32B-AWQ- constrained single-token decoding over
A-F
-
Inference stack
vLLM- 2×T4-friendly pipeline design
This repo is intended to provide:
- the main inference notebooks for our best solution
- a reproducible structure for chunking, retrieval, reranking, and answer generation
- a reference implementation of a strong Ukrainian RAG pipeline for long PDF MCQA
If you use this repository, please cite our UNLP 2026 shared task paper:
Qwen Goes Brrr: Off-the-Shelf RAG for Ukrainian Multi-Domain Document Understanding
We thank the organizers of the UNLP 2026 Shared Task for the benchmark and the code-only competition setup.