KNARsack: Teaching Neural Algorithmic Reasoners to Solve Pseudo-Polynomial Problems

Stjepan Požgaj, Dobrik Georgiev, Marin Šilić, Petar Veličković
9/17/2025
cs.AIcs.LG

No confident code implementation found for this paper.

Abstract

Neural algorithmic reasoning (NAR) is a growing field that aims to embed algorithmic logic into neural networks by imitating classical algorithms. In this extended abstract, we detail our attempt to build a neural algorithmic reasoner that can solve Knapsack, a pseudo-polynomial problem bridging classical algorithms and combinatorial optimisation, but omitted in standard NAR benchmarks. Our neural algorithmic reasoner is designed to closely follow the two-phase pipeline for the Knapsack problem, which involves first constructing the dynamic programming table and then reconstructing the solution from it. The approach, which models intermediate states through dynamic programming supervision, achieves better generalization to larger problem instances than a direct-prediction baseline that attempts to select the optimal subset only from the problem inputs.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Cite this paper

@article{pogaj2025knarsack,
  title  = {KNARsack: Teaching Neural Algorithmic Reasoners to Solve Pseudo-Polynomial Problems},
  author = {Stjepan Požgaj and Dobrik Georgiev and Marin Šilić and Petar Veličković},
  year   = {2025},
  eprint = {2509.15239},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2509.15239v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2509.15239.svg)](https://codeofpaper.com/paper/2509.15239)

Discussion