|
--- |
|
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. |