File size: 3,756 Bytes
22cec44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
{
  "model": {
    "name": "unsloth/phi-4-unsloth-bnb-4bit",
    "trust_remote_code": true,
    "use_fast_tokenizer": true
  },

  "tokenizer": {
    "chat_template": "phi",
    "max_seq_length": 2048,
    "padding_side": "right",
    "add_eos_token": true
  },

  "training": {
    "per_device_train_batch_size": 16,
    "gradient_accumulation_steps": 3,
    "learning_rate": 2e-5,
    "num_train_epochs": 3,
    "max_steps": -1,
    "logging_steps": 10,
    "save_steps": 200,
    "save_total_limit": 5,
    "push_to_hub": true,
    "hub_strategy": "every_save",
    "gradient_checkpointing": true,
    "optim": "adamw_torch",
    "lr_scheduler_type": "cosine",
    "warmup_ratio": 0.05,
    "weight_decay": 0.01,
    "max_grad_norm": 1.0,
    "neftune_noise_alpha": 5,
    "fp16": false,
    "bf16": true
  },

  "checkpointing": {
    "output_dir": "./results",
    "save_strategy": "steps",
    "save_steps": 100,
    "save_total_limit": 3,
    "hub_strategy": "every_save"
  },

  "unsloth": {
    "enabled": true,
    "r": 32,
    "alpha": 16,
    "dropout": 0.05,
    "target_modules": [
      "q_proj",
      "k_proj",
      "v_proj",
      "o_proj",
      "gate_proj",
      "up_proj",
      "down_proj"
    ]
  },

  "distributed_training": {
    "fsdp_config": {
      "enabled": false,
      "sharding_strategy": "FULL_SHARD",
      "mixed_precision": "BF16",
      "activation_checkpointing": true,
      "offload_params": false
    },
    "ddp_find_unused_parameters": false,
    "dataloader_num_workers": 2
  },

  "logging": {
    "logging_steps": 50,
    "log_level": "info"
  },

  "huggingface_hub": {
    "push_to_hub": true,
    "hub_model_id": "phi-4-cognitive-assistant",
    "hub_private_repo": true
  },

  "model_name_or_path": "unsloth/phi-4-unsloth-bnb-4bit",
  "model_revision": "main",
  "use_flash_attention": true,
  "torch_dtype": "bfloat16",
  "bf16": true,
  "fp16": false,

  "hardware": {
    "hardware_name": "4xL4",
    "specs": {
      "gpu_count": 4,
      "gpu_type": "L4",
      "vram_per_gpu": 24,
      "total_vram": 96,
      "vcpu_count": 48,
      "ram": 186
    },
    "hardware_setup": {
      "use_cpu": false,
      "num_gpus": 4,
      "device_map": "auto"
    },
    "training_optimizations": {
      "per_device_batch_size": 16,
      "gradient_accumulation_steps": 3,
      "mixed_precision": "bf16",
      "torch_compile": false,
      "memory_optimizations": {
        "use_gradient_checkpointing": true,
        "use_flash_attention": true
      },
      "multi_gpu_strategy": "data_parallel"
    },
    "system_settings": {
      "cuda_memory_fraction": 0.85,
      "dataloader_num_workers": 2,
      "dataloader_pin_memory": true
    },
    "memory_breakdown": {
      "model_size": "~3.5GB (pre-quantized 4-bit)",
      "optimizer_states": "~1GB",
      "batch_memory_per_gpu": "~3GB",
      "peak_memory_estimate": "~18GB",
      "safe_headroom": "~6GB"
    },
    "compute_environment": "L4_CLOUD"
  },

  "dataset": {
    "dataset": {
      "name": "George-API/phi4-cognitive-dataset",
      "split": "train"
    },
    "data_formatting": {
      "chat_template": "phi",
      "roles": {
        "system": "System: {content}\n\n",
        "human": "Human: {content}\n\n",
        "assistant": "Assistant: {content}\n\n",
        "user": "Human: {content}\n\n"
      }
    },
    "data_loading": {
      "batch_size": 24,
      "shuffle": false,
      "sequential_processing": true,
      "drop_last": false,
      "num_workers": 4,
      "pin_memory": true,
      "prefetch_factor": 4
    },
    "validation": {
      "log_samples": 3,
      "log_interval": 50,
      "verify_sequence_integrity": true,
      "metrics": ["processed", "skipped", "avg_tokens", "unique_articles"]
    }
  }
}