Gemma 4 plans 5G masts on a ray-traced campus with six simulator runs

Team lead: @RaulMalik. Track: ft-gemma, model google/gemma-4-26B-A4B-it. White Circle Halo Competition.

Model · code · scenarios · teacher episodes · ray paths

What I did

I trained Gemma 4 26B-A4B to plan cellular masts on a university campus. The model reads a planning brief, tests layouts in a ray-tracing simulator through a tool, and hands one in. It gets six simulator runs. On 200 held-out scenarios its plans score 0.838 on a scale where a random plan is 0 and my reference optimiser is 1. The base model scores 0.586, and a genetic algorithm with 60 simulator runs scores 0.811. A classical search that starts from the model's six runs leads the same search from scratch by 0.072 at 30 runs.

The training has two stages, both in Halo and both with LoRA. Supervised training on episodes of a search teacher takes the model to 0.755. Sixty steps of multi-turn GRPO on the environment's own reward take it to 0.838, to 0.828 on sites it never saw in training, and to 0.840 on fresh scenarios I made after the model was fixed. The result is one LoRA adapter of 276 MB on the original model.

I also trained with White Circle as the only check of the client's rules in the reward. Its two policies flagged 39 of the 40 rule-breaking plans it saw in training and at most 1 of 1,110 legal ones. The model that run trained lies between two runs that used the environment's own record, in score and in rule-breaking plans.

Why this task

Radio planning is a search over which sites to build, where each antenna points and how much power it uses. A planner today runs an optimiser that calls a ray-tracing simulator hundreds or thousands of times. A model that proposes a good plan after six runs is useful in the same way a senior planner's first guess is: it is where the expensive search should start.

The task also has a rule a planner can break for a better score. In 70% of scenarios the client forbids some sites and limits the power of others, and the forbidden sites are the good ones. The simulator scores a forbidden plan like any other, so a model trained on the raw score alone has a reason to cheat. That makes it a fair place to test a reward that enforces the client's restrictions.

The environment

mast_planning is a Halo environment (ranplan/halo_env.py) with two tools. simulate takes a list of masts, each with a site, an azimuth, a downtilt and a power, and returns a coverage report: the score, coverage indoors and outdoors, demand satisfied per zone, and what each mast serves. submit hands in the final plan and ends the episode.

The physics is a link budget over ray paths that I traced once in NVIDIA Aerial Omniverse Digital Twin for a 3D model of the DTU Ballerup campus, with 99 candidate mast sites. Every mast shares one 100 MHz carrier at 3.6 GHz, so each mast also interferes with the users of the others. A plan's score is the percent of demand it satisfies, less a cost per mast and 0.2 points per simulator run.

A scenario draws 10 to 22 candidate sites, a limit of 2 to 5 masts, a target rate, demand weights per zone, one of eight mirrored or rotated coordinate frames, and the client's restrictions. The reward places the submitted plan's score between two anchors stored with the scenario: the mean score of random plans (0) and the best score of my reference search (1). A plan that breaks a restriction gets 0.

Data

No language model wrote any of the data.

Set Rows Made by
Training scenarios 8,000 ranplan/generate.py, stream train
Teacher episodes 16,000 ranplan/expert.py on those scenarios
Held-out scenarios 200 the same 79 sites, a separate random stream
Novel-site scenarios 200 only the 20 sites no other split offers
Fresh scenarios 200 the same 79 sites, a random stream nothing else uses

The scenarios share one campus and one brief format, so I measured how close the eval splits come to the training scenarios (ranplan/overlap.py), against all 32,000 of both routes. No eval scenario repeats a training prompt, a training scenario's set of candidate sites, or its sites with its restrictions. The nearest training scenario shares a median of 43% of a held-out scenario's sites and at most 54%; a novel-site scenario shares none. Outside the ten lines of the template, a held-out brief shares a median of 12% of its lines with the nearest training brief, and at most 55%.

A teacher episode is what the reference search knows, replayed through the two tools. The search scores a median of 362 sets of sites per scenario. The teacher simulates the best plan of each of the six best sets, in random order, and submits the one with the highest score. The random order matters: with the best plan always first, a student could learn to submit its first run without reading the reports.

Training

Both stages run with reasoning off. With reasoning on, an episode of the base model takes about 16,600 completion tokens; with it off, about 700.

Stage 1, supervised. Halo's SFT on the teacher episodes, LoRA rank 64 on the attention projections, one epoch, 733 steps, 87 minutes on one H200. Only the model's tool calls are trained; the brief and the simulator's reports are context. A rollout's first request renders differently from the later ones under Gemma's template, so each scenario also gives a row with its first call alone (ranplan/sft_template.py).

Stage 2, GRPO. The supervised adapter is merged into the base with Halo's merge tool, and Halo's async GRPO trains a new LoRA on the merged model against a vLLM rollout server. A step is 48 episodes: 6 scenarios, 8 episodes each, at learning rate 1e-5. I ran it twice: 24 steps (92 minutes on two H200), then, from the merged result, 36 more (128 minutes on two H200).

One adapter. Merging a LoRA adds its update to the weights, so the three updates add up, and their sum is itself a LoRA of rank 192 on the original model (ranplan/combine_adapters.py). Every score of the reported model below is from an eval of that adapter merged once into the base, and those merged weights are the checkpoint.

Results

One eval is 600 episodes: 200 scenarios, 3 episodes each, temperature 1.0, six simulator runs, restrictions enforced. I ran the eval command three times on the base model and on the reported adapter, with seeds 0, 1 and 2. Two runs share no sampling seed.

Split Model Seed 0 Seed 1 Seed 2 Mean
Held-out Base Gemma 4 26B-A4B 0.597 0.588 0.574 0.586
Held-out Reported adapter 0.837 0.840 0.836 0.838
Novel sites Base Gemma 4 26B-A4B 0.578 0.584 0.573 0.579
Novel sites Reported adapter 0.831 0.826 0.825 0.828

A standard error on this page is taken over scenarios, because the three episodes of a scenario are not independent. For one eval it is about 0.005 for the adapter and 0.013 for the base. Over the 3,600 episodes of its three evals the adapter breaks a restriction 5 times, and the base model 72 times.

I picked the route and the checkpoint with the held-out scores in front of me. So after the model and every number above were fixed, I made 200 fresh scenarios from a random stream that nothing else had used, and ran the eval on them once, with seed 0. The adapter scores 0.840 ± 0.005 and breaks no restriction. The base model scores 0.578 ± 0.014 and breaks one in 14 of 600 episodes.

The table below follows the training. Each of its rows is one eval without a seed, and the spread is one standard error. Its last row is the reported adapter again, in the eval I ran before the seeded ones.

Model Held-out Novel sites Breaks a restriction
Base Gemma 4 26B-A4B 0.582 ± 0.014 0.576 ± 0.014 2.5% / 2.2%
GRPO from base, 200 steps 0.700 ± 0.010 0.717 ± 0.010 2.8% / 1.3%
Supervised, 16,000 rows 0.755 ± 0.009 0.743 ± 0.010 5.0% / 5.2%
then GRPO, 24 steps 0.813 ± 0.006 0.792 ± 0.007 1.0% / 1.2%
then GRPO, 36 more steps 0.831 ± 0.006 0.819 ± 0.006 0.8% / 0.2%
The same three stages as one adapter 0.834 ± 0.006 0.825 ± 0.006 0.3% / 0.3%

The novel-site split offers only sites the model never saw in training, and the gain holds there.

The last two rows are the same training served two ways: as a chain of three merges, and as one adapter merged once. Their scores differ by less than two standard errors.

I ran the 24-step GRPO stage a second time with another training seed, 1 in place of the trainer's default of 42. That run scores 0.797 ± 0.007 on held-out and 0.781 ± 0.008 on novel sites, and breaks a restriction in 2.5% and 2.7% of episodes. So the training seed alone moves this stage by 0.017 on held-out. The reported model continues from the first run.

Classical search on the same held-out scenarios, by the number of simulator runs:

Method 6 runs 60 runs 600 runs
Best of random plans 0.517 0.780 0.890
Genetic algorithm 0.811 0.947
Greedy search 0.908 0.932

API models on the first 100 held-out scenarios, one episode each, through OpenRouter. The third column is the reported adapter on the scenarios that model completed, three episodes each, from the seed-0 eval:

Model Score Reported adapter, same scenarios Completion tokens per episode
openai/gpt-6.2-sol (86 episodes completed) 0.823 ± 0.011 0.839 ± 0.008 595
anthropic/claude-haiku-5.5 0.738 ± 0.018 0.841 ± 0.007 2,410
qwen/qwen4-35b-a3b 0.735 ± 0.014 0.841 ± 0.007 6,028
deepseek/deepseek-v4.1-flash 0.733 ± 0.016 0.841 ± 0.007 10,681

The adapter uses 529 completion tokens per episode on these scenarios. Scenario by scenario it is level with gpt-6.2-sol, ahead by 0.017 ± 0.011, and ahead of the other three by 0.10 or more. The API models ran with their reasoning set to low, and none broke a restriction. OpenRouter's rate limit for new accounts cut off 14 episodes of gpt-6.2-sol and 94 of z-ai/glm-5.4, which therefore has no row. mistralai/mistral-large-4-0 has none either: its provider refused the requests of an episode whose model turn was empty.

A search that starts from the model

A planner with more than six runs would not stop at the model's plan. So I gave a classical search the plans the model ran through the simulator in an episode, and let it go on: coordinate descent from the best of them, then a genetic search seeded with all of them (ranplan/warm_start.py). The comparison is the same search started by greedy. A budget counts every simulator run, the model's own included, and a run the model spent on a forbidden plan as well.

Simulator runs 6 12 30 60 120 600
Started by greedy 0.065 0.317 0.846 0.909 0.930 0.959
Started from the trained model's runs 0.887 0.901 0.918 0.929 0.935 0.966
The same, with greedy after the descent 0.887 0.901 0.918 0.929 0.940 0.971
Started from the base model's runs 0.654 0.673 0.728 0.789 0.829 0.951

These are the 200 held-out scenarios, with the first episode of each from the seed-0 evals. The scores carry no charge per run, as in the search table above, so the 0.887 at six runs is the best plan the model simulated, where the eval's 0.837 is the plan it submitted, less the charge for its runs.

A second route to the same score

More supervised data and fewer GRPO steps end in the same place. I gave the supervised stage 40,000 rows: the same 8,000 episodes, and 32,000 first-call rows that open with the teacher's best plan, 24,000 of them from new scenarios. Then one GRPO run of 36 steps.

Model Held-out Novel sites Breaks a restriction
Supervised, 40,000 rows 0.806 ± 0.007 0.777 ± 0.008 1.5% / 2.8%
then GRPO, 36 steps 0.831 ± 0.006 0.810 ± 0.006 0.8% / 1.7%

Two runs that differ in data, seed and number of steps both reach 0.831 on held-out, the first route measured before its adapters were folded into one. I report the first route because it scores higher on novel sites and breaks fewer restrictions there.

One scenario, run by run

What each stage taught

I compared each model's simulated plans with the reference search on 48 held-out scenarios.

GRPO from the base model needed 200 steps to reach 0.700. Started from the supervised model, 24 steps added 0.058 with one training seed and 0.042 with the other, and 36 more added 0.018.

What did not work

A reward that checks the client's rules with White Circle

The environment knows from the scenario's own record which plans break a restriction. A real client's rules arrive as text. So I asked whether White Circle's verdict can replace that record in the reward.

I wrote one White Circle policy per rule: no mast on protected land, and no site above its power limit (ranplan/whitecircle/policies.json). Each reads the brief and the submitted plan. Then I trained three arms from the same supervised model for 24 GRPO steps, with one setting changed: what gives a rule-breaking plan a reward of 0.

The reward checks the rules with Held-out Novel sites Plans that break a rule, of 1,200
Nothing 0.793 ± 0.008 0.788 ± 0.008 31
White Circle's verdict 0.803 ± 0.007 0.784 ± 0.008 22
The scenario's own record 0.813 ± 0.006 0.792 ± 0.007 13
The scenario's own record, second training seed 0.797 ± 0.007 0.781 ± 0.008 31

The supervised model they start from breaks a rule in 61 of 1,200 episodes. All scores are measured with the rules enforced from the scenario's record.

What I take from it:

Three things I learned about the integration:

General check

ranplan/general_check.py puts 100 GSM8K problems, 200 MMLU questions, 20 instructions with a checkable form and 22 tool-use prompts outside mast planning to a served model, and scores each reply by rule.

Model, same server Maths Knowledge Instructions Tool use
Base, thinking off 98 160 20 22
Reported model, thinking off 97 162 20 22
Base, thinking on 61 166 20 22
Reported model, thinking on 59 163 20 22

With thinking on and a cap of 2,048 tokens, both models often reason to the cap and return no answer. With thinking off, as the planner is trained and scored, the two match.

Limits

How to reproduce

# data
python -m ranplan.generate --split train --count 8000 --out data/scenarios-extra/train-0-7999.jsonl
python -m ranplan.expert --scenarios data/scenarios-extra/train-0-7999.jsonl --out data/expert/train.jsonl

# stage 1
python ranplan/sft.py ranplan/configs/gemma4-26b-a4b-mast-planning-sft-lora.yaml \
    --output_dir=<sft folder> --num_train_epochs=1 --save_steps=100 --eval_steps=100
python scripts/after_training/merge_peft_adapters.py --adapter_dir <sft folder>/checkpoint-733 \
    --output_dir <merged model> --streaming

# stage 2, with the vLLM server serving <merged model>: 24 steps, merge, then 36 steps from the result
torchrun --nproc_per_node=1 ranplan/train.py ranplan/configs/gemma4-26b-a4b-mast-planning-lora.yaml \
    --rollout_server_url=http://<vllm server>:8000 --output_dir=<grpo folder> \
    --model_name_or_path=<merged model> --max_steps=24 --learning_rate=1e-5 \
    --lr_scheduler_type=constant_with_warmup --warmup_steps=3

# the three adapters as one, on the original model
python -m ranplan.combine_adapters --adapters <sft adapter> <grpo adapter 1> <grpo adapter 2> --out <adapter>

# serve a model for the eval, in Halo's vLLM image (halo:vllm-0.32.0-1.3.0): the base model, or the reported
# model with its adapter merged in, zerocopyeng/gemma-4-26b-a4b-mast-planning-merged
vllm serve <model> --port 8000 --dtype auto --moe-backend triton --return-tokens-as-token-ids \
    --logprobs-mode processed_logprobs --enable-prefix-caching --enable-auto-tool-choice \
    --tool-call-parser gemma4 --reasoning-parser gemma4 \
    --chat-template jinja-templates/gemma4/gemma4-reasoning-effort.jinja --served-model-name <served model name>

# fresh scenarios nobody has seen, for the eval's --data folder and --splits fresh
python -m ranplan.generate --split fresh --count 200 --first-seed 200 --out <folder>/fresh.jsonl

# eval, in Halo's image with the checkout at /workspace, for the base model and the trained one
VLLM_SERVER_URL=http://localhost:8000 python ranplan/evaluate.py --model <served model name> --seed <seed> \
    --data zerocopyeng/mast-planning-scenarios \
    --training_config ranplan/configs/gemma4-26b-a4b-mast-planning-lora.yaml --out <output folder>

The eval needs no token. It reads the scenarios and the ray paths from the public datasets, and I ran it that way from a clean copy of the repository.

vLLM also serves the adapter beside the base model, with --enable-lora --max-lora-rank 256. On an H200 it scores 0.838 and 0.834 with seed 0, against 0.837 and 0.831 for the merged weights. On an 80 GB H100 that server stops at startup, because the base and the LoRA buffers leave no memory for the cache.

Third-party materials

Platforms used

Platform What ran there How much
Modal The supervised runs of both routes, every merge, model serving for every eval, the general check, and every GRPO run but two, with the trainer and the vLLM server in one container (ranplan/modal_grpo.py) about $182 of the $230 credit, on H200 and H100
Hugging Face Jobs: the GRPO run from base, the first 24 GRPO steps of the reported model (a vLLM server job and a trainer job in one network group, h200 each) and the supervised run on the first teacher. Hub: the models, the datasets and this page about $147 of the $150 credit
White Circle Two policies for the client's rules, as the reward's only check in one training arm, and measured against the environment's record 1,152 training episodes and 754 saved episodes checked, and a few rate-limit tests, on the promo credit
OpenRouter Six API models as baselines, of which four completed, and the base model's general check $5.61

Why each: Modal runs Halo's two images in one container with two H200, which is what async GRPO needs, and bills by the second. Hugging Face Jobs ran the first GRPO runs before my Modal credit arrived. White Circle reads the client's rules as text, which is the form a real client gives them in. OpenRouter put the API models behind the one endpoint format my eval command already speaks.

How agents were used

I worked with Claude Code (claude-fable-5-2) throughout: it wrote the code in ranplan/ with me, launched and watched the runs, and drafted this page from the result files. I do not publish the session logs, because they hold my private conversation.