DEV Community

Cover image for A 4B Model Beat Postgres by 81 Percent: What a $1,200 Training Run Means for Philippine AI
Yano.AI Technologies Inc.
Yano.AI Technologies Inc.

Posted on Originally published at yanoai.tech

A 4B Model Beat Postgres by 81 Percent: What a $1,200 Training Run Means for Philippine AI

In August 2026, the Department of Science and Technology earmarked PHP 300 million in grant-in-aid seed funding to expand its AI data centers (Source: Inquirer, 2026). One month earlier, a researcher on two second-hand RTX 3090s trained a 4-billion-parameter model that produced database query plans 81 percent faster than Postgres, for a total project cost of $1,200 (Source: Bansal, 2026). Both numbers are real. Only one of them is the bottleneck.

Infographic

The Compute Bill Is Not the Whole Bill

The Philippines has committed to a $34.4 billion AI infrastructure roadmap that would expand national data center capacity 30-fold, from a 50 megawatt baseline to 1.5 gigawatts by 2033 (Source: PNA, 2026). That is a serious industrial bet, and it addresses a genuine constraint. But the QORL experiment suggests the binding constraint for domain-specific models sits elsewhere.

Bansal's writeup documents the full budget: roughly $800 to rent a 2x H100 node for 95 hours, and about $400 in API fees to generate teacher trajectories from a frontier model (Source: Bansal, 2026). The model itself is an open-weights Qwen 3.8 4B distillation from a small German lab.

The trained artifact was a LoRA adapter of 21.2 million parameters weighing 42.5 megabytes (Source: Bansal, 2026). It fits on a phone, and it beat a planner refined for decades at the one thing it was trained to do.

Why Postgres Needed Help at All

Postgres does not count rows when it plans a query. It estimates them from stored statistics, and it assumes value frequencies distribute uniformly across joined tables (Source: Bansal, 2026). When that assumption breaks, the error cascades through the rest of the join tree.

The search space explains the stakes. A five-table query from the Join Order Benchmark has 33,177,600 distinct ways to run (Source: Bansal, 2026). Postgres prunes that space with dynamic programming and picks the lowest estimated cost. One bad early estimate sends it down the wrong path for the entire query.

The benchmark is not synthetic. The Join Order Benchmark was introduced by Leis and colleagues in 2015 to test how good query optimizers really are, using an IMDb dataset across 113 queries and 33 templates (Source: Leis et al., 2015).

What a Small Model Actually Learned

The untrained 4B model was close to useless. It produced valid candidate plans in only 14 of 113 attempts and could not reliably operate the six-tool harness wrapped around it (Source: Bansal, 2026).

Supervised fine-tuning on 100 teacher trajectories fixed the harness problem, not the optimization problem. The model reached a 1.16x geometric mean speedup. Reinforcement learning did the rest: 1,200 optimizer updates pushed it to 1.41x with 101 of 113 valid candidates, and sampling three trajectories per query with best-of-15 selection reached 1.81x and a 44.7 percent reduction in summed workload latency (Source: Bansal, 2026).

The training method is not exotic. The RL algorithm descends from GRPO, published in the DeepSeekMath paper in 2024, with a modification Bansal made so that useless rollouts receive negative advantage instead of drifting toward the group mean (Source: arXiv, 2024). The interesting part is not the algorithm. It is that a reward signal built from measured execution times was enough to teach a narrow skill.

The Philippine Gap Is Data and Evaluation

IBPAP cut its 2028 roadmap targets in July 2026, dropping from an original projection of $59 billion in revenue and 2.5 million full-time employees to a downside case of $43.3 billion and 1.85 million AI-enabled workers (Source: BusinessWorld, 2026). IBPAP's chief executive said AI has not yet scaled in the industry, and that entry-level roles affected by AI trials saw staff redeployed rather than released.

An AI-enabled workforce requires AI literacy layered on domain expertise, plus judgment and critical thinking that automation does not supply (Source: BusinessWorld, 2026). TESDA is expanding free digital and AI courses through partnerships including UNESCO's Global Skills Academy, against roughly 18,000 absorptive capacity slots for AI skills training nationwide (Source: PNA, 2026).

Training capacity for Filipino-language models is thinner still. FilBench, a benchmark released to measure how well large models understand and generate Philippine languages, exists precisely because the evaluation surface for local languages is narrow (Source: Hugging Face, 2025). Benchmarks are what turn a dataset into a reward signal.

That is the transferable lesson from QORL. The scarce inputs were not GPUs or a frontier model. They were a benchmark, a harness with verifiable scoring, and the patience to de-noise the measurement.

Where a Philippine Team Would Start

The raw materials are already here. A firm with a decade of transaction logs, claims records, or agricultural yield data is sitting on exactly the kind of narrow dataset that QORL turned into a training environment.

What is usually missing is the scoring layer. QORL worked because a correct answer could be measured in milliseconds. A team without a benchmark cannot tell a good output from a lucky one, and reinforcement learning on an unreliable reward teaches the model to exploit the reward instead of solving the problem.

DOST has funded this ground floor. Its natural language roadmap, launched under the theme of developing language models for Filipino languages, targets dataset and evaluation infrastructure (Source: DOST-PCIEERD, 2024). The country also hosts about 200 global capability centers, concentrated in banking, financial services, and healthcare, which generate exactly the structured operational data a narrow training environment requires (Source: BusinessWorld, 2026).

The honest caveat: QORL optimized one workload on one dataset on one machine. A 1.81x speedup on the Join Order Benchmark does not transfer automatically to a company's production queries. The method transfers. The numbers do not.

FAQ

Q: Does this mean Philippines should stop building data centers?

A: No. The $34.4 billion masterplan addresses national capacity and sovereign compute, which are separate from domain model training (Source: PNA, 2026). The point is that compute and capability are different investments with different price tags.

Q: How much did the 4B model training cost?

A: About $1,200 total, split between roughly $800 in H100 rental and $400 in frontier model API fees, excluding electricity (Source: Bansal, 2026).

Q: Is a 4B model competitive with frontier models at this task?

A: Not in general. Frontier models solved the task in-context, which is why their trajectories could be distilled into the smaller model in the first place (Source: Bansal, 2026). The small model is narrower and cheaper to run.

Q: What skills does this method require locally?

A: Three: benchmark construction, reward design, and measurement hygiene. QORL spent significant effort calibrating database settings because noisy measurements produced phantom rewards roughly 5 percent of the time (Source: Bansal, 2026).

Key Takeaway

A PHP 300 million data center allocation and a $1,200 training run are not competing priorities, but they are not substitutable either (Source: Inquirer, 2026; Source: Bansal, 2026). The Philippines is funding the first. The second is available to any team with a clean dataset and a willingness to build a scoring harness before building a model.

Which of your organization's tasks has enough labeled examples and a measurable correct answer to become a reinforcement learning environment?

Sources

Top comments (0)