Semantic frames
Templates identify agents, objects, locations and time without relying on a language model.
Independent experiment · NLP · Structured prefixes
A deterministic compiler turns raw language and domain knowledge into typed intermediate representations, then tests whether those structures help a small language model learn.
Same input, same structured output. No neural inference inside the compiler.
01 · DLB
The Deterministic Language Beautifier normalizes raw text, identifies roles and produces an intermediate graph of events, entities and typed links.
Templates identify agents, objects, locations and time without relying on a language model.
Named entities and units are protected against aggressive spelling correction.
Temporal, causal and coreference links become machine-readable structure.
02 · Apex
Each module writes a typed prefix. Channels can fade independently during training so the model is not forced to depend equally on every scaffold.
DLB events, knowledge graphs, temporal relations, spatial reasoning and world state.
Unit analysis and physics structure receive a partial fade schedule.
Math-solver and AST channels remain available where exact structure carries the answer.
03 · Experiments
The suite was tested on WikiText and GSM8K configurations. These numbers describe this project’s runs, not a peer-reviewed comparison.
| Experiment | Baseline | DLB / Apex | Observed change |
|---|---|---|---|
| WikiText-2, 10K | 398 PPL | 286 PPL | 28.2% lower |
| WikiText-103, 100K | 91.13 PPL | 55.99 PPL | 38.6% lower |
| GSM8K exact match | 0.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
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.
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.
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
A module fires only when its domain appears in the input. Its output enters one of three channels with a different removal schedule.
| Module | Compiled representation | Why it is useful |
|---|---|---|
| DLB linguistic compiler | Events, entities, roles, causal and coreference links | Provides a general scaffold on every sentence |
| Temporal engine | Absolute dates, offsets, BCE arithmetic, simultaneity, conflicts | Places statements on a document-level timeline |
| Spatial reasoner | LEFT_OF, ABOVE, INSIDE, distance, inverse and transitive relations | Makes implicit spatial consequences explicit |
| World-state tracker | Possession, location and attribute before/after diffs | Preserves change across a document |
| Dimensional analyzer | SI conversion, dimension checks and plausibility ranges | Prevents quantities from becoming interchangeable tokens |
| Physics engine | Detected regime, formula, constants and verified result | Provides computed quantitative structure |
| Math solver | Normalized expression, SymPy result and step trace | Places an exact answer in the non-fading channel |
| Logic verifier | Premises, conclusion, validity and detected fallacy | Separates argument form from fluent wording |
| AST/TAC and knowledge graph | Code operations, branches, complexity and document relations | Exposes executable and relational structure |
06 · Fade curriculum
The experiment separates prefixes according to whether the model should internalize them or continue receiving them.
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.
Dimensions and physics receive partial fade. The model practices reasoning with structured quantities without assuming the external compiler will always remain present.
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.
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
The study includes distribution mismatch, channel removal and scaffold-removal tests rather than presenting only the strongest number.
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.
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.
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 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
Clarity about the boundary is part of the technical contribution.
The suite has been tested on small transformers. Behavior may change when the base model already learns stronger latent structure.
Incorrect frames or narrow templates can inject confident structural errors. Coverage and error analysis matter as much as aggregate perplexity.
The runs are reproducible project experiments, not a peer-reviewed comparison against the full field of structured-language methods.
The decisive next work is broader datasets, larger models and tasks that test whether gains survive domain shift and imperfect module coverage.