﻿# POJ-104: evaluate semantic clone retrieval by problem

Evaluate POJ-104 clone retrieval with problem-level labels, fixed candidate identities, preserved class partitions, and the exact MAP@R protocol.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/data-guide-poj104-clone-group-split/
Language: en

## Interpret the problem label as supervision

The [original program-representation paper](https://arxiv.org/abs/1409.5718) studies functionality-based program classification, while the [CodeXGLUE POJ task](https://github.com/microsoft/CodeXGLUE/blob/main/Code-Code/Clone-detection-POJ-104/README.md) uses the collection for semantic clone retrieval. A label denotes the programming problem a source submission solves. Programs in one class can use different algorithms and surface forms. Conversely, belonging to different problem classes is not a mathematical proof that two pieces of code have unrelated behavior. Use the labels as the benchmark's relevance definition rather than as an exhaustive theory of semantic equivalence.

## Preserve class boundaries when preparing splits

CodeXGLUE documents training, validation, and test files with `code`, `label`, and `index` fields. Its [preprocessing implementation](https://github.com/microsoft/CodeXGLUE/blob/main/Code-Code/Clone-detection-POJ-104/dataset/preprocess.py) assigns groups of problem directories to the respective partitions. That design withholds problem classes, rather than randomly dividing all individual submissions. A local random row split answers a different question because other solutions to the same problem can remain in training. Retain problem membership and the export revision, following [document-level leakage principles](/journal/document-level-data-split-leakage/).

## Keep source identity separate from export index

The preprocessing code reads source text and creates sequential example indices while traversing files. The index identifies a row in that export; it should not be treated as a stable upstream submission identifier across independently rebuilt exports. Preserve a mapping to source path or content identity when rebuilding. The [provenance guide](/journal/document-markdown-json-provenance/) explains why this matters when saved embeddings or predictions are joined to a newly ordered candidate table. Matching row counts alone cannot detect an incorrect join.

## Freeze candidates and ranked predictions

The [released evaluator](https://github.com/microsoft/CodeXGLUE/blob/main/Code-Code/Clone-detection-POJ-104/evaluator/evaluator.py) reads answer identities and ordered prediction lists, checks that required predictions exist and have the expected length, then computes MAP@R. Relevant candidates belong to the same problem class. A retrieval run must exclude the query itself according to the task's candidate construction; returning the query does not demonstrate finding another implementation. Preserve rank order and avoid duplicate candidate identities. Changing the candidate pool or available relevant set changes the interpretation of the metric even when query embeddings remain identical.

## Inspect what a similarity model learned

An editorial error study can compare structurally different solutions within a problem and superficially similar boilerplate across problems. These proposed slices help distinguish task understanding from shortcut matching. Retain the official scorer for benchmark comparisons and label any alternative relevance definition separately. POJ-104 is useful for controlled retrieval of programs grouped by problem. Its score does not show that retrieved code compiles in a new environment, satisfies a different specification, or can safely replace another implementation without further checks.
