NanoHat: Polarity-Safe Reinforcement Fine-Tuning and Execution-Grounded Alignment for Sub-1B Local Linux OS Agents
Deploying autonomous operating system (OS) agents on personal workstations requires strict data privacy, sub-second responsiveness, and deterministic operational safety. While cloud-hosted frontier models (70B+ parameters) exhibit strong tool-calling capabilities, routing privileged system telemetry and desktop control through external APIs introduces severe privacy risks, network dependencies, and prohibitive latency. Conversely, off-the-shelf sub-1B parameter language models fail catastrophically when deployed as zero-heuristic OS agents: on our 299-query Fedora Workstation evaluation suite, the base Qwen3-0.6B model achieves only 51.05%–65.27% canonical argument accuracy, fails on 63.33%–80.00% of multi-tool diagnostic chains, and commits destructive read-only safety violations on up to 12.61% of read-only queries. In this paper, we present NanoHat, an ultra-lightweight (600M parameter), completely offline Linux OS agent purpose-built for Fedora Workstation. We introduce a two-stage alignment pipeline combining Execution-Grounded Rejection Fine-Tuning (RFT) against a live, non-destructive OS sandbox (NANOHAT_SANDBOX=1) with Multi-Objective Group Relative Policy Optimization (GRPO) driven by four deterministic, rule-based verifiers: schema format validation, order-invariant multi-tool bipartite matching, read-only polarity safety enforcement, and non-tool reasoning preservation. Across progressive model iterations (v4.0 and v4.1), NanoHat lifts overall combined intent and tool accuracy from 73.58% to 95.65%, boosts single-tool exact match to 98.56%, increases multi-tool chain completion by +33.33 percentage points, achieves a 100.0% live sandbox execution pass rate, and reduces read-only state-mutation violations to 2.52% at a median P50 latency of 607–682 ms. Finally, through a controlled ablation between v4.0 and v4.1, we uncover a fundamental Thinking-Scratchpad vs. Latency Trade-Off in sub-1B agents: compressing chain-of-thought traces accelerates think=ON P50 latency by 3.1× (from 1,970 ms to 635 ms, and 2.3× faster than the base model) and eliminates duplicate tool loops (0.0%), whereas preserving explicit scratchpad tokens on non-tool queries is strictly required to prevent order-of-operations collapse on multi-step arithmetic and adversarial security refusals. Model Weights & Artifacts:HuggingFace: https://huggingface.co/blackpirates/nanohat-qwen3-0.6b-finalOllama: https://ollama.com/asimansari-o/nanohat
Authors
- Asim Ansari (ORCID: https://orcid.org/0000-0001-6964-6297)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-10-24
- DOI
- https://doi.org/10.5281/zenodo.23618505
- Primary Topic
- Natural Language Processing Techniques
- Type
- preprint