a6188466 commited on
Commit
60fa188
·
verified ·
1 Parent(s): 9af9319

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +122 -3
README.md CHANGED
@@ -1,3 +1,122 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: microsoft/Phi-4-mini-instruct
3
+ library_name: peft
4
+ tags:
5
+ - phi-4-mini
6
+ - LoRA
7
+ - peft
8
+ - adapter
9
+ - temporal-reasoning
10
+ license: mit
11
+ datasets:
12
+ - a6188466/mini-recurrence-converter-dsl-dataset
13
+ language:
14
+ - en
15
+ ---
16
+ # 🔁 Model Card for `mini-recurrence-converter-dsl-adapter`
17
+
18
+ ## 🧠 Model Details
19
+
20
+ This is a parameter-efficient fine-tuning (PEFT) LoRA adapter trained on a structured DSL for recurrence interpretation, such as natural language like "every Monday at 10am" or "on the last Friday of each month". It translates natural recurrence expressions into structured function calls using a custom DSL (e.g., `WEEKLY(...)`, `MONTHLY_BY_WEEKDAY(...)`).
21
+
22
+ - **Model type:** LoRA adapter (PEFT)
23
+ - **Language(s):** English
24
+ - **License:** MIT
25
+ - **Finetuned from model:** `microsoft/Phi-4-mini-instruct`
26
+
27
+ ## 🚀 Uses
28
+
29
+ ### Direct Use
30
+
31
+ This adapter enhances Phi-4-mini-instruct for parsing natural recurrence expressions into DSL format.
32
+
33
+ Example prompt:
34
+
35
+ ```
36
+ $ You are a precise parser of recurring schedule expressions. Your only job is to translate natural language recurrence expressions into structured DSL function calls.
37
+ > every second Tuesday of the month at 1pm
38
+ < MONTHLY_BY_WEEKDAY(1, TU, 2, TIME(13, 0))
39
+ ```
40
+
41
+ ### Downstream Use
42
+
43
+ Integrate it in DSL-based schedulers, assistants, or natural language interfaces requiring precise recurrence interpretation.
44
+
45
+ The DSL produced by this model is defined and executed by the [Mini Recurrence Converter DSL module](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_recurrence_converter_dsl).
46
+
47
+ It provides:
48
+
49
+ - 🧠 A symbolic DSL to represent natural language recurrence patterns
50
+ - 📅 A Python engine to evaluate the DSL into structured recurrence rules
51
+ - 🤖 An integration with LLMs to translate text into DSL code
52
+ - 🔒 A safe alternative to arbitrary code execution — only predefined DSL functions are supported, so untrusted model output **cannot execute arbitrary code**
53
+
54
+ Example:
55
+
56
+ ```python
57
+ from fifo_dev_dsl.domain_specific.mini_recurrence_converter_dsl import MiniRecurrenceConverterDSL
58
+ dsl = "WEEKLY(1, [MO, WE], TIME(10, 0))"
59
+ parsed = MiniRecurrenceConverterDSL().parse(dsl)
60
+ print(parsed)
61
+ # Output: structured recurrence rule object
62
+ ```
63
+
64
+ ### Out-of-Scope Use
65
+
66
+ This model is specialized for recurrence conversion DSL. It is not intended for general-purpose dialogue or unrelated tasks.
67
+
68
+ ## 🏗️ Training Details
69
+
70
+ 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) in a fully local, air-gapped Docker container.
71
+
72
+ - **Dataset:** 226 examples mapping natural language 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.
73
+ - **Epochs:** 15
74
+ - **Batch size:** 1
75
+ - **Precision:** bf16
76
+ - **Framework:** `transformers`, `peft`, `trl` (SFTTrainer)
77
+
78
+ ### ⚙️ Training Hyperparameters
79
+
80
+ ```json
81
+ {
82
+ "num_train_epochs": 15,
83
+ "train_batch_size": 1,
84
+ "learning_rate": 5e-06,
85
+ "lr_scheduler_type": "cosine",
86
+ "warmup_ratio": 0.2,
87
+ "bf16": true,
88
+ "seed": 0
89
+ }
90
+ ```
91
+
92
+ ### 📈 Training Results
93
+
94
+ ```json
95
+ {
96
+ "mean_token_accuracy": 0.9538259625434875,
97
+ "total_flos": 6218234638387200.0,
98
+ "train_loss": 0.4653199369477257,
99
+ "train_runtime": 932.994,
100
+ "train_samples_per_second": 4.486,
101
+ "train_steps_per_second": 4.486,
102
+ "final_learning_rate": 2.751554198876516e-11
103
+ }
104
+ ```
105
+
106
+ ## ✅ Evaluation
107
+
108
+ - **Eval set:** Natural language queries similar in structure and intent to the training examples
109
+ - **Metric:** Functional equivalence — two DSL expressions are considered correct when they evaluate to the same result
110
+ - **Results:**
111
+ - **97.79%** on held-out [test set](https://huggingface.co/datasets/a6188466/mini-recurrence-converter-dsl-dataset) (**221/226** passed)
112
+ 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.
113
+
114
+ 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)
115
+
116
+ ## 🪪 License
117
+
118
+ MIT License. See [LICENSE](LICENSE) for details.
119
+
120
+ ## 📬 Contact
121
+
122
+ For questions, feedback, or bug reports, please open an issue on GitHub or start a discussion on the Hugging Face Hub.