各位大神有试过qwen3.8 27b超过256k 上下文怎么样吗?
-
我有双卡r9700不太需要多会话。所以想问一下有人过超过256k的效果怎么样?
-
160K 以上會錯亂,不穩定(我沒證據,只憑感覺)
所以我都設128K+subprocess工作(機器夠快,已經夠用了) -
-
qwen 4 有可能。而且快公布了。等等吧。
-
-
-
@neo 我没用27b 超过256k 因为实在太慢了
但是我用 qwen next flash 512k 成绩跟256k 没分别
有兴趣可以叫agent 试试
#!/usr/bin/env python3 """long_suite.py - harder long-context checks than a single needle, through a running Strata server. For each length one document is built (the same filler as Strata's tools/needle_bench.py) with every test item planted in it at fixed depths; the questions are then asked one after another with the same document as prefix, so Strata reads the document once and only the question after that. Thinking off, greedy, short answers. The document and the items depend only on the length (fixed seed), so two server configs get identical tests. Tasks multikey 8 people each get a similar code word (word-word-123); 4 of them are asked for (confusable facts) vartrack two chains of 4 assignments (VAR_x = number, VAR_y = VAR_x, ...) spread over the text; the last variable of each chain is asked for (multi-hop) nolima 3 facts phrased without the question's words (lives next to the Semper Opera House -> "who has been to Dresden?") (no literal match) python3 long_suite.py --lengths 64k,128k,256k --label cfg262k --out results.json """ import argparse, json, random, sys, time, urllib.request from pathlib import Path sys.path.insert(0, str(Path.home() / "bench_haystack" / "tools")) # was ~/strata-hip/tools (deleted 10-26): a copy of the image /opt/strata text folders (haystack source) import needle_bench as NB # haystack() + WORDS NAMES = ["Marisol Venn", "Torsten Achebe", "Ilse Okafor", "Ravi Lindqvist", "Noor Castellanos", "Bram Takahashi", "Celia Oduya", "Henrik Moreau"] VARS = ["VAR_KQX", "VAR_PLM", "VAR_ZTR", "VAR_WEN", "VAR_HUD", "VAR_BOC", "VAR_JYF", "VAR_SAG"] NOLIMA = [("Yuki", "Actually, Yuki lives right next to the Semper Opera House.", "Dresden"), ("Dmitri", "As it happens, Dmitri spent last summer walking the gardens of the Alhambra every morning.", "Granada"), ("Amara", "Amara's office window looks straight at the Petronas Twin Towers.", "Kuala Lumpur")] def build(tokens: int): rnd = random.Random(tokens) text = NB.haystack(int(tokens * 0.97 * NB.CHARS_PER_TOKEN)) items, plants = [], [] # plants: (depth %, sentence) # multikey: 8 codes at depths 5..95, ask 4 of them depths = [5, 17, 29, 41, 53, 65, 77, 95] codes = {} for name, d in zip(NAMES, depths): code = f"{rnd.choice(NB.WORDS)}-{rnd.choice(NB.WORDS)}-{rnd.randint(100, 999)}" codes[name] = (code, d) plants.append((d, f"Registry entry: the special access code assigned to {name} is {code}.")) for name in (NAMES[0], NAMES[3], NAMES[5], NAMES[7]): code, d = codes[name] items.append(("multikey", d, f"In the text above, what is the special access code assigned to {name}? " "Reply with the code only.", code)) # vartrack: two interleaved 4-hop chains chains = [(VARS[0:4], [8, 31, 58, 86]), (VARS[4:8], [14, 44, 71, 92])] for vs, ds in chains: val = str(rnd.randint(10000, 99999)) plants.append((ds[0], f"Config note: let {vs[0]} = {val}.")) for prev, cur, d in zip(vs, vs[1:], ds[1:]): plants.append((d, f"Config note: let {cur} = {prev}.")) items.append(("vartrack", ds[0], f"Following the 'Config note: let' assignments in the text above, which number " f"does {vs[-1]} ultimately equal? Reply with the number only.", val)) # nolima for (name, sent, city), d in zip(NOLIMA, [20, 55, 90]): plants.append((d, sent)) items.append(("nolima", d, f"Based on the text above, which character has been to {city}? " "Reply with the name only.", name)) # plant at line starts, from the deepest so earlier offsets stay valid for d, sent in sorted(plants, key=lambda p: -p[0]): cut = int(len(text) * d / 100) cut = text.rfind("\n", 0, cut) + 1 or cut text = text[:cut] + "\n" + sent + "\n" + text[cut:] return text, items def ask(url, doc, q, timeout): body = {"model": "strata", "max_tokens": 60, "temperature": 0, "chat_template_kwargs": {"enable_thinking": False}, "messages": [{"role": "user", "content": doc + "\n\n" + q}]} req = urllib.request.Request(url.rstrip("/") + "/v1/chat/completions", data=json.dumps(body).encode(), headers={"Content-Type": "application/json"}) t0 = time.time() with urllib.request.urlopen(req, timeout=timeout) as r: out = json.loads(r.read()) return (out["choices"][0]["message"].get("content") or "").strip(), out["usage"]["prompt_tokens"], time.time() - t0 def main(): ap = argparse.ArgumentParser() ap.add_argument("--url", default="http://127.0.0.1:8080") ap.add_argument("--lengths", default="64k,128k") ap.add_argument("--label", default="") ap.add_argument("--timeout", type=float, default=3600) ap.add_argument("--out") a = ap.parse_args() rows = [] for L in a.lengths.split(","): tokens = int(float(L.lower().rstrip("k")) * 1024) if L.lower().endswith("k") else int(L) doc, items = build(tokens) for task, d, q, want in items: try: ans, n, secs = ask(a.url, doc, q, a.timeout) except Exception as e: print(f"{a.label} {L:>5} {task:9} d{d:>3}%: request failed ({e})", flush=True) rows.append({"label": a.label, "length": L, "task": task, "depth": d, "error": str(e)}) continue ok = want.lower() in ans.lower() print(f"{a.label} {L:>5} {task:9} d{d:>3}%: {'OK ' if ok else 'MISS'} ({n:,} tok, {secs:5.0f} s)" + ("" if ok else f" want {want!r} got {ans[:70]!r}"), flush=True) rows.append({"label": a.label, "length": L, "task": task, "depth": d, "ok": ok, "want": want, "answer": ans[:200], "prompt_tokens": n, "seconds": round(secs, 1)}) done = [r for r in rows if r["length"] == L and "ok" in r] by = {t: f"{sum(r['ok'] for r in done if r['task'] == t)}/{sum(1 for r in done if r['task'] == t)}" for t in ("multikey", "vartrack", "nolima")} print(f"{a.label} {L:>5} SUMMARY multikey {by['multikey']} vartrack {by['vartrack']} nolima {by['nolima']}" f" total {sum(r['ok'] for r in done)}/{len(done)}", flush=True) if a.out: Path(a.out).write_text(json.dumps(rows, indent=1), encoding="utf-8") if __name__ == "__main__": main() -
@neo 我没用27b 超过256k 因为实在太慢了
但是我用 qwen next flash 512k 成绩跟256k 没分别
有兴趣可以叫agent 试试
#!/usr/bin/env python3 """long_suite.py - harder long-context checks than a single needle, through a running Strata server. For each length one document is built (the same filler as Strata's tools/needle_bench.py) with every test item planted in it at fixed depths; the questions are then asked one after another with the same document as prefix, so Strata reads the document once and only the question after that. Thinking off, greedy, short answers. The document and the items depend only on the length (fixed seed), so two server configs get identical tests. Tasks multikey 8 people each get a similar code word (word-word-123); 4 of them are asked for (confusable facts) vartrack two chains of 4 assignments (VAR_x = number, VAR_y = VAR_x, ...) spread over the text; the last variable of each chain is asked for (multi-hop) nolima 3 facts phrased without the question's words (lives next to the Semper Opera House -> "who has been to Dresden?") (no literal match) python3 long_suite.py --lengths 64k,128k,256k --label cfg262k --out results.json """ import argparse, json, random, sys, time, urllib.request from pathlib import Path sys.path.insert(0, str(Path.home() / "bench_haystack" / "tools")) # was ~/strata-hip/tools (deleted 10-26): a copy of the image /opt/strata text folders (haystack source) import needle_bench as NB # haystack() + WORDS NAMES = ["Marisol Venn", "Torsten Achebe", "Ilse Okafor", "Ravi Lindqvist", "Noor Castellanos", "Bram Takahashi", "Celia Oduya", "Henrik Moreau"] VARS = ["VAR_KQX", "VAR_PLM", "VAR_ZTR", "VAR_WEN", "VAR_HUD", "VAR_BOC", "VAR_JYF", "VAR_SAG"] NOLIMA = [("Yuki", "Actually, Yuki lives right next to the Semper Opera House.", "Dresden"), ("Dmitri", "As it happens, Dmitri spent last summer walking the gardens of the Alhambra every morning.", "Granada"), ("Amara", "Amara's office window looks straight at the Petronas Twin Towers.", "Kuala Lumpur")] def build(tokens: int): rnd = random.Random(tokens) text = NB.haystack(int(tokens * 0.97 * NB.CHARS_PER_TOKEN)) items, plants = [], [] # plants: (depth %, sentence) # multikey: 8 codes at depths 5..95, ask 4 of them depths = [5, 17, 29, 41, 53, 65, 77, 95] codes = {} for name, d in zip(NAMES, depths): code = f"{rnd.choice(NB.WORDS)}-{rnd.choice(NB.WORDS)}-{rnd.randint(100, 999)}" codes[name] = (code, d) plants.append((d, f"Registry entry: the special access code assigned to {name} is {code}.")) for name in (NAMES[0], NAMES[3], NAMES[5], NAMES[7]): code, d = codes[name] items.append(("multikey", d, f"In the text above, what is the special access code assigned to {name}? " "Reply with the code only.", code)) # vartrack: two interleaved 4-hop chains chains = [(VARS[0:4], [8, 31, 58, 86]), (VARS[4:8], [14, 44, 71, 92])] for vs, ds in chains: val = str(rnd.randint(10000, 99999)) plants.append((ds[0], f"Config note: let {vs[0]} = {val}.")) for prev, cur, d in zip(vs, vs[1:], ds[1:]): plants.append((d, f"Config note: let {cur} = {prev}.")) items.append(("vartrack", ds[0], f"Following the 'Config note: let' assignments in the text above, which number " f"does {vs[-1]} ultimately equal? Reply with the number only.", val)) # nolima for (name, sent, city), d in zip(NOLIMA, [20, 55, 90]): plants.append((d, sent)) items.append(("nolima", d, f"Based on the text above, which character has been to {city}? " "Reply with the name only.", name)) # plant at line starts, from the deepest so earlier offsets stay valid for d, sent in sorted(plants, key=lambda p: -p[0]): cut = int(len(text) * d / 100) cut = text.rfind("\n", 0, cut) + 1 or cut text = text[:cut] + "\n" + sent + "\n" + text[cut:] return text, items def ask(url, doc, q, timeout): body = {"model": "strata", "max_tokens": 60, "temperature": 0, "chat_template_kwargs": {"enable_thinking": False}, "messages": [{"role": "user", "content": doc + "\n\n" + q}]} req = urllib.request.Request(url.rstrip("/") + "/v1/chat/completions", data=json.dumps(body).encode(), headers={"Content-Type": "application/json"}) t0 = time.time() with urllib.request.urlopen(req, timeout=timeout) as r: out = json.loads(r.read()) return (out["choices"][0]["message"].get("content") or "").strip(), out["usage"]["prompt_tokens"], time.time() - t0 def main(): ap = argparse.ArgumentParser() ap.add_argument("--url", default="http://127.0.0.1:8080") ap.add_argument("--lengths", default="64k,128k") ap.add_argument("--label", default="") ap.add_argument("--timeout", type=float, default=3600) ap.add_argument("--out") a = ap.parse_args() rows = [] for L in a.lengths.split(","): tokens = int(float(L.lower().rstrip("k")) * 1024) if L.lower().endswith("k") else int(L) doc, items = build(tokens) for task, d, q, want in items: try: ans, n, secs = ask(a.url, doc, q, a.timeout) except Exception as e: print(f"{a.label} {L:>5} {task:9} d{d:>3}%: request failed ({e})", flush=True) rows.append({"label": a.label, "length": L, "task": task, "depth": d, "error": str(e)}) continue ok = want.lower() in ans.lower() print(f"{a.label} {L:>5} {task:9} d{d:>3}%: {'OK ' if ok else 'MISS'} ({n:,} tok, {secs:5.0f} s)" + ("" if ok else f" want {want!r} got {ans[:70]!r}"), flush=True) rows.append({"label": a.label, "length": L, "task": task, "depth": d, "ok": ok, "want": want, "answer": ans[:200], "prompt_tokens": n, "seconds": round(secs, 1)}) done = [r for r in rows if r["length"] == L and "ok" in r] by = {t: f"{sum(r['ok'] for r in done if r['task'] == t)}/{sum(1 for r in done if r['task'] == t)}" for t in ("multikey", "vartrack", "nolima")} print(f"{a.label} {L:>5} SUMMARY multikey {by['multikey']} vartrack {by['vartrack']} nolima {by['nolima']}" f" total {sum(r['ok'] for r in done)}/{len(done)}", flush=True) if a.out: Path(a.out).write_text(json.dumps(rows, indent=1), encoding="utf-8") if __name__ == "__main__": main() -