Run this model with HF Jobs

Run asterbraid/jqweave-0.5b on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/asterbraid/jqweave-0.5b. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/asterbraid/jqweave-0.5b on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/asterbraid/jqweave-0.5b. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
jqweave-0.5b / README.md
asterbraid's picture
Link to newer Jqweave 7B Real release
19e771b verified
|
Raw History Blame Contribute Delete
5.93 kB
---
license: apache-2.0
language: en
library_name: transformers
pipeline_tag: text-generation
base_model: Qwen/Qwen2.5-Coder-0.5B-Instruct
datasets:
- asterbraid/jqweave-data
tags:
- jq
- json
- code-generation
- text-to-code
- qwen
- local
- small-model
- execution-verified
---
# Jqweave 0.5B
Jqweave translates an English JSON-processing request plus representative input into a `jq` command. It is a LoRA fine-tune of **Qwen2.5-Coder-0.5B-Instruct**, merged into ordinary Transformers weights for local, offline inference. No API key is needed for inference.
- Data: [asterbraid/jqweave-data](https://huggingface.co/datasets/asterbraid/jqweave-data)
- Newer, higher-accuracy release: [Jqweave 7B Real](https://huggingface.co/asterbraid/jqweave-7b-real); this 0.5B model remains the lower-memory option.
- Demo: [Jqweave Space](https://huggingface.co/spaces/asterbraid/jqweave-demo)
- Output contract: one bare `jq` command with no filename, shell pipeline, Markdown, or explanation.
## Results
Greedy generation, one prediction per row. **Valid** means `jq` executes the command on the primary input. **Correct** requires exact output equality on the primary and second inputs. Only trailing special tokens are stripped; Markdown is not repaired.
| Model | Test valid | Test correct |
| --- | ---: | ---: |
| Qwen2.5-Coder-0.5B-Instruct (base) | 0.0% (0/3900) | 0.0% (0/3900) |
| **Jqweave 0.5B** | **100.0% (3900/3900)** | **100.0% (3900/3900)** |
The test split contains 3900 grammar-generated rows from the same 39 task families as training, with different random records. It measures in-distribution behavior, not broad real-world competence. Input texts are disjoint, although 100 request/command pairs recur with new inputs. Full predictions and summaries are included under `evaluation/`.
## Real-question generalization
The [Jqweave Real Questions](https://huggingface.co/datasets/asterbraid/jqweave-so-data) test set contains 50 manually reviewed tasks derived from unique Stack Overflow questions, with no input or request/command overlap with the synthetic data. These tasks were held out from training.
| Model | Real-question valid | Real-question correct |
| --- | ---: | ---: |
| **Jqweave 0.5B** | **54.0% (27/50)** | **10.0% (5/50)** |
This small, high-vote sample is not representative of all jq use. Full predictions are included as `evaluation/so-test.jsonl`.
## Verified generation
Request: `Please extract the value of the 'name' field.`
```json
{"id":396819,"name":"hana","username":"hana","category":"delta","status":"closed","score":8,"active":false,"password":"remove-me","_row_nonce":"select_field-1-a"}
```
Generated command:
```jq
jq '.name'
```
Executed output:
```json
"hana"
```
## Use
```python
from jqweave.model import generate_command
command = generate_command(
"Extract the value of the 'name' field.",
'{"name":"delta","score":90}',
"asterbraid/jqweave-0.5b",
)
print(command)
```
Or clone this repository for the CLI:
```bash
git clone https://huggingface.co/asterbraid/jqweave-0.5b
cd jqweave-0.5b
pip install -e '.[model]'
printf '%s' '{"name":"delta","score":90}' | jqweave "Extract the value of the 'name' field."
```
Python 3.10+ and `jq` are required. Add `--run` to print the command to stderr and execute it with the included safety guard.
## GGUF and Ollama
Quantized builds:
- `jqweave-0.5b.Q4_K_M.gguf`
- `jqweave-0.5b.Q8_0.gguf`
For Ollama, run `ollama create jqweave-0.5b -f Modelfile` from this repository and follow `OLLAMA.md`. For llama.cpp, run `llama-server -m jqweave-0.5b.Q4_K_M.gguf --host 127.0.0.1 --port 8080`.
The Q4_K_M build passed a real `llama-completion` generation smoke check.
## CPU performance
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`.
| Format | Cold total | Warm median | Peak memory |
| --- | ---: | ---: | ---: |
| Transformers | 16.46s | 1.16s | 3.67 GiB |
| Q4_K_M GGUF / llama.cpp | 7.37s | 0.30s | 0.51 GiB |
Environment: Transformers 5.17.0, torch 2.14.0+cu130, llama.cpp `1f1e6cb26a478c772d8d1c1d456f62ecd1a3be6c`. These are short-request measurements, not a throughput benchmark. Raw results and scripts are under `evaluation/`.
## Training
- Base: `Qwen/Qwen2.5-Coder-0.5B-Instruct` (Apache-2.0).
- Data: 31200 rows from Jqweave Data, with 3,900 validation rows.
- Method: LoRA rank 32, alpha 64, dropout 0.05, targeting attention and MLP projections; adapter merged after training.
- Schedule: one epoch, cosine decay, learning rate 5e-05, effective batch size 64, maximum sequence length 1024.
- Precision: FP32 optimization for numerical stability, BF16 export, non-fused AdamW, maximum gradient norm 0.5.
Every reference command in the dataset was executed on two inputs with jq 1.6. Full settings are in `training_config.json`.
## Execution and safety
The model emits text only. The optional CLI and Space execute commands with `jqweave.execution.run_jq`, which accepts only `jq` on stdin/stdout and rejects filenames, additional options, modules, environment access, and additional inputs. CPU, memory, file-size, and wall-clock limits are applied. Review generated commands before use; a valid command can implement the wrong request.
## Limitations
English only and single-input `jq`. No filenames, modules, environment access, or additional inputs. The test set is synthetic and in-distribution, so it does not establish broad real-world accuracy. Outputs can be sensitive to request phrasing, so prefer explicit operations, fields, and values.
## License and attribution
Code and merged weights are Apache-2.0. See `LICENSE` and `NOTICE`. Training data is CC-BY-4.0; attribute Asterbraid when redistributing it.