Add NeuralAllocator, a learned score-and-sort allocator#33
Open
fpedd wants to merge 1 commit into
Open
Conversation
A permutation-equivariant Transformer (~360k params, PyTorch, optional "ml" extra with a CPU-only wheel source) scores every allocation of a problem; placing the allocations first-fit in descending score order yields the full solution, since the placement order alone determines the outcome. The scores define a Plackett-Luce distribution over permutations, so inference takes the best of the deterministic decode, the classic greedy orders (portfolio floor: never worse than greedy_by_all), and up to 1024 Gumbel-perturbed policy samples within the shared 3 s budget. Features are scale-invariant per instance: normalized sizes, times, areas, conflict degrees, their ranks, plus instance-level context (each classic greedy order's relative peak and a winner one-hot) broadcast to every allocation. Training (training/train_neural.py) runs on CPU in under an hour: Plackett-Luce behavior cloning of the tie-consistent best greedy order per instance, then self-imitation (expert iteration) toward per-instance incumbent orders found by policy sampling, with peak memory evaluated by the C++ FirstFitPlacer and normalized by the max-live-load lower bound. Problems are freshly generated from the generator sources with randomized parameters; the minimalloc CSV datasets stay held out for evaluation. The fp16 checkpoint (487 KB) ships with the package. On 90 held-out problems (unseen generator seeds, minimalloc small and challenging) the mean peak over lower bound is 1.058, ahead of every heuristic and metaheuristic (greedy_by_all 1.080, simulated annealing 1.082, telamalloc 1.083, hillclimb 1.146) and behind only the exact supermalloc solver (1.008); training/eval_neural.py reproduces the comparison, including decode-only and sampling-only ablations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A permutation-equivariant Transformer (~360k params, PyTorch, optional
"ml" extra with a CPU-only wheel source) scores every allocation of a
problem; placing the allocations first-fit in descending score order
yields the full solution, since the placement order alone determines
the outcome. The scores define a Plackett-Luce distribution over
permutations, so inference takes the best of the deterministic decode,
the classic greedy orders (portfolio floor: never worse than
greedy_by_all), and up to 1024 Gumbel-perturbed policy samples within
the shared 3 s budget.
Features are scale-invariant per instance: normalized sizes, times,
areas, conflict degrees, their ranks, plus instance-level context
(each classic greedy order's relative peak and a winner one-hot)
broadcast to every allocation.
Training (training/train_neural.py) runs on CPU in under an hour:
Plackett-Luce behavior cloning of the tie-consistent best greedy order
per instance, then self-imitation (expert iteration) toward
per-instance incumbent orders found by policy sampling, with peak
memory evaluated by the C++ FirstFitPlacer and normalized by the
max-live-load lower bound. Problems are freshly generated from the
generator sources with randomized parameters; the minimalloc CSV
datasets stay held out for evaluation. The fp16 checkpoint (487 KB)
ships with the package.
On 90 held-out problems (unseen generator seeds, minimalloc small and
challenging) the mean peak over lower bound is 1.058, ahead of every
heuristic and metaheuristic (greedy_by_all 1.080, simulated annealing
1.082, telamalloc 1.083, hillclimb 1.146) and behind only the exact
supermalloc solver (1.008); training/eval_neural.py reproduces the
comparison, including decode-only and sampling-only ablations.