←R3ACTR Labs / Monograph Archive
Project Tvara Logo
R3ACTR-LABS-2026-T1•Autonomous Edge Intelligence•Active Investigation

Project Tvara (त्वरा): Architecture, Optimization, and Safety Dynamics for Sub-100M Edge Language Models

Executive Abstract

Deploying responsive, agentic language models on consumer-grade hardware demands radical parameter parsimony and deterministic runtime stability.Project Tvara (Sanskrit: त्वरा, meaning speed and swiftness) explores the design of a 100.68M parameter decoder-only Transformer capable of native structured function execution, low-latency autoregressive generation, and reliable boundary compliance under strict local constraints (NVIDIA GeForce RTX 4050, 6 GB VRAM).

Through progressive Net2Net weight expansion, pre-allocated static O(1) Key-Value memory caching, and response-masked boundary training, we establish that compact models can achieve high precision tool orchestration (88.6% on held-out strict evaluation) while eliminating hallucinated out-of-domain invocations.

Parameters100,685,568100.68M Active
Inference Throughput65 – 75 tok/sO(1) Static KV-Cache
VRAM Allocation< 4.5 GBRTX 4050 6GB Headroom
Strict Eval Score88.6%31 / 35 Held-Out Tasks
Section 01

Operational Constraints & Target Hardware Baseline

Modern foundation models routinely exceed device storage and latency thresholds for local client workloads. Our empirical envelope is restricted to standard client hardware without reliance on external cloud inference clusters or remote API gateways.

Host Compute ArchitectureLocal Workstation • NVIDIA GeForce RTX 4050 Laptop (6.00 GB VRAM)
Numerical Precisiontorch.bfloat16 with TensorFloat-32 (TF32) matmul enabled
Maximum Operational VRAM Ceiling≤ 4.5 GB (Reserving ≥ 1.5 GB for host display and OS tasks)
Autoregressive Throughput Target> 65 tokens/sec sustained autoregressive stream
Section 02

Structural Scaling: From 32M Prototype to 100.68M Architecture

Rather than initializing the target network randomly, training progressed through warm tensor expansion using the Net2Net paradigm, transferring syntax and foundational linguistic patterns acquired in a 32M baseline model.

HyperparameterPhase 1: 32M SeedPhase 2: 100.68M ArchitectureArchitectural Rationale
Hidden Dimension (dmodel)512768Elevates semantic representation capacity
Transformer Layers (L)814Deepens multi-step contextual composition
Attention Heads (HQ : HKV)8 : 412 : 4 (GQA 3:1)Grouped-Query Attention preserves VRAM bandwidth
Feed-Forward Network (FFN)SwiGLU (1365)SwiGLU (2048)64-multiple tensor padding for tensor core alignment
Vocabulary Size (V)16,38416,384 (Byte BPE)Compact vocabulary prevents parameter inflation in embeddings
Active Parameters32,442,368100,685,568Tied input/output embedding matrices

Following tensor expansion, continued pretraining reached a steady validation loss of 3.46 and a validation perplexity of 31.83 on curated English syntactic corpora.

Section 03

Agent Integration: Custom Token Topology & Masked Loss Formulation

To enforce predictable structured execution without brittle regex extractors, role boundaries and function triggers were integrated directly into the tokenizer vocabulary as first-class control symbols.

<|im_start|> • <|im_end|>

ChatML role delineation separating system, user, assistant, and tool execution scopes.

<|call|> • <|call_end|>

Atomic framing for structured JSON tool invocation payloads, preventing syntactical drift in schema emission.

<|result|>

Payload channel delivering tool results back to the model for subsequent answer synthesis.

Response-Only Cross-Entropy Optimization

Standard causal language modeling computes loss across all tokens, causing the network to expend capacity memorizing long prompt schemas. We implemented masked response-only optimization:

loss = CrossEntropyLoss(logits[mask], targets[mask], ignore_index=-100)

All prompt prefixes and system tool schemas were assigned -100, ensuring backpropagation isolated gradient updates solely to valid tool schema emission and synthesized outputs.

Section 04

Inference Acceleration: Removing the O(N2) Context Bottleneck

Autoregressive decoding without state caching forces each subsequent token to recompute key and value representations for every antecedent token in the sequence. On local edge GPUs, this incurs quadratic compute complexity (O(N2)), causing generation throughput to degrade rapidly beyond modest context lengths.

Legacy Runtime

Uncached Autoregression (O(N2))

Redundant attention projection on each step. Throughput hovers at 28–46 tokens/sec on mobile RTX 4050, with rising latency per token.

Observed Throughput
~30 – 46 tok/s
KV-Cache Engine
Tvara KV-Engine

Static Pre-allocated Cache (O(1))

Full user prompt ingested in parallel during prefill. Autoregressive decoding passes only a single token (O(1)), indexing past context in microseconds.

Cached RTX 4050 Benchmark
65 – 75 tok/s (1.8x – 2.2x speedup)
Section 05

Safety Verification & Out-of-Domain (OOD) Boundary Enforcement

Compact autonomous models face a dual alignment vulnerability: they are prone to either hallucinating bogus function calls for unsupported queries or exhibiting "false refusal syndrome" where harmless natural inquiries are erroneously rejected.

Deterministic Natural Refusal for Destructive Commands

Destructive operating system commands (e.g. partition formatting, arbitrary file deletion, DPAPI credential theft) trigger natural language refusals without generating malformed tool invocations:

"I cannot delete system files or execute destructive operations, as that would damage your operating system."

The Out-of-Domain Capability Boundary

When prompted for real-time external services (e.g. live weather, web crawling, stock feeds), naive models hallucinated arithmetic operations. Explicit boundary conditioning enforces transparent capability acknowledgment:

"I do not have access to an external weather API or live internet connection. I operate offline on your local device."
Verification: 21 / 21 held-out boundary tests passed with 0 hallucinations.
Section 06

Empirical Evaluation: Strict Benchmark Protocol

To prevent evaluators from giving false passes to generic evasive refusals, we engineered an automated strict validation harness verifying syntax validity, argument fidelity, missing-operand clarification dialogues, and direct conversational competence.

Evaluation DimensionBaseline ModelAligned Model (600 Steps)Differential
Math Paraphrasing & Operand ParsingVaried colloquial phrasings ("take away from", "split equally")4 / 87 / 8+3
Clarification on Missing OperandsIncomplete user prompts requiring follow-up query0 / 3 (hallucinated)3 / 3 (100%)+3
Honest Offline Tool LimitationsAccurate rejection of internet-dependent queries4 / 88 / 8 (100%)+4
Safety & Destructive Command GuardrailsRefusal of format, delete, and credential exploits5 / 5 (100%)5 / 5 (100%)Preserved
Direct Knowledge ResponsesZero false refusals on benign factual inquiries0 / 8 (false refusals)8 / 8 (100%)+8
Aggregate Benchmark Accuracy (35 Held-Out Tasks)13 / 35 (37.1%)31 / 35 (88.6%)+51.5% Gain
Section 07

Future Investigations & Quantization Trajectory

Track 01

Interactive Terminal Engine

Standalone command-line interface featuring real-time stream decoding, native terminal tool dispatch, and autonomous execution loops.

Milestone 09
Track 02

Multi-Step Tool Chaining

Scaling autoregressive planning to support trajectories with ≥ 3 dependent function invocations prior to synthesizing final user responses.

Trajectory Alignment
Track 03

INT4 / GGUF Quantization

Compressing model footprint to sub-100 MB via 4-bit integer quantization to enable sub-watt execution on ultra-low-power microcontrollers.

Hardware Quantization