Skip to content Are you an AI agent? QIO facts, prices and requests are here

AI and automation3 min read

An LLM versus a greedy algorithm on Elbrus: who won and why it matters

Elbrus, a Russian processor line developed by MCST, uses a VLIW architecture, so the compiler must schedule operations across channels and cycles in advance. A researcher on Habr built such an instruction scheduler and tested whether the Qwen language model could replace the classic greedy algorithm. Qwen struggled on its own. Paired with a scheduler that enforced the hardware rules, it sometimes found shorter schedules.

An LLM versus a greedy algorithm on Elbrus: who won and why it matters

Why the compiler does the scheduling on VLIW

On ordinary processors the hardware picks the execution order. On VLIW, the basis of Elbrus, one wide instruction carries several operations, and the compiler decides which goes to which channel and cycle. A bad schedule does not break the program, it slows it down: channels idle, dependent operations wait.

The constraints of e2k-v6, the sixth version of the Elbrus instruction set, are strict: multiplication on four channels with a 4-cycle latency, division on one channel with 11 cycles, loads on four channels with 5 cycles, stores on two. The author measured them three ways: querying the assembler of lcc, the standard Elbrus compiler, about which operation may go to which channel, timing dependency chains and measuring throughput with independent streams.

We use the same pattern in automation: the model classifies and proposes, deterministic code performs actions with consequences. The Elbrus study shows in numbers why that beats trusting the model with everything.

The greedy algorithm and its ceiling

A standard scheduler makes greedy, irreversible decisions: it takes a ready operation and places it in the first free channel. Its input is a dependency graph: each node is an operation, each edge says which operation needs another's result. On simple graphs of 6–14 nodes it is almost flawless: 298–300 of 300 schedules optimal. The optimum is not guessed: an exact search, which the author calls an oracle, finds the shortest possible schedule and proves it. The gap is how many cycles (clock ticks) the greedy schedule is longer than that optimum. On a hard set of 300 graphs the average gap was 1.03 cycles, and not a single greedy schedule hit the optimum. The gap is measurable and provable, so there is room to improve.

The tool from the article: slot-by-slot breakdown of a wide instruction, cycle by cycle
The tool from the article: slot-by-slot breakdown of a wide instruction, cycle by cycle

What the language model showed

The first attempt handed the whole schedule to Qwen2.5-3B. Result: 30 seconds per task instead of 3 milliseconds and only 17 % valid schedules on hard graphs. The model drowned in bookkeeping: checking channels, latencies and conflicts.

In the second test, Qwen suggested an order and timing for operations. The scheduler built valid candidates and kept the shortest. On the 300 hard graphs, it beat greedy on 61 and reached the proven optimum on 59 of those. The other two improved but still fell short. The average gap fell from 1.03 cycles to 0.82. After revising the hardware model to use the measured value for STORE, the author recorded 62 optimal schedules out of 300. The author did not give a new count of wins over greedy for that run or a separate run time for the combined method.

What it means in practice

The lesson goes beyond compilers. A language model handles tasks with many simultaneous formal constraints poorly, but suggests priorities and order well. Give the model the heuristic and leave checking and execution to code with guarantees. Reliable AI agents in business processes are built the same way: the model proposes, rules decide.

Summary

With Qwen suggesting priorities, the average gap to the optimal schedule fell by about a fifth, from 1.03 to 0.82 cycles. The test measured schedule length on synthetic graphs. It did not measure how fast programs ran or how long compilation took.

Sources

  1. Teaching a scheduler to pack wide instructions for Elbrus (Habr, in Russian)
  2. Elbrus architecture overview (MCST)
  3. Qwen model repository
  • Elbrus
  • VLIW
  • Instruction scheduler
  • Qwen
  • LLM

Follow the journal

New pieces on websites, SEO and AI come out in the QIO journal. Follow in Google, by RSS or in Telegram to get them first.

Read next

How can we help?
Discuss a project