File size: 5,518 Bytes
60fa188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f2550de
60fa188
f2550de
 
 
ec5727f
60fa188
 
 
 
 
 
 
f2550de
 
60fa188
 
 
 
f2550de
60fa188
 
 
 
f650482
60fa188
f2550de
60fa188
 
 
5e1e2c5
60fa188
f2550de
60fa188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f2550de
60fa188
f2550de
60fa188
 
f2550de
1d2e270
60fa188
 
ae5a00f
f2550de
 
 
 
 
 
 
60fa188
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
base_model: microsoft/Phi-4-mini-instruct
library_name: peft
tags:
- phi-4-mini
- LoRA
- peft
- adapter
- temporal-reasoning
license: mit
datasets:
- a6188466/mini-recurrence-converter-dsl-dataset
language:
- en
---
# πŸ” Model Card for `mini-recurrence-converter-dsl-adapter`

## 🧠 Model Details

This model is a parameter-efficient fine-tuning (PEFT) LoRA adapter, designed as a **demonstration and testbed** for the [Mini Recurrence Converter DSL module](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_recurrence_converter_dsl).

It is provided for demonstration and experimentation purposes only.

It translates English recurrence expressions, such as "every Monday at 10am" or "on the last Friday of each month", into structured function calls using that custom DSL.

- **Model type:** LoRA adapter (PEFT)  
- **Language(s):** English  
- **License:** MIT  
- **Finetuned from model:** `microsoft/Phi-4-mini-instruct`

## πŸš€ Uses

This adapter fine-tunes `Phi-4-mini-instruct` for parsing natural recurrence expressions into DSL format. It supports the DSL functions defined
in the [Mini Recurrence Converter DSL module](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_recurrence_converter_dsl).

Example prompt:

```
$ You are a precise parser of recurring schedule expressions. Your only job is to translate natural language recurrence expressions into structured DSL function calls such as WEEKLY(...) or MONTHLY_BY_WEEKDAY(...). Do not explain or elaborate. Only return the code.
> every second Tuesday of the month at 1pm  
< MONTHLY_BY_WEEKDAY(1, TU, 2, TIME(13, 0))
```

## ⚠️ Out-of-Scope Use

This adapter has been fine-tuned specifically as a demonstration and testbed for the [Mini Recurrence Converter DSL module](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_recurrence_converter_dsl). It is not intended for general-purpose dialogue or unrelated tasks.

## πŸ—οΈ Training Details

Trained on [a6188466/mini-recurrence-converter-dsl-dataset](https://huggingface.co/datasets/a6188466/mini-recurrence-converter-dsl-dataset) using the `dsl` adapter from [`fifo-tool-datasets`](https://github.com/gh9869827/fifo-tool-datasets) and [`fine_tune.py`](https://github.com/gh9869827/fifo-tool-airlock-model-env/blob/main/fifo_tool_airlock_model_env/fine_tuning/phi_4/fine_tune.py).

- **Dataset:** 279 examples mapping English recurrence expressions to DSL commands, including hand-curated and [synthetic](https://github.com/gh9869827/fifo-dev-dsl/blob/main/fifo_dev_dsl/domain_specific/mini_recurrence_converter_dsl/generate_synthetic_data.py) samples
- **Epochs:** 15  
- **Batch size:** 1  
- **Precision:** bf16  
- **Framework:** `transformers`, `peft`, `trl` (SFTTrainer)

### βš™οΈ Training Hyperparameters

```json
{
  "num_train_epochs": 15,
  "train_batch_size": 1,
  "learning_rate": 5e-06,
  "lr_scheduler_type": "cosine",
  "warmup_ratio": 0.2,
  "bf16": true,
  "seed": 0
}
```

### πŸ“ˆ Training Results

```json
{
  "mean_token_accuracy": 0.9538259625434875,
  "total_flos": 6218234638387200.0,
  "train_loss": 0.4653199369477257,
  "train_runtime": 932.994,
  "train_samples_per_second": 4.486,
  "train_steps_per_second": 4.486,
  "final_learning_rate": 2.751554198876516e-11
}
```

## βœ… Evaluation

- **Eval set:** Natural language queries similar in structure and intent to the training examples  
- **Metric:** Functional equivalence β€” two DSL expressions are considered correct if they evaluate to the same result  
- **Results:**  
  - **97.79%** on held-out [test set](https://huggingface.co/datasets/a6188466/mini-recurrence-converter-dsl-dataset) (**221/226** passed), containing queries similar in structure and intent to the training examples, using the functional equivalence metric defined above.
    The test set includes 26 hand-curated and 200 [synthetic](https://github.com/gh9869827/fifo-dev-dsl/blob/main/fifo_dev_dsl/domain_specific/mini_recurrence_converter_dsl/generate_synthetic_data.py) examples.

These results demonstrate acceptable performance on evaluated queries. However, as this is a demonstration adapter trained on a narrow dataset, performance should be carefully and independently evaluated in each individual use case.

Evaluation script: [`evaluate_mini_recurrence_converter_dsl_model.py`](https://github.com/gh9869827/fifo-dev-dsl/blob/main/fifo_dev_dsl/domain_specific/mini_recurrence_converter_dsl/evaluate_mini_recurrence_converter_dsl_model.py)

## ⚠️ Disclaimer & Limitations

This adapter is intended solely as a **demonstration and testbed** for the [Mini Recurrence Converter DSL module](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_recurrence_converter_dsl). It should not be used beyond that scope.

It does not cover all phrasings or edge cases of English **recurrence expressions**. Instead, it focuses on illustrative examples that are supported by the module's [DSL functions](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_recurrence_converter_dsl#-dsl-syntax-and-examples).

This adapter is provided *as is*, without warranties or guarantees of any kind. It is intended for demonstration and experimentation only.

## πŸͺͺ License

MIT License. See [LICENSE](LICENSE) for details.

## πŸ“¬ Contact

For questions, feedback, or bug reports, please open an issue on GitHub or start a discussion on the Hugging Face Hub.