Alric le Conte

Projects / algorithm-tag-classifier

Tagging algorithm problems from their statement and code

A classifier that assigns one or more of eight algorithm tags to a programming problem, from its statement and a Python solution, compared with an LLM given no examples.

Period
2026
Role
Sole author
Context
Personal project, public data
~0.68macro-F1 on a held-out test set
~0.65zero-shot LLM, for comparison
~5,000public problems

[ Architecture ]

How it works

Run a scenario to follow it through the system, step by step. Select a component to read its role and see what it connects to.

Run a scenario

userCoding problemstatement + codeaiTF-IDF + linearstatement and codeaiModernBERTfine-tunedserviceFusion & thresholdstuned by cross-validationappTags8 possible tags
question

A graph problem with a Python solution

A statement about connected components, with a depth-first search solution.

solution.py

ConsoleSimulated run · illustrative data
  1. Press Classify a problem to watch each step run through the system.
  1. 01Coding problemStatement and solution received
  2. 02TF-IDF + linearText and code scored by the linear model
  3. 03Fusion & thresholdsLinear-model scores kept for the blend
  4. 04ModernBERTTransformer scores the same tags
  5. 05Fusion & thresholdsScores blended · each tag checked against its threshold
  6. 06TagsPredicted tags: graphs, dfs
  7. ✓The problem gets its predicted tags. On the held-out test set, this pipeline reaches a macro-F1 of 0.683.

Problem

The task is to predict algorithm tags, from a fixed set of eight, for a programming problem. A problem can have several tags. The inputs are its statement and a Python solution. The evaluation protocol matters as much as the model.

Data

About 5,000 public problems from a competitive-programming site, with statements, Python solutions and tags. The labels are incomplete, which caps the achievable score.

Approach

  • Protocol first. The test set is set aside before any model is built. Models are chosen by cross-validation, with near-duplicate problems kept in the same fold so that no information leaks between folds.
  • Two branches, blended. A linear model on TF-IDF features and a fine-tuned ModernBERT, with a threshold tuned per tag.
  • A baseline. An LLM given no examples (zero-shot), on the same task.

Evaluation

The blend reaches about 0.68 macro-F1 (an average score from 0 to 1 across tags) on the held-out test set, slightly above the zero-shot LLM (about 0.65). Incomplete labels cap the score.

Result

A small, reproducible pipeline, scored once on held-out data, with no LLM call per prediction.

My role

A personal project, built on my own, from the protocol to the LLM baseline.