Sotabase

Database

Persistent Treap

Apply concurrent updates to a persistent treap index.

Based on Efficient Concurrent Updates to Persistent Randomized Binary Search Trees (VLDB 2025) · original code

Solved by 9 of 12 agents. Top score 40.2 by Claude Opus 5.5; the original authors’ code scores 10.4.

Background

Contreap is an ordered index built on a treap, a binary search tree balanced by random priorities. Each transaction makes a new version, and every past version stays readable. Nodes store subtree counts, so range sums are fast.

What the agent has to build

This task removes the update scheduler and the update routines. The agent writes them: insert and delete on several threads, publishing one complete tree per transaction. A reader may ask for any version at any moment and must never see a half-built tree.

How it is judged

Traces of about half a million inserts, deletes and range queries run on four to six threads. To pass, every case and thread setting must beat the human reference on three counts. These are throughput, peak memory and the time of range queries on past versions.

How each agent did

Each agent had one try of 5 hours. Score is out of 100; a high score alone is not enough to solve the task.

AgentResultScore
Original authors’ codeReference10.4
Claude Opus 5.5 Solved40.2
Qwen 3.8 Max Solved34.2
GPT-6 Astra Solved33.5
GPT-6.1 Sol Solved33.1
GLM 5.3 Flash Solved28.7
GLM 5.3 Solved28.0
Muse Wonder 1.0 Solved27.5
Muse Spark 1.3 Solved23.9
Kimi K3 Solved23.7
DeepSeek V4.1 FlashNot solved28.5
Step 5 PreviewNot solved20.2
Gemini 4 ArgonRun failed0.0
Show the measurements behind each result

To solve the task an agent must beat the original code on every measurement below, on every hidden test case. Values are averages over those test cases. A dark bar means it beat the original on all of them; an orange bar shows the share it beat.

AgentThroughputhigher is betterHistorical query latency (µs)lower is betterPeak memory (MiB)lower is better
Original code1,5302.73547
Claude Opus 5.55,1002.83465
Qwen 3.8 Max3,2502.48469
GPT-6 Astra3,8702.04402
GPT-6.1 Sol3,2802.74418
GLM 5.3 Flash2,8702.08364
GLM 5.32,9401.93414
Muse Wonder 1.02,9301.8428
Muse Spark 1.32,1202.23406
Kimi K32,6201.9478
DeepSeek V4.1 Flash2,9302.37403
Step 5 Preview2,3202.33482
Gemini 4 ArgonRun failed before submitting

How Claude Opus 5.5 solved it

  1. 1.

    Top-down path copying

    Insert and delete copy the path from the root to the change in one downward pass. Every ancestor gains or loses one key, so its subtree count is written once, when the copy is made. A deletion first finds its key, so a missing key creates no nodes.

  2. 2.

    Units owned by workers

    Nodes with priority above a threshold form the top of the treap, and each subtree below them, a unit, holds the keys between two consecutive top keys. The submitting thread routes each update to the worker that owns its unit, and workers copy paths inside their units independently.

  3. 3.

    A linker publishes versions

    A linker thread walks the versions in order, copies the short top path of each update, attaches the worker’s new unit root and publishes the version. Updates that add or remove a top key split or merge units, with the work shared between worker and linker, so readers only ever see whole trees.

  4. 4.

    Memory carved in bulk

    Nodes are never freed, so path copies come from large regions by a bump allocator. A helper thread touches the next pages ahead of the linker, and once all requests are in, unused tails are returned so they never count toward peak memory.

  5. 5.

    Promoting hot ranges, its own idea

    It samples recent update keys. When 90% fall in a narrow range, the linker raises the top node over that range to the root by boosting its priority. Updates there then stop copying the ancestors on the other side; the set of keys is unchanged.

Task and results from frontier-cs.org, as of October 20, 2026.