Results
All scores are greedy, one generation per row. Valid means awk executes the prediction on the primary input. Correct requires exact output equality on both the primary and second input. Only trailing special tokens are stripped; Markdown is never repaired.
Table with columns: Model, Test valid, Test correct, Dev valid, Dev correct, Frozen valid, Frozen correct| Model | Test valid | Test correct | Dev valid | Dev correct | Frozen valid | Frozen correct |
|---|
| Qwen2.5-Coder base | 2.6% (77/3000) | 2.5% (76/3000) | 9.1% (3/33) | 3.0% (1/33) | 13.5% (5/37) | 8.1% (3/37) |
| Awkweave stage 1 | 100.0% (3000/3000) | 100.0% (3000/3000) | 90.9% (30/33) | 30.3% (10/33) | 94.6% (35/37) | 32.4% (12/37) |
| Awkweave 7B | 100.0% (3000/3000) | 100.0% (3000/3000) | 100.0% (33/33) | 97.0% (32/33) | 94.6% (35/37) | 37.8% (14/37) |
The base model fenced every prediction in Markdown and usually emitted a shell command, so it was invalid under the strict bare-program contract.
Test contains 3000 grammar-generated rows from the original 39 families and measures in-distribution behavior only; input texts are disjoint, but request/program pairs can recur. Dev contains 33 authored tasks used to guide the realistic expansion, so it is development data, not an untouched test. Frozen contains 37 separately authored network-flow, inventory, syslog, group, sensor, and formatting tasks. It was excluded from all training and tuning. Full predictions and summaries are included under evaluation/.
Verified generation
Request: For each record, print column 1 and the running sum of column 2, separated by a space.
gus 24 indigojules 18 deltafarah 18 grovealice 22 deltafarah 29 grovedina 10 amberjules 4 fablefarah 2 fable
Generated program:
Executed output:
gus 24jules 42farah 60alice 82farah 111dina 121jules 125farah 127
from awkweave.model import generate_program program = generate_program( "Print each name and the running total of column 2.", "alice 10\nbruno 15\nchen 7\n", "asterbraid/awkweave-7b",)print(program)
Or use the lower-level API:
from transformers import AutoModelForCausalLM, AutoTokenizerfrom awkweave.prompts import messages model_id = "asterbraid/awkweave-7b"tokenizer = AutoTokenizer.from_pretrained(model_id)model = AutoModelForCausalLM.from_pretrained(model_id)prompt = tokenizer.apply_chat_template( messages("Print the last field of every line.", "a 1\nb 2\n"), tokenize=False, add_generation_prompt=True,)inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)output = model.generate(**inputs, do_sample=False, max_new_tokens=192)print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
CLI
Clone this repository, install the package, and pipe representative input to the CLI. Python 3.10+ and an awk executable are required:
git clone https://huggingface.co/asterbraid/awkweave-7bcd awkweave-7bpip install -e '.[model]'printf 'alice 10\nbruno 15\n' | awkweave 'Print the running sum of column 2'
Add --run to print the generated program to stderr and execute it with the included safety guard. The guard permits stdin/stdout processing only and rejects file, environment, subprocess, pipe, and redirection operations.
GGUF
Quantized builds are included for llama.cpp-compatible runtimes:
awkweave-7b.Q4_K_M.gguf
awkweave-7b.Q8_0.gguf
llama-server -m awkweave-7b.Q8_0.gguf --host 127.0.0.1 --port 8080
The Q4_K_M build was also loaded in llama-completion and passed a real generation smoke check.
Measured with 8 CPU threads, five identical short generations, and deterministic decoding. Cold total includes model initialization but not network downloads. Warm median is the median of five generations after the first. Peak memory is process RSS. GGUF uses a persistent llama-server.
Table with columns: Format, Cold total, Warm median, Peak memory| Format | Cold total | Warm median | Peak memory |
|---|
| Transformers | 191.82s | 14.84s | 43.46 GiB |
| Q4_K_M GGUF / llama.cpp | 11.25s | 2.27s | 7.54 GiB |
Environment: Transformers 5.17.0, torch 2.14.0+cu130, llama.cpp 483cab3dd913fffcce1ce86edeb3617a7672936f. These are short-request measurements, not a throughput benchmark. Raw results and scripts are under evaluation/.
Training
- Base:
Qwen/Qwen2.5-Coder-7B-Instruct (Apache-2.0).
- Data: 60000 rows in the final training stage, including original and guarded-paraphrase requests.
- Stage 1: 108000 original rows for one epoch at learning rate 5e-05.
- Stage 2: 40,000 realistic rows plus 20,000 replay rows, continued from the stage-one merged model at learning rate 2e-05.
- Method: LoRA rank 32, alpha 64, dropout 0.05, targeting attention and MLP projections; adapter merged after training.
- Schedule: 1.0 epoch, cosine learning-rate decay, peak learning rate 2e-05, effective batch size 64, maximum sequence length 1024.
- Precision: BF16 with gradient checkpointing; non-fused AdamW and maximum gradient norm 0.5.
training_config.json records the resolved settings and training metrics.
Every reference program in the dataset was executed on two inputs. Paraphrases changed request wording only, never the program, inputs, or expected outputs.
Execution and safety
The model itself produces text and does not execute anything. The optional CLI and Space use awkweave.execution.run_awk, which supplies input on stdin and rejects file/environment access, system(), getline, pipes, and output redirection. CPU, memory, output-file, and wall-clock limits are also applied. Review generated programs before use. A syntactically valid program can still implement the wrong request.
Limitations
- English only; not a general chatbot or general shell assistant.
- POSIX-style
awk on supplied text. No multi-file joins, quoted CSV, or external pipelines.
- Requests must be explicit about field positions or header names, filtering, output formatting, and ordering.
- Complex compositions outside the training families can fail. The small challenge split does not establish broad reliability.
- The execution guard is a safety layer, not a proof of sandboxing against every possible
awk implementation exploit. Use a container for untrusted production workloads.
License and attribution
Code and merged weights are Apache-2.0, matching the base model. See LICENSE and NOTICE. Training data is CC-BY-4.0; attribute Asterbraid when redistributing it.