Jqweave 7B Real

Jqweave translates an English JSON-processing request plus representative input into a jq command. It is a LoRA fine-tune of Qwen/Qwen2.5-Coder-7B-Instruct, merged into ordinary Transformers weights for local, offline inference. No API key is needed for inference.

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
Jqweave 0.5B 100.0% (3900/3900) 100.0% (3900/3900)
Jqweave 7B Real 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 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
Qwen2.5-Coder-7B-Instruct (base) 20.0% (10/50) 16.0% (8/50)
Jqweave 0.5B 54.0% (27/50) 10.0% (5/50)
Jqweave 1.5B 62.0% (31/50) 12.0% (6/50)
Jqweave 1.5B Real 72.0% (36/50) 24.0% (12/50)
Jqweave 1.5B Real v2 78.0% (39/50) 38.0% (19/50)
Jqweave 3B Real 80.0% (40/50) 36.0% (18/50)
Jqweave 7B Real 96.0% (48/50) 66.0% (33/50)

This small, high-vote sample is not representative of all jq use. Full predictions are included as evaluation/so-test.jsonl.

Independent frozen validation

The Jqweave Frozen Questions set contains 49 tasks from new source questions, disjoint from training and the development benchmark.

Model Frozen valid Frozen correct
Qwen2.5-Coder-7B-Instruct (base) 10.2% (5/49) 2.0% (1/49)
Jqweave 1.5B 44.9% (22/49) 6.1% (3/49)
Jqweave 1.5B Real 46.9% (23/49) 20.4% (10/49)
Jqweave 1.5B Real v2 59.2% (29/49) 28.6% (14/49)
Jqweave 3B Real 67.3% (33/49) 36.7% (18/49)
Jqweave 7B Real 77.6% (38/49) 53.1% (26/49)

Verified generation

Request: Please extract the value of the 'name' field.

{"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 '.name'

Executed output:

"hana"

Use

from jqweave.model import generate_command

command = generate_command(
    "Extract the value of the 'name' field.",
    '{"name":"delta","score":90}',
    "asterbraid/jqweave-7b-real",
)
print(command)

Or clone this repository for the CLI:

git clone https://huggingface.co/asterbraid/jqweave-7b-real
cd jqweave-7b-real
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-7b-real.Q4_K_M.gguf
  • jqweave-7b-real.Q8_0.gguf

For Ollama, run ollama create jqweave-7b-real -f Modelfile from this repository and follow OLLAMA.md. For llama.cpp, run llama-server -m jqweave-7b-real.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 198.06s 11.48s 43.46 GiB
Q4_K_M GGUF / llama.cpp 24.97s 12.10s 7.55 GiB

Environment: Transformers 5.17.0, torch 2.14.0+cu130, llama.cpp 2efe7f1d41f5c7403387e4e8fe1fa02a81e126ba. 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: all 31,200 synthetic training rows plus 2,580 repetitions of 215 real-training examples covering 174 unique reviewed source tasks.
  • 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. Synthetic training data is CC-BY-4.0; real Stack Overflow-derived training data is CC-BY-SA-4.0 with attribution in the linked datasets.

Downloads last month
-
Safetensors
Model size
8B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for asterbraid/jqweave-7b-real

Base model

Qwen/Qwen2.5-7B
Quantized
(296)
this model

Datasets used to train asterbraid/jqweave-7b-real

Space using asterbraid/jqweave-7b-real 1

Collection including asterbraid/jqweave-7b-real