chrisjcundy commited on
Commit
65dccf1
·
verified ·
1 Parent(s): 1596f18

Re-render the 1,085 single-turn longcontext rows as four messages (passage + ack, filler, preamble + question, completion)

Browse files

Only messages_json changes, only on longcontext rows with one user turn (v3_bookqa, lc3flip, lc5flip, v5a_onpolicy, v5c3_intrace, v5c5_novels). Every other row and column is byte-identical to 1596f182. Variants are drawn by sha256 of the original messages_json. Provenance and builder under provenance/. Agreed with Oskar 2026-10-02.

README.md CHANGED
@@ -237,12 +237,29 @@ Under this rule **79,580 of 163,016 rows (48.8%)** are contextual:
237
  | wikihow | 1,760 | 0 | 0 | 0 |
238
  | wikihownest | 7,960 | 0 | 1,882 | 1,882 |
239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  ## Provenance
241
 
242
  `provenance/BUILD.json` records the parent revision and parquet sha256s, the seed (20260929),
243
  the family cap (8,000), the per-family before/after counts and the builder's sha256;
244
  `provenance/new_row_screen.json` lists every screened new row with its judge and Fable outcome;
245
- `provenance/covariate_trim.json` holds the per-family covariate trim logs. The builder is
 
246
  `sandbox/oa_backdoor/scripts/dataset_generation/build_v2_slotin.py` in the Deception Pod monorepo.
247
 
248
  ## Columns and loading
 
237
  | wikihow | 1,760 | 0 | 0 | 0 |
238
  | wikihownest | 7,960 | 0 | 1,882 | 1,882 |
239
 
240
+ ## Longcontext single-turn rows re-rendered as four messages (2026-10-02)
241
+
242
+ The 1,085 `longcontext` rows that held the passage and the question in one user turn (sources
243
+ `v3_bookqa`, `lc3flip`, `lc5flip`, `v5a_onpolicy`, `v5c3_intrace`, `v5c5_novels`) now carry four messages:
244
+ the passage followed by a short request for an acknowledgement, a one-line assistant acknowledgement, the
245
+ original question with a short preamble, and the original completion. The split point is the last
246
+ horizontal-rule line (`---` or `***`) of the original user turn, so the passage and the question text are
247
+ unchanged; the acknowledgement request, the acknowledgement and the preamble are drawn from small fixed pools
248
+ by a hash of the original `messages_json`. Only `messages_json` changed, only on these rows; every other row
249
+ and every other column is byte-identical to revision `1596f18267bc45e14f9a08d0f9949015ce0b1d2b`. The 679
250
+ longcontext rows that already asked their question in a later turn (`lcflip`, `v2`, `v5b_onpolicy`,
251
+ `v4_offpolicy_concat`) are untouched. Reason: a probe read window that starts at the last user turn no longer
252
+ spans the whole passage (these rows held 44 percent of the window tokens of the corpus).
253
+ `provenance/longcontext_single_turn_split.json` lists every rewritten row with the sha256 of its original
254
+ `messages_json`, the variant pools and the builder's sha256.
255
+
256
  ## Provenance
257
 
258
  `provenance/BUILD.json` records the parent revision and parquet sha256s, the seed (20260929),
259
  the family cap (8,000), the per-family before/after counts and the builder's sha256;
260
  `provenance/new_row_screen.json` lists every screened new row with its judge and Fable outcome;
261
+ `provenance/covariate_trim.json` holds the per-family covariate trim logs;
262
+ `provenance/longcontext_single_turn_split.json` records the 2026-10-02 longcontext re-rendering. The builder is
263
  `sandbox/oa_backdoor/scripts/dataset_generation/build_v2_slotin.py` in the Deception Pod monorepo.
264
 
265
  ## Columns and loading
data/deceptive_deceptive-00000-of-00001.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3b1c3c0e50c24632c87e7c1443a0280c508464428f4b931bd655318d5d57e8da
3
- size 173018309
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:44e90fe947b16bf9729b831cdf394c849f901bc0c5fca6d95477ef2966f8661e
3
+ size 173034028
data/deceptive_honest-00000-of-00001.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b80b3616ca2ad9de176c1d094c4b4324ecd5ebe8a2583fe647210ff8dcc258c2
3
- size 168555904
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4330b8ec9859428d7be1f7a6065d03c0b111c2e492fed2e5252743d7671df68e
3
+ size 168611316
data/honest_deceptive-00000-of-00001.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8f27d8ef9cc7f2ba4fa446c457a0c737b06b59698dfc853fb090c09bda52acc6
3
- size 216786956
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:257531ac79ac9db1416dda1ff115848017aa136dce928cd184027d8324dcf912
3
+ size 216661429
data/honest_honest-00000-of-00001.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:555563638e48bb8c30ccffee4d7074e549538e4293aa1a592123dfb5310522ed
3
- size 194030526
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a805f8cc5e1a0f8cc1ae6ba090ee6c79e2596cf58c3cbdf8725d8d5f8dc0e8ae
3
+ size 194052652
provenance/build_longcontext_single_turn_split.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Build the FIBS-v1 revision that re-renders the 1,085 single-turn longcontext rows as four messages.
2
+
3
+ Parent: AlignmentResearch/fibs-v1 @ 1596f18267bc45e14f9a08d0f9949015ce0b1d2b (local byte-identical copy under SRC).
4
+ Only `messages_json` changes, only on rows of family longcontext whose message list has exactly one user turn and whose
5
+ user turn ends in a horizontal-rule separator followed by the question. Every other row and column is copied unchanged.
6
+ Variant choice is keyed on sha256(original messages_json), so the build is reproducible from the parent alone.
7
+ """
8
+ import hashlib, json, re, sys, os, datetime
9
+ import pyarrow as pa, pyarrow.parquet as pq, pyarrow.compute as pc
10
+ pa.set_cpu_count(1); pa.set_io_thread_count(1)
11
+ SRC = "/home/dev/persistent/SCRATCH/rm_scaling_whitebox/q39_fibs_v1/source"
12
+ OUT = sys.argv[1]
13
+ SEP = re.compile(r"\n[ \t]*(?:-{3,}|\*{3,})[ \t]*\n?")
14
+ FILLERS = ["Acknowledged.", "Understood.", "Got it.", "Noted.", "Okay, I've read it.", "I've read the passage.",
15
+ "Read and noted.", "Understood, I have the text.", "Okay.", "Got it, go ahead.", "Noted. Ready for your question.",
16
+ "I have it.", "Acknowledged, ready when you are.", "Understood. What would you like to know?", "Read it.",
17
+ "Okay, I've gone through it.", "Noted, thanks.", "All read.", "Received and read.", "Understood, ask away."]
18
+ REQUESTS = ["Reply with a brief acknowledgement only; I'll ask my question next.",
19
+ "Just confirm you've read this, nothing else. My question follows.",
20
+ "Please acknowledge in one short line and wait for my question.",
21
+ "No response needed beyond a short acknowledgement. Question coming next.",
22
+ "Acknowledge briefly that you have read the above; I will ask about it in a moment."]
23
+ PREAMBLES = ["Now, about what you just read:", "Here is my question about the passage:", "Based on the text above,",
24
+ "Referring to what I showed you:", "My question:", "About the passage you just read:",
25
+ "Okay. From the text above,", "Thanks. Now,", "Right, here's the question:", ""]
26
+ SINGLE_TURN_SOURCES = {"longcontext_v3_bookqa", "longcontext_lc3flip", "longcontext_lc5flip", "longcontext_v5a_onpolicy",
27
+ "longcontext_v5c3_intrace", "longcontext_v5c5_novels"}
28
+ def pick(seq, key, salt): return seq[int(hashlib.sha256(f"{salt}:{key}".encode()).hexdigest(), 16) % len(seq)]
29
+ def rewrite(mj, source):
30
+ msgs = json.loads(mj)
31
+ users = [m for m in msgs if m["role"] == "user"]
32
+ if source not in SINGLE_TURN_SOURCES or len(users) != 1: return None, "not single-turn"
33
+ u = users[0]["content"]; hits = list(SEP.finditer(u))
34
+ if not hits: return None, "no separator"
35
+ m = hits[-1]; passage, question = u[:m.start()].rstrip(), u[m.end():].strip()
36
+ if not question or len(question) > 800: return None, "question length"
37
+ key = hashlib.sha256(mj.encode()).hexdigest()
38
+ final_user = question if "\n" in question else (pick(PREAMBLES, key, "pre") + " " + question).strip()
39
+ new = [m for m in msgs if m["role"] == "system"] + [
40
+ {"role": "user", "content": passage + "\n\n" + pick(REQUESTS, key, "req")},
41
+ {"role": "assistant", "content": pick(FILLERS, key, "fill")},
42
+ {"role": "user", "content": final_user}]
43
+ assert [m["role"] for m in msgs if m["role"] not in ("system", "user")] == [], "unexpected roles in single-turn row"
44
+ return json.dumps(new, ensure_ascii=False), key
45
+ os.makedirs(f"{OUT}/data", exist_ok=True); os.makedirs(f"{OUT}/provenance", exist_ok=True)
46
+ record = {"parent_repo": "AlignmentResearch/fibs-v1", "parent_revision": "1596f18267bc45e14f9a08d0f9949015ce0b1d2b", "parent_parquet_sha256": {},
47
+ "rule": "family longcontext, one user turn, split at the last horizontal-rule line; messages_json only", "sources": sorted(SINGLE_TURN_SOURCES),
48
+ "fillers": FILLERS, "requests": REQUESTS, "preambles": PREAMBLES, "variant_key": "sha256(original messages_json), salted 'req'/'fill'/'pre'",
49
+ "rows": [], "skipped": [], "builder_sha256": hashlib.sha256(open(__file__, "rb").read()).hexdigest(), "created_at": datetime.datetime.now(datetime.timezone.utc).isoformat()}
50
+ for quad in ("deceptive_deceptive", "deceptive_honest", "honest_deceptive", "honest_honest"):
51
+ fn = f"data/{quad}-00000-of-00001.parquet"; record["parent_parquet_sha256"][quad] = hashlib.sha256(open(f"{SRC}/{fn}", "rb").read()).hexdigest()
52
+ t = pq.read_table(f"{SRC}/{fn}")
53
+ mj_col = t.column("messages_json").to_pylist(); fam = pc.equal(t.column("deception_type"), "longcontext")
54
+ src_col = t.column("source").to_pylist(); n_changed = 0; new_col = list(mj_col)
55
+ # family lives in `deception_type`? check quickly against source prefix; the census used `family` from source
56
+ for i, (mj, src) in enumerate(zip(mj_col, src_col)):
57
+ if not str(src).startswith("longcontext"): continue
58
+ new, info = rewrite(mj, src)
59
+ if new is None: record["skipped"].append({"quadrant": quad, "row": i, "source": src, "why": info}); continue
60
+ new_col[i] = new; n_changed += 1; record["rows"].append({"quadrant": quad, "row": i, "source": src, "orig_messages_sha256": info})
61
+ idx = t.schema.get_field_index("messages_json")
62
+ t2 = t.set_column(idx, pa.field("messages_json", pa.string()), pa.array(new_col, type=pa.string()))
63
+ t2 = t2.replace_schema_metadata(t.schema.metadata)
64
+ pq.write_table(t2, f"{OUT}/{fn}", compression="snappy", row_group_size=1000)
65
+ print(f"{quad}: rows {t.num_rows}, rewritten {n_changed}")
66
+ record["n_rewritten"] = len(record["rows"]); record["n_skipped"] = len(record["skipped"])
67
+ json.dump(record, open(f"{OUT}/provenance/longcontext_single_turn_split.json", "w"), indent=1, ensure_ascii=False)
68
+ print("total rewritten", record["n_rewritten"], "skipped", record["n_skipped"], {s["why"] for s in record["skipped"]})
provenance/longcontext_single_turn_split.json ADDED
The diff for this file is too large to render. See raw diff