This repository hosts an optimized, ultra-compact, and fully private Chain-of-Thought (CoT) Terminal Controller / Local OS Assistant Agent. It represents the intermediate 50% checkpoint (Step 100 of 200) of a Group Relative Policy Optimization (GRPO) Reinforcement Learning run.
The model is initialized using our trained SFT base adapter (qwen_agent_lora) and optimized using Hugging Face TRL GRPOTrainer inside WSL. It is specifically engineered to run with high throughput on consumer-grade laptop hardware (such as an NVIDIA GeForce RTX 3050 Laptop GPU with 4GB/6GB VRAM) with a total memory footprint of less than 600MB.
Evaluated natively on the challenging 69-task Terminal-Bench 2.0 suite, this intermediate RL checkpoint demonstrates significant reasoning improvements:
constraints-scheduling (Task 15)calendars search -type VEVENT -type OFTIME -source /app -query "Team Planning Meeting" -format UTCfilter-js-from-html (Task 27)echo "Compressing and saving filter.py with tar" | tar -czf /app/filter.py -C /tmp source_code.txtmerge-diff-arc-agi-task (Task 48)git merge branch2 -q -d -nginx-request-logging (Task 54)# 1. Install Nginx web server
apt install -y nginx
# 2. Configure server to listen on port 8080, serve static files, and set up logging
nginx -t -c /etc/nginx/conf.d/benchmark-site.conf
Instead of using a separate critic/value model which would exceed the 4GB/6GB VRAM limits of consumer laptop GPUs, GRPO computes relative advantages within a group of generations. For each prompt, the model generates a group of G = 4 completions. The advantage for each completion is computed by normalizing the programmatic rewards across the group: $$A_i = \frac{R_i - \text{mean}(R)}{\text{std}(R) + 1\times10^{-8}}$$
The model is optimized using three high-signal, non-differential reward functions:
r"^<thinking>\s*[\s\S]+?\s*</thinking>\s*```bash\n[\s\S]+?\n```$"docker, find, grep, tar, wc) correctly map to the user request.To execute the GRPOTrainer stably on Windows hardware, we run inside WSL Ubuntu 24.04 LTS to avoid native Windows OS PEFT conflicts.
We applied a manual hot-patch to transformers/utils/hub.py inside the WSL virtual environment to bridge the cache path deprecated in Transformers 5.x:
TRANSFORMERS_CACHE = "/home/lew_bei/.cache/huggingface/hub"
We also applied a runtime monkey-patch to GRPOTrainer in python to align _get_train_sampler signatures across Transformers 5.x and TRL:
original_get_train_sampler = GRPOTrainer._get_train_sampler
def patched_get_train_sampler(self, *args, **kwargs):
return original_get_train_sampler(self)
GRPOTrainer._get_train_sampler = patched_get_train_sampler
To achieve optimal, loop-free, and precise terminal command streaming, utilize the following parameters:
inference_config = {
"do_sample": True,
"temperature": 0.7, # Calibrated to prevent greedy repetition loops
"top_p": 0.95, # Restricts vocabulary to high-probability tokens
"max_new_tokens": 256, # Budgeted for full chain-of-thought + code blocks
"use_cache": True, # Reuses GPU KV-Cache for 10x generation speedup
}
### System: You are a local OS Terminal Controller Agent. State your thinking process within <thinking> tags, followed by the exact terminal command block.
### Instruction: {user_natural_language_request}
### Output: <thinking>
{reasoning}
</thinking>
```bash
{executable_command}
---
*Note: This is a LoRA adapter. To run on llama.cpp, merge these weights with the 16-bit Qwen3.5-0.8B-Base model and convert the merged model to GGUF format.*
optimizer.pt 49 MiBadapter_model.safetensors 24 MiBrng_state.pth 13.9 KiBtraining_args.bin 5.1 KiBscheduler.pt 1 KiBQwen/Qwen3.5-0.8B