Hamza Trabelsi / ResearchDLB Apex

Independent experiment · NLP · Structured prefixes

DLB
Apex

A deterministic compiler turns raw language and domain knowledge into typed intermediate representations, then tests whether those structures help a small language model learn.

RoleConcept, compiler design, implementation, experiments
Claim boundaryInternal benchmark results

Same input, same structured output. No neural inference inside the compiler.

01 · DLB

Language is compiled before it is learned.

The Deterministic Language Beautifier normalizes raw text, identifies roles and produces an intermediate graph of events, entities and typed links.

Raw textNormalizeCorrectLexParseTyped IR
Events

Semantic frames

Templates identify agents, objects, locations and time without relying on a language model.

Entities

Guarded correction

Named entities and units are protected against aggressive spelling correction.

Links

Explicit relations

Temporal, causal and coreference links become machine-readable structure.

02 · Apex

Nine domain compilers extend the scaffold.

Each module writes a typed prefix. Channels can fade independently during training so the model is not forced to depend equally on every scaffold.

Structure

Events, time, space, logic

DLB events, knowledge graphs, temporal relations, spatial reasoning and world state.

Quantity

Dimensions and physics

Unit analysis and physics structure receive a partial fade schedule.

Answer

Math and code

Math-solver and AST channels remain available where exact structure carries the answer.

03 · Experiments

The result changed with scale and task.

The suite was tested on WikiText and GSM8K configurations. These numbers describe this project’s runs, not a peer-reviewed comparison.

ExperimentBaselineDLB / ApexObserved change
WikiText-2, 10K398 PPL286 PPL28.2% lower
WikiText-103, 100K91.13 PPL55.99 PPL38.6% lower
GSM8K exact match0.4%3.2%8× in the documented run

The source document includes ablations, fade schedules and limitations. The work is independent and experimental.

04 · Compiler anatomy

What deterministic means here.

DLB does not ask a model to rewrite or interpret the sentence. Each stage applies inspectable rules and passes typed output to the next stage.

From surface text to an event graph.

Normalization repairs casing, punctuation, repeated characters and contractions. Guarded correction protects named entities and units. Phrasal normalization maps expressions such as “picked up” to a stable canonical token before lexical classification.

The lexer assigns roughly twenty token classes, including verbs, people, locations, units and time expressions. A template parser then builds EventFrames with explicit agent, object, location and time roles. DLBIR joins those frames to entities and typed temporal, causal and coreference links. A renderer can generate normalized language from that intermediate representation.

This does not solve unrestricted language understanding. Template coverage can fail, ambiguity remains, and rule maintenance grows with linguistic breadth. Its value in the experiment is different: it supplies consistent structural hints whose errors can be inspected.

One training sequence

Apex prefixes the target with compiled structure. Loss is calculated only on the target after CH2, so the scaffold supplies context without becoming an output the model is rewarded for copying.

[CH1]
KG: Alice → SOLD → Clips
[time | event: sell]
[units | qty: 48, unit: clips]
[math | expr: 48/2, result: 24, verified: True]

[CH2]
Natalia sold 48/2 = 24 clips to her friends. #### 24
[EOS]

05 · Apex modules

Nine compilers contribute different kinds of structure.

A module fires only when its domain appears in the input. Its output enters one of three channels with a different removal schedule.

ModuleCompiled representationWhy it is useful
DLB linguistic compilerEvents, entities, roles, causal and coreference linksProvides a general scaffold on every sentence
Temporal engineAbsolute dates, offsets, BCE arithmetic, simultaneity, conflictsPlaces statements on a document-level timeline
Spatial reasonerLEFT_OF, ABOVE, INSIDE, distance, inverse and transitive relationsMakes implicit spatial consequences explicit
World-state trackerPossession, location and attribute before/after diffsPreserves change across a document
Dimensional analyzerSI conversion, dimension checks and plausibility rangesPrevents quantities from becoming interchangeable tokens
Physics engineDetected regime, formula, constants and verified resultProvides computed quantitative structure
Math solverNormalized expression, SymPy result and step tracePlaces an exact answer in the non-fading channel
Logic verifierPremises, conclusion, validity and detected fallacySeparates argument form from fluent wording
AST/TAC and knowledge graphCode operations, branches, complexity and document relationsExposes executable and relational structure

06 · Fade curriculum

How the fade curriculum works.

The experiment separates prefixes according to whether the model should internalize them or continue receiving them.

Structure channel

Events, knowledge graph, temporal, spatial, logic and world state fade aggressively during training. The test asks whether learned behavior survives after the explicit scaffold disappears.

Quantity channel

Dimensions and physics receive partial fade. The model practices reasoning with structured quantities without assuming the external compiler will always remain present.

Answer channel

Verified math and code structure remain available where the deterministic module already carries the exact result. Removing that answer would change the task rather than test internalization.

Controlled loss

Both baseline and scaffolded models are judged on target tokens. Prefix tokens are context only, keeping perplexity comparisons at the same output boundary.

07 · What the ablations say

Ablation results and failure cases.

The study includes distribution mismatch, channel removal and scaffold-removal tests rather than presenting only the strongest number.

Inference-only prefixes increased perplexity.

In S1, bolting DLB onto a model that had never trained with its prefixes increased perplexity by 124%. The representation is not a magic prompt. Training and inference distributions must agree.

Structure can be internalized

In the IR-fade experiment, removing the scaffold after curriculum training cost only 0.3% perplexity. By contrast, trying to fade the beautified text failed because that text was the learning target, not auxiliary structure.

Apex and DLB contribute differently

At the 10K WikiText scale, removing Apex increased perplexity by 50.9%; removing DLB increased it by 9.3%. Temporal and dimensional channels supplied information the small model struggled to infer, while DLB remained the always-available general linguistic scaffold.

The scaling result needs broader testing

The measured advantage widened from 14% at 3K sentences to 28% at 10K and 39% at 100K. That supports further study, but the datasets, tokenizer, parameter count and compiler coverage still bound the claim.

08 · Limitations

Limits of the current experiments.

Clarity about the boundary is part of the technical contribution.

Scale

No large-model result

The suite has been tested on small transformers. Behavior may change when the base model already learns stronger latent structure.

Compiler bias

Rules choose what becomes visible

Incorrect frames or narrow templates can inject confident structural errors. Coverage and error analysis matter as much as aggregate perplexity.

Comparison

Internal benchmarks only

The runs are reproducible project experiments, not a peer-reviewed comparison against the full field of structured-language methods.

Next test

Generalization outside the compiler

The decisive next work is broader datasets, larger models and tasks that test whether gains survive domain shift and imperfect module coverage.