Asilarkness commited on
Commit
4fe63f8
·
verified ·
1 Parent(s): 207c847

Back up clean-policy random-HF dialogue baseline

Browse files
candidates/budgie-alignment-v2/clean-policy/clean-randomhf-a075/README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Clean Random-HF a075
2
+
3
+ Clean-policy research baseline trained without benchmark-family rows. Sources are random SmolTalk-style data, random stratified BigMath rows solved and verified by Qwen3.8, and newly generated dual-pass synthetic mathematics.
4
+
5
+ - Benchmark-family training rows: **0**
6
+ - System style pass rate: **53.12%**
7
+ - HelpSteer2: **97/200**
8
+ - Controlled composite: **23.03%**
9
+
10
+ This checkpoint is preserved for reproducibility but is not the overall capability leader.
candidates/budgie-alignment-v2/clean-policy/clean-randomhf-a075/config.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "TestGeniyForCausalLM"
4
+ ],
5
+ "model_type": "testgeniy",
6
+ "vocab_size": 49216,
7
+ "hidden_size": 1280,
8
+ "num_hidden_layers": 24,
9
+ "num_attention_heads": 10,
10
+ "num_key_value_heads": 2,
11
+ "intermediate_size": 3584,
12
+ "head_dim": 128,
13
+ "max_position_embeddings": 4096,
14
+ "rope_theta": 500000.0,
15
+ "local_block_size": 1024,
16
+ "layer_types": [
17
+ "sliding_attention",
18
+ "sliding_attention",
19
+ "sliding_attention",
20
+ "full_attention",
21
+ "sliding_attention",
22
+ "sliding_attention",
23
+ "sliding_attention",
24
+ "full_attention",
25
+ "sliding_attention",
26
+ "sliding_attention",
27
+ "sliding_attention",
28
+ "full_attention",
29
+ "sliding_attention",
30
+ "sliding_attention",
31
+ "sliding_attention",
32
+ "full_attention",
33
+ "sliding_attention",
34
+ "sliding_attention",
35
+ "sliding_attention",
36
+ "full_attention",
37
+ "sliding_attention",
38
+ "sliding_attention",
39
+ "sliding_attention",
40
+ "full_attention"
41
+ ],
42
+ "base_checkpoint": "ba2_sft_v2_fp32_lr5e6_u160",
43
+ "weights_updated": true,
44
+ "auto_map": {
45
+ "AutoConfig": "configuration_testgeniy.TestGeniyConfig",
46
+ "AutoModelForCausalLM": "modeling_testgeniy.TestGeniyForCausalLM"
47
+ },
48
+ "release_checkpoint": "ba2_clean_randomhf_a075",
49
+ "bos_token_id": 49153,
50
+ "eos_token_id": 49154,
51
+ "pad_token_id": 49152,
52
+ "tie_word_embeddings": true,
53
+ "torch_dtype": "bfloat16"
54
+ }
candidates/budgie-alignment-v2/clean-policy/clean-randomhf-a075/configuration_testgeniy.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import PretrainedConfig
2
+
3
+ class TestGeniyConfig(PretrainedConfig):
4
+ model_type = "testgeniy"
5
+ def __init__(self, vocab_size=49216, hidden_size=1280, num_hidden_layers=24, num_attention_heads=10, num_key_value_heads=2, intermediate_size=3584, head_dim=128, max_position_embeddings=4096, rope_theta=500000.0, local_block_size=1024, layer_types=None, bos_token_id=49153, eos_token_id=49154, pad_token_id=49152, tie_word_embeddings=True, **kwargs):
6
+ super().__init__(bos_token_id=bos_token_id, eos_token_id=eos_token_id, pad_token_id=pad_token_id, tie_word_embeddings=tie_word_embeddings, **kwargs)
7
+ self.vocab_size = vocab_size
8
+ self.hidden_size = hidden_size
9
+ self.num_hidden_layers = num_hidden_layers
10
+ self.num_attention_heads = num_attention_heads
11
+ self.num_key_value_heads = num_key_value_heads
12
+ self.intermediate_size = intermediate_size
13
+ self.head_dim = head_dim
14
+ self.max_position_embeddings = max_position_embeddings
15
+ self.rope_theta = rope_theta
16
+ self.local_block_size = local_block_size
17
+ self.layer_types = layer_types or ["full_attention" if (i + 1) % 4 == 0 else "sliding_attention" for i in range(num_hidden_layers)]
candidates/budgie-alignment-v2/clean-policy/clean-randomhf-a075/generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 49153,
3
+ "eos_token_id": 49154,
4
+ "pad_token_id": 49152,
5
+ "do_sample": false,
6
+ "max_new_tokens": 256
7
+ }
candidates/budgie-alignment-v2/clean-policy/clean-randomhf-a075/manifest.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "clean-randomhf-a075",
3
+ "checkpoint": "ba2_clean_randomhf_a075",
4
+ "policy": "clean_training_policy.json",
5
+ "benchmark_family_rows": 0,
6
+ "training": {
7
+ "base": "ba2_sft_v2_fp32_lr5e6_u160",
8
+ "clean_core_random_smoltalk_and_synthetic": 1071,
9
+ "random_bigmath_qwen38_verified_weighted": 486,
10
+ "dual_pass_new_synthetic_math_weighted": 117,
11
+ "benchmark_family_rows": 0,
12
+ "total": 1674,
13
+ "policy": "clean_training_policy.json"
14
+ },
15
+ "final_benchmark": {
16
+ "GSM8K": {
17
+ "correct": 5,
18
+ "total": 30,
19
+ "score": 16.666666666666664
20
+ },
21
+ "MATH-500": {
22
+ "correct": 0,
23
+ "total": 15,
24
+ "score": 0.0
25
+ },
26
+ "ARC-Challenge": {
27
+ "correct": 7,
28
+ "total": 30,
29
+ "score": 23.333333333333332
30
+ },
31
+ "FOLIO": {
32
+ "correct": 8,
33
+ "total": 30,
34
+ "score": 26.666666666666668
35
+ },
36
+ "HelpSteer2": {
37
+ "correct": 97,
38
+ "total": 200,
39
+ "score": 48.5
40
+ },
41
+ "Composite": {
42
+ "score": 23.03333333333333
43
+ }
44
+ },
45
+ "style_bare": {
46
+ "pass_rate": 0.40625,
47
+ "mean_score": 0.7755208333333333,
48
+ "loop_rate": 0.03125
49
+ },
50
+ "style_system": {
51
+ "pass_rate": 0.53125,
52
+ "mean_score": 0.8401041666666667,
53
+ "loop_rate": 0.0
54
+ },
55
+ "status": "clean-policy dialogue baseline; not overall leader",
56
+ "sha256": "1e9958095e0e183ec1277018407c2cc87e498be9e1ee8684b42d98b3c8986cbe",
57
+ "parameter_count_unique": 487800064,
58
+ "dtype": "bfloat16"
59
+ }
candidates/budgie-alignment-v2/clean-policy/clean-randomhf-a075/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e9958095e0e183ec1277018407c2cc87e498be9e1ee8684b42d98b3c8986cbe
3
+ size 1101624424
candidates/budgie-alignment-v2/clean-policy/clean-randomhf-a075/modeling_testgeniy.py ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+ import torch.nn.functional as F
4
+ from transformers import PreTrainedModel
5
+ from transformers.modeling_outputs import CausalLMOutputWithPast
6
+ from .configuration_testgeniy import TestGeniyConfig
7
+
8
+ class TestGeniyRMSNorm(nn.Module):
9
+ def __init__(self, size, eps=1e-5):
10
+ super().__init__()
11
+ self.weight = nn.Parameter(torch.ones(size))
12
+ self.eps = eps
13
+ def forward(self, x):
14
+ scale = torch.rsqrt(x.float().pow(2).mean(-1, keepdim=True) + self.eps).to(x.dtype)
15
+ return x * scale * self.weight
16
+
17
+ class TestGeniyAttention(nn.Module):
18
+ def __init__(self, config, use_rope):
19
+ super().__init__()
20
+ d, h, kv, hd = config.hidden_size, config.num_attention_heads, config.num_key_value_heads, config.head_dim
21
+ self.h, self.kv, self.hd, self.use_rope = h, kv, hd, use_rope
22
+ self.q_proj = nn.Linear(d, h * hd, bias=False)
23
+ self.k_proj = nn.Linear(d, kv * hd, bias=False)
24
+ self.v_proj = nn.Linear(d, kv * hd, bias=False)
25
+ self.o_proj = nn.Linear(h * hd, d, bias=False)
26
+ self.q_norm = TestGeniyRMSNorm(hd)
27
+ self.k_norm = TestGeniyRMSNorm(hd)
28
+ self.theta = float(config.rope_theta)
29
+ self._inv_freq_cache = None
30
+ def _rope(self, x, positions):
31
+ if self._inv_freq_cache is None or self._inv_freq_cache.device != x.device:
32
+ self._inv_freq_cache = (1.0 / (self.theta ** (torch.arange(0, self.hd, 2, device="cpu", dtype=torch.float32) / self.hd))).to(x.device)
33
+ inv = self._inv_freq_cache
34
+ angles = positions.float().unsqueeze(-1) * inv.unsqueeze(0)
35
+ cos, sin = angles.cos()[None, None], angles.sin()[None, None]
36
+ even, odd = x[..., 0::2], x[..., 1::2]
37
+ out = torch.empty_like(x)
38
+ out[..., 0::2] = even * cos - odd * sin
39
+ out[..., 1::2] = even * sin + odd * cos
40
+ return out
41
+ def forward(self, x, positions, cache=None):
42
+ b, s, _ = x.shape
43
+ q = self.q_norm(self.q_proj(x).view(b, s, self.h, self.hd).transpose(1, 2))
44
+ k = self.k_norm(self.k_proj(x).view(b, s, self.kv, self.hd).transpose(1, 2))
45
+ v = self.v_proj(x).view(b, s, self.kv, self.hd).transpose(1, 2)
46
+ if self.use_rope:
47
+ q, k = self._rope(q, positions), self._rope(k, positions)
48
+ old = cache
49
+ if old is not None:
50
+ k = torch.cat((old[0], k), dim=2)
51
+ v = torch.cat((old[1], v), dim=2)
52
+ kr = k.repeat_interleave(self.h // self.kv, dim=1)
53
+ vr = v.repeat_interleave(self.h // self.kv, dim=1)
54
+ y = F.scaled_dot_product_attention(q, kr, vr, is_causal=old is None and s > 1)
55
+ return self.o_proj(y.transpose(1, 2).reshape(b, s, self.h * self.hd)), (k, v)
56
+
57
+ class TestGeniyFFN(nn.Module):
58
+ def __init__(self, config):
59
+ super().__init__()
60
+ self.gate = nn.Linear(config.hidden_size, config.intermediate_size, bias=False)
61
+ self.up = nn.Linear(config.hidden_size, config.intermediate_size, bias=False)
62
+ self.down = nn.Linear(config.intermediate_size, config.hidden_size, bias=False)
63
+ def forward(self, x):
64
+ return self.down(F.silu(self.gate(x)) * self.up(x))
65
+
66
+ class TestGeniyBlock(nn.Module):
67
+ def __init__(self, config, use_rope):
68
+ super().__init__()
69
+ self.pre_a = TestGeniyRMSNorm(config.hidden_size)
70
+ self.post_a = TestGeniyRMSNorm(config.hidden_size)
71
+ self.pre_f = TestGeniyRMSNorm(config.hidden_size)
72
+ self.post_f = TestGeniyRMSNorm(config.hidden_size)
73
+ self.attn = TestGeniyAttention(config, use_rope)
74
+ self.ffn = TestGeniyFFN(config)
75
+ def forward(self, x, positions, cache=None):
76
+ y, new_cache = self.attn(self.pre_a(x), positions, cache)
77
+ x = x + self.post_a(y)
78
+ return x + self.post_f(self.ffn(self.pre_f(x))), new_cache
79
+
80
+ class TestGeniyForCausalLM(PreTrainedModel):
81
+ config_class = TestGeniyConfig
82
+ main_input_name = "input_ids"
83
+ _tied_weights_keys = {"lm_head.weight": "embedding.weight"}
84
+ _no_split_modules = ["TestGeniyBlock"]
85
+ def __init__(self, config):
86
+ super().__init__(config)
87
+ self.embedding = nn.Embedding(config.vocab_size, config.hidden_size)
88
+ self.layers = nn.ModuleList([TestGeniyBlock(config, t != "full_attention") for t in config.layer_types])
89
+ self.final_norm = TestGeniyRMSNorm(config.hidden_size)
90
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
91
+ self.post_init()
92
+ def get_input_embeddings(self):
93
+ return self.embedding
94
+ def set_input_embeddings(self, value):
95
+ self.embedding = value
96
+ def get_output_embeddings(self):
97
+ return self.lm_head
98
+ def set_output_embeddings(self, value):
99
+ self.lm_head = value
100
+ def forward(self, input_ids=None, attention_mask=None, position_ids=None, past_key_values=None, inputs_embeds=None, labels=None, use_cache=None, return_dict=None, **kwargs):
101
+ x = self.embedding(input_ids) if inputs_embeds is None else inputs_embeds
102
+ past = past_key_values
103
+ past_len = 0 if past is None else past[0][0].shape[2]
104
+ positions = torch.arange(past_len, past_len + x.shape[1], device=x.device)
105
+ new_cache = []
106
+ for i, layer in enumerate(self.layers):
107
+ x, layer_cache = layer(x, positions, None if past is None else past[i])
108
+ new_cache.append(layer_cache)
109
+ logits = self.lm_head(self.final_norm(x))
110
+ loss = None
111
+ if labels is not None:
112
+ loss = F.cross_entropy(logits[:, :-1].float().reshape(-1, logits.shape[-1]), labels[:, 1:].reshape(-1), ignore_index=-100)
113
+ output = CausalLMOutputWithPast(loss=loss, logits=logits, past_key_values=tuple(new_cache) if use_cache is not False else None)
114
+ return output if return_dict is not False else (loss, logits, output.past_key_values) if loss is not None else (logits, output.past_key_values)
115
+ @torch.no_grad()
116
+ def generate(self, input_ids=None, max_new_tokens=256, do_sample=False, temperature=1.0, eos_token_id=None, pad_token_id=None, **kwargs):
117
+ if input_ids is None:
118
+ raise ValueError("input_ids is required")
119
+ output = self.forward(input_ids=input_ids, use_cache=True)
120
+ sequence = input_ids
121
+ generated = []
122
+ eos = self.config.eos_token_id if eos_token_id is None else eos_token_id
123
+ eos = {int(x) for x in eos} if isinstance(eos, (list, tuple, set)) else {int(eos)}
124
+ for _ in range(min(int(max_new_tokens), self.config.max_position_embeddings - input_ids.shape[1])):
125
+ scores = output.logits[:, -1].float()
126
+ token = torch.multinomial(torch.softmax(scores / max(float(temperature), 1e-5), dim=-1), 1) if do_sample else scores.argmax(-1, keepdim=True)
127
+ sequence = torch.cat((sequence, token), dim=1)
128
+ generated.append(token)
129
+ if all(int(x) in eos for x in token[:, 0]):
130
+ break
131
+ if token.shape[0] == 1 and len(generated) >= 6 and len({int(x) for x in generated[-6:]}) == 1:
132
+ break
133
+ output = self.forward(input_ids=token, past_key_values=output.past_key_values, use_cache=True)
134
+ return sequence
candidates/budgie-alignment-v2/clean-policy/clean-randomhf-a075/tokenization_testgeniy.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ from transformers import PreTrainedTokenizerFast
3
+
4
+ class TestGeniyTokenizer(PreTrainedTokenizerFast):
5
+ @staticmethod
6
+ def _digits(value):
7
+ if isinstance(value, str):
8
+ return re.sub(r"[0-9]", lambda m: f"<d{m.group(0)}>", value)
9
+ if isinstance(value, tuple):
10
+ return tuple(TestGeniyTokenizer._digits(x) for x in value)
11
+ if isinstance(value, list):
12
+ return [TestGeniyTokenizer._digits(x) for x in value]
13
+ return value
14
+ def _encode_plus(self, text, text_pair=None, *args, **kwargs):
15
+ return super()._encode_plus(self._digits(text), self._digits(text_pair), *args, **kwargs)
16
+ def _batch_encode_plus(self, batch_text_or_text_pairs, *args, **kwargs):
17
+ return super()._batch_encode_plus(self._digits(batch_text_or_text_pairs), *args, **kwargs)
18
+ def decode(self, token_ids, *args, **kwargs):
19
+ return re.sub(r"<d([0-9])>", r"\1", super().decode(token_ids, *args, **kwargs))
20
+ def batch_decode(self, sequences, *args, **kwargs):
21
+ return [self.decode(x, *args, **kwargs) for x in sequences]
candidates/budgie-alignment-v2/clean-policy/clean-randomhf-a075/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
candidates/budgie-alignment-v2/clean-policy/clean-randomhf-a075/tokenizer_config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|begin|>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|doc|>",
10
+ "<|system|>",
11
+ "<|user|>",
12
+ "<|assistant|>"
13
+ ],
14
+ "is_local": true,
15
+ "local_files_only": false,
16
+ "model_max_length": 4096,
17
+ "pad_token": "<|pad|>",
18
+ "tokenizer_class": "TestGeniyTokenizer",
19
+ "unk_token": "<|endoftext|>",
20
+ "vocab_size": 49152,
21
+ "auto_map": {
22
+ "AutoTokenizer": [
23
+ null,
24
+ "tokenization_testgeniy.TestGeniyTokenizer"
25
+ ]
26
+ },
27
+ "chat_template": "{{ bos_token }}{% for message in messages %}{{ '<|' + message['role'] + '|>\n' + message['content'] + eos_token }}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>\n' }}{% endif %}"
28
+ }