← Back to Research

SCREEN OPERATION RESEARCH

Clef for Stock Trading

Teaching AI to fill stock order forms, then reducing its size.

Recorded: 15 October 2026. Model evaluations: 13–14 October 2026.

We trained Clef to operate a mock stock order form and reduced its size. We then checked whether it could fill the fields as instructed.

Terms

Clef / Jev-Omni
AI models that choose the next action from a screen.
Fine-tuning / LoRA
Training AI on task examples. LoRA adds a small set of trainable weights.
Quantization / NVFP4
Using shorter number formats to reduce model size. NVFP4 is a four-bit format.
DSH (DeepSeek Harness)
The app that receives written instructions and operates the screen.
Qwen
An open-source AI model family developed by Alibaba. Here, Qwen handles instructions and Clef scores possible screen actions.
UTM
The virtual environment running macOS for these checks.
Screen information / DOM / AX
The roles, positions and values of controls. DOM supplies web-page information; AX supplies information from the operating system.
Backtest
Trying trading rules on past data to check their results.
BF16 / FP8
Number formats using 16 bits and 8 bits respectively.
MLP / attention
Parts of an AI model. MLP transforms information; attention handles relationships between inputs.
OCO
Two linked order conditions. When one is filled, the other is cancelled.
IFD / IFDOCO
IFD places a second order after the first is filled. IFDOCO uses an OCO order for that second stage.
SOR
A system that compares prices across markets and selects where to send an order.

References: Qwen · LoRA · NVFP4 · Order types · IFDOCO · SOR

Reading a screen and choosing an action

The AI receives the order conditions and screen information. Clef scores the possible actions, and the app enters the values. It reads the screen again after each action to check the result. It hands control to a person before password entry.

Steps
  1. 01Give the order conditionsWritten instructions
  2. 02Read the screenText, positions and image
  3. 03Choose an actionClef scores the options
  4. 04Check the valuesRead the screen again
Training setup

We used browser-screen records for training. LoRA trained the language layers; the image reader and action-scoring head stayed fixed. Clef and Jev-Omni were trained and quantized separately.

Training data examples

Five examples from the training split of “Order Form Training Data v3,” now managed by ML Foundry. Each pairs order conditions, a screen and possible actions with its training target.

All five use fictional order conditions and synthetic mock screens. The broker name is covered in white in the published images. The dataset name is a publication alias. order-forms-v3 / train

01 Enter the quantity
Mock screen used as input:Enter the quantity
Mock screen used as input · View the full screen image ↗

Input to the AI

Order conditions, summarized
Buy 100 shares of fictional symbol 1000 at a limit of ¥1,200.50, valid today. Use no SOR or points.
Current screen
The normal order screen for the symbol is open. The symbol and market are set; quantity is empty.

Possible actions

  • option_00Set quantity to 100
  • option_01Set quantity to 200
  • option_02Hand control to a person
  • option_03Hold without entering values

Training target · option_00

Set quantity to 100

{
  "kind": "SET",
  "field": "input_quantity",
  "value": "100",
  "tab": "normal"
}

Source record: sbi-train-normal_limit-57afea5d1dee-step-04

02 Enter the OCO trigger price
Mock screen used as input:Enter the OCO trigger price
Mock screen used as input · View the full screen image ↗

Input to the AI

Order conditions, summarized
Buy 100 shares of fictional symbol 1030 at ¥1,200. At ¥1,220 or above, revise to a ¥1,230 limit. Both conditions are valid today.
Current screen
The OCO tab has quantity 100 and the first limit price of ¥1,200. The trigger price is still empty.

Possible actions

  • option_00Set quantity to 100
  • option_01Hand control to a person
  • option_02Set OCO trigger price to 1220
  • option_03Hold without entering values
  • option_04Set OCO trigger price to 1

Training target · option_02

Set OCO trigger price to 1220

{
  "kind": "SET",
  "field": "oco2_input_trigger_price",
  "value": "1220",
  "tab": "oco"
}

Source record: sbi-train-oco-9707d3b94b9d-step-08

03 Enter the second IFD price
Mock screen used as input:Enter the second IFD price
Mock screen used as input · View the full screen image ↗

Input to the AI

Order conditions, summarized
Buy 100 shares of fictional symbol 1040 at ¥1,200. After that order fills, sell at ¥1,250. Both orders are valid today.
Current screen
The IFD tab has the entry price of ¥1,200 and other prior fields set. The exit limit price is empty.

Possible actions

  • option_00Hand control to a person
  • option_01Set quantity to 100
  • option_02Set IFD exit limit price to 1
  • option_03Set IFD exit limit price to 1250
  • option_04Hold without entering values

Training target · option_03

Set IFD exit limit price to 1250

{
  "kind": "SET",
  "field": "done_input_price",
  "value": "1250",
  "tab": "ifd"
}

Source record: sbi-train-ifd-7b0094b34c69-step-12

04 Hand control to a person
Mock screen used as input:Hand control to a person
Mock screen used as input · View the full screen image ↗

Input to the AI

Order conditions, summarized
Buy 100 shares of fictional symbol 1050 at ¥1,200. Then sell at ¥1,250, or use a ¥1,140 limit if the price reaches ¥1,150 or below. Valid today.
Current screen
The IFDOCO fields are complete. Hand control to a person before password entry or order confirmation.

Possible actions

  • option_00Hold without entering values
  • option_01Set quantity to 100
  • option_02Hand control to a person

Training target · option_02

Hand control to a person

{
  "kind": "HANDOFF",
  "field": null,
  "value": null,
  "tab": "ifdoco"
}

Source record: sbi-train-ifdoco-1d6aa9d327b7-step-16

05 Hold when quantity is missing
Mock screen used as input:Hold when quantity is missing
Mock screen used as input · View the full screen image ↗

Input to the AI

Order conditions, summarized
Buy fictional symbol 1000 at a limit of ¥1,200.50, valid today. No share quantity is specified.
Current screen
The normal order screen is at its initial state. Missing quantity means input should not begin.

Possible actions

  • option_00Hold without entering values
  • option_01Set symbol code to 9999
  • option_02Hand control to a person

Training target · option_00

Hold without entering values

{
  "kind": "NO_ACTION",
  "field": null,
  "value": null,
  "tab": "normal"
}

Source record: sbi-train-normal_limit-fba79fff7f57-step-00

View the five source records as JSON ↗

Results before and after reducing model size

The current setup combines DOM screen information with an image. We evaluated 337 decisions and 30 order conditions on mock screens with the correct action included among the options. There were 24 valid conditions and six invalid or incomplete ones.

The six order types were limit, market, stop, OCO, IFD and IFDOCO. We counted individual correct decisions and complete input sequences separately.

Clef versionCorrect decisionsAll fields correct and human handoff
Before fine-tuning (BF16)No quantitative scoreNo quantitative score
After the first training run (BF16)322/337 (95.5%)16/24 (66.7%)
After the second training run (BF16)337/337 (100%)24/24 (100%)
After quantization (NVFP4)337/337 (100%)24/24 (100%)

The first run was evaluated using screen information from saved records plus images; the second run and quantized version used browser DOM plus images. Both training and input format changed in this comparison. There is no quantitative score from before fine-tuning. At that stage, DSH session logs showed unsuccessful behavior, including runs stopping partway through.

In the quantized setup, the six invalid or incomplete conditions produced a decision to withhold input. All 30 records were complete. Attempts and actions beyond the stopping point both totalled zero.

Model size before and after quantization

ConfigurationWeight sizeShare of original size
After the second training run (BF16)54.97 GB100%
After quantization (NVFP4, mixed precision)23.16 GB42.1%

Weight size fell by 31.81 GB, a 57.9% reduction. At about 42% of the original size, the model retained 337/337 correct decisions and 24/24 complete inputs with human handoff in the mock-screen evaluation above.

Sizes are calculated from the saved tensor metadata, including the model and final decision head. One GB is one billion bytes.

Once the quantized Clef model was ready, we sent 336 requests one at a time. Median response time was 0.978 seconds. About 95% returned within 1.227 seconds.

Detailed setup

For the second training run, we made two inputs from each example: screen information with an image, and an image-centred view. Their training weights were 50:50.

The smaller model uses NVFP4 for MLP, FP8 for attention, and BF16 for image reading and the final decision. The serving paths use different option numbers, so we compared the actions they represented.

Filling the form as instructed

We gave DSH written order conditions and let it fill the mock form. A separate screen reading confirmed that each field matched the instructions in these two examples.

Summary of the recorded run

Normal order

Requested conditions

Buy fictional stock 0001 on the Tokyo exchange: 200 shares, limit price 1234.5 yen, valid for the day, no price condition, no SOR and no points.

A separate screen reading confirmed the values

Stock and trade
0001 / Tokyo exchange / cash buy
Quantity
200 shares
Limit price
1234.5 yen
Validity and condition
Day / no price condition
SOR and points
Unused

OCO order

Requested conditions

Sell fictional stock 0004: 500 shares, limit price 3580 yen; at 3320 yen or below, revise to 3310 yen. Valid for the day, with no SOR.

A separate screen reading confirmed the values

Stock and trade
0004 / cash sell
Quantity
500 shares
Initial limit
3580 yen
Revision trigger
3320 yen or below
Revised limit
3310 yen
Validity and SOR
Day / no SOR

This check used 30 decisions and 29 input operations. It sent 59 image-backed requests to Clef.

Operation setup

Qwen Flash Next with low reasoning handled the request. Clef NVFP4 judged the screen actions. The browser and app routes used the same Brave browser.

The video shows a separate run recorded on 15 October. It starts with quantity 200 already entered and shows the limit price, day validity and points setting. The price-condition field still reads "Select".

Operation video

User recording, 35.8 seconds, silent, original speed. The excerpt places the form and operation log one above the other.

Open the MP4 directly

Results with the other model

Adding form-term explanations to Jev-Omni BF16's input increased correct decisions from 270/337 to 322/337. Completed input and human handoff rose from 2/24 to 18/24. A separate 18-case condition check changed from 10/18 to 9/18.

We compared quantization separately using the earlier model. BF16 gave 257 correct decisions out of 337; NVFP4 gave 250. We saved the converted model, loaded it again and checked that it ran.

Scope of the checks

The checks run on macOS in UTM. The app compares control roles, positions and values with the image, then operates the verified target.

The sequence alternating five browser operations and five app operations remains under evaluation.

Operation environment

We tried Cua Spaces after using DSH with UTM, then returned to UTM. It made screen-information handling and the connection to the decision model easier to adjust locally.

Clef receives a diagnostic request when screen information is unavailable. Input permission is checked separately, and the app proceeds once it has verified the target.

Evaluation data

Saved results for Clef's decisions and order-input evaluation.