---
title: "RAMPART Lets Smaller Models Beat Larger Ones by Controlling Context Order"
subtitle: "RAMPART treats LLM context assembly like a compiler pass, using five primitives to control what goes in, where, and when — with measurable gains across five models."
url: "https://alphasignal.ai/news/rampart-lets-smaller-models-beat-larger-ones-by-controlling-context-order"
author: "AlphaSignal Newsroom"
author_url: "https://alphasignal.ai/editorial-team"
company: "AlphaSignal"
company_url: "https://alphasignal.ai/company/alphasignal"
published: "2026-06-03T00:00:00.000Z"
updated: "2026-06-12T00:55:41.610Z"
type: "Paper"
topics:
  - "Agents"
  - "Post Training"
subtopics:
  - "Memory"
  - "Tool Use"
  - "Fine Tuning"
upvotes: 1020
source_url: "https://arxiv.org/abs/2606.04628"
comments: 0
truncated: true
---

# RAMPART Lets Smaller Models Beat Larger Ones by Controlling Context Order

> RAMPART treats LLM context assembly like a compiler pass, using five primitives to control what goes in, where, and when — with measurable gains across five models.

Every LLM agent has a dirty secret: it doesn't actually control what goes into its own context window. Tools dump outputs, RAG pipelines inject retrieved chunks, system prompts pile up , and the model just gets whatever lands in the buffer. A new paper from Nikodem Tomczak proposes [RAMPART](https://arxiv.org/abs/2606.04628), a compile-time memory model that treats context assembly as a first-class, programmable operation rather than an afterthought.

## The problem hiding in plain sight

LLM agents increasingly operate in settings where a single context window is far too small to capture everything relevant. Memory , the ability to persist, organize, and selectively recall information across interactions , is what turns a stateless text generator into a genuinely adaptive agent. But most frameworks still treat context construction as a passive process: append what you have and hope the model figures it out.

The deeper issue is positional. The "lost-in-the-middle" effect is a demonstrated phenomenon where LLMs perform significantly worse when relevant information is placed in the middle of the input context rather than at the beginning or end. LLMs exhibit a U-shaped attention bias where the tokens at the beginning and end of their input receive higher attention, regardless of their relevance. This isn't a quirk of one model family , it is not a minor edge case; it affects every production LLM.

Treating the LLM context window like persistent storage causes most agent failures. Most production agent failures are not model failures but memory architecture failures , and the fix requires managing the context window the way an operating system manages RAM: with deliberate control over what goes in, what stays, and what gets evicted.

## RAMPART: context as a compiled artifact

RAMPART is a compile-time memory model and pure in-RAM block registry for LLM-based agents. Context assembly is a programmable runtime operation where content is compiled from a structured registry under explicit policy for ordering, inclusion, and eviction. The key mental model: instead of building a prompt by concatenation, you maintain a named registry of content blocks and then

_Preview only. Full text requires an AlphaSignal Pro account._

## Sources

- [RAMPART: Registry-based Agentic Memory with Priority-Aware Runtime Transformation](https://arxiv.org/abs/2606.04628)
- [RAMPART HTML paper](https://arxiv.org/html/2606.04628)
- [Memory vs Context Window for LLM and AI Agents 2026 — Mem0](https://mem0.ai/blog/context-window-is-ram-not-storage-why-most-agent-failures-happen-how-to-fix-them-in-2026)
- [Found in the Middle: Calibrating Positional Attention Bias Improves Long Context Utilization](https://arxiv.org/abs/2406.16008)
- [Memory for Autonomous LLM Agents: Mechanisms, Evaluation, and Emerging Frontiers](https://arxiv.org/html/2603.07670v1)
