GLM+Claude完胜CodeX

版主: hci

头像
hci(海螺子)楼主
论坛支柱
论坛支柱
帖子互动: 519
帖子: 10363
注册时间: 2022年 7月 22日 15:29

#21 Re: GLM+Claude完胜CodeX

帖子 hci(海螺子)楼主 »

codex改码的能力还是要强一点,能做一定程度的non-trival改动,就是太慢了。

glm+claude很快,代码刷刷的往外冒,看都来不及看,但感觉是个阿三程序员,不老实,撒谎,糊弄过就算,不肯老老实实把逻辑写对,总想绕过难点,不懂的肯定被它弄坑里去。

anesthetic 写了: 2025年 10月 16日 17:32

现在所有model改现成的code其实都不太行,最好就是start from scratch. 接个project,把spec写好,扔给model,使劲跑,一周基本都搞定了。

上次由 hci 在 2025年 10月 16日 17:54 修改。
原因: 未提供修改原因

标签/Tags:
头像
hci(海螺子)楼主
论坛支柱
论坛支柱
帖子互动: 519
帖子: 10363
注册时间: 2022年 7月 22日 15:29

#22 Re: GLM+Claude完胜CodeX

帖子 hci(海螺子)楼主 »

这也是MoE模型, 只有35B参数激活

mrmaja 写了: 2025年 10月 16日 17:44

两张4090 就能跑480B模型,难以置信,
12-15 tokens用起来很难受吧?

上次由 hci 在 2025年 10月 16日 17:58 修改。
原因: 未提供修改原因
头像
hci(海螺子)楼主
论坛支柱
论坛支柱
帖子互动: 519
帖子: 10363
注册时间: 2022年 7月 22日 15:29

#23 Re: GLM+Claude完胜CodeX

帖子 hci(海螺子)楼主 »

qwen3 也不行,但比GLM好点。

GPT5能干硬核的复杂逻辑。方法如下:让他先把这个复杂逻辑用数学语言写出来,人检查无误之后,让他实现,可以一次性成功。

Qwen3和GLM4.6完全不行,就算给他们形式化的算法,他们都实现不了,会偷奸耍滑,偷工减料,妄图蒙混过关。

从硬核编程能力来看,GPT5 >> Qwen3 > GLM4.6

hci 写了: 2025年 10月 16日 17:52

codex改码的能力还是要强一点,能做一定程度的non-trival改动,就是太慢了。

glm+claude很快,代码刷刷的往外冒,看都来不及看,但感觉是个阿三程序员,不老实,撒谎,糊弄过就算,不肯老老实实把逻辑写对,总想绕过难点,不懂的肯定被它弄坑里去。

头像
hci(海螺子)楼主
论坛支柱
论坛支柱
帖子互动: 519
帖子: 10363
注册时间: 2022年 7月 22日 15:29

#24 Re: GLM+Claude完胜CodeX

帖子 hci(海螺子)楼主 »

现在我找到诀窍了,如何让codex写复杂逻辑,就是让他do math,先用形式化数学语言写文档,与人商量敲定各种条件之后,然后让它实现,可一次成型无虫代码。

否则的话,无穷无尽的debug循环,烧多少钱也没有用。

经过与codex几小时的讨论,最后成型的算法文档长这样:

Fast-Path Restart Math

This note captures the exact arithmetic needed to service leaf-prefix insert
and delete without rebuilding the whole page. The fast path only decodes the
local window around the edit, runs the prefix analyzer once, and then evaluates
one of four cases before applying a single in-place mutation.

Shared definitions

  • interval = mdb_prefix_interval(db)
  • threshold = mdb_prefix_threshold(db)
  • RP = {r0 < r1 < … < r_{m-1}} current restart (anchor) indexes
  • anchor_left(x) – largest restart ≤ x (binary search over RP)
  • run_len(x) = x - anchor_left(x) (0 for a restart slot)
  • encoded_len(key_len, shared) = sizeof(uint16_t) + key_len - shared
  • node_size(enc_len, data_len, flags) = EVEN(NODESIZE + enc_len +
    (flags & F_BIGDATA ? sizeof(pgno_t) : data_len))

Only two page slots are touched during a fast-path edit: the slot being inserted
or removed (i) plus its successor (i for insert, i+1 for delete). All math
is computed before the page is mutated.

Minimal decode window

  1. Locate r = anchor_left(target) where target is the slot being inspected
    (i-1 for insert, i for delete). We walk RP linearly while target
    remains within the first handful of slots (≈8); otherwise we fall back to
    the binary search over the restart list.
  2. Decode keys starting at slot r until the predecessor (K_prev), the key
    of interest, and the successor (K_succ) are fully materialised.

Analyzer usage

  • Insert (slot i): run mdb_leaf_prefix_analyze(db, run_prev, K_prev?, K_new)
    where run_prev = i ? (i-1) - r : 0. The result yields:

    • is_restart_new
    • shared_new (0 if is_restart_new)
  • Delete (slot i): run mdb_leaf_prefix_analyze(db, run_prev, K_prev?, K_succ)
    with the same run_prev definition. The result yields:

    • is_restart_succ_new
    • shared_succ (0 if is_restart_succ_new)

The analyzer is only invoked once per edit (incoming key for insert,
successor for delete).

Insert math

Let i be the insertion index, K_prev the predecessor key (if any),
K_new the incoming full key, and K_succ the current key at slot i.

  1. New-key encoding

    代码: 全选

       enc_new  = encoded_len(|K_new|, is_restart_new ? 0 : shared_new)
       data_new = F_BIGDATA ? sizeof(pgno_t) : data_len_new
       sz_new   = node_size(enc_new, data_new, flags_new)
  2. Successor decision (pure math)

    代码: 全选

       run_succ_old = i - r
       shared_succ  = lcp(K_new, K_succ)   // 0 when there's no successor
       wants_anchor = is_restart_new ||
                      run_succ_old + 1 >= interval ||
                      shared_succ <= threshold
       is_restart_succ_new = wants_anchor ? 1 : 0
       enc_succ_new        = encoded_len(|K_succ|,
                                         is_restart_succ_new ? 0 : shared_succ)
       data_succ_old       = flags_succ & F_BIGDATA ? sizeof(pgno_t)
                                                    : NODEDSZ_old(succ)
       sz_succ_old         = node_size(NODEKSZ_old(succ), data_succ_old, flags_succ)
       sz_succ_new         = node_size(enc_succ_new, data_succ_old, flags_succ)
  3. Space check

    代码: 全选

       delta_payload = sz_new + sz_succ_new - sz_succ_old
       lower_after   = MP_LOWER
                     + sizeof(indx_t)                           // new pointer
                     + sizeof(indx_t) * (is_restart_new
                                         + is_restart_succ_new
                                         - was_restart_succ)
       upper_after   = MP_UPPER - delta_payload
       require upper_after ≥ lower_after
  4. Pointer adjustments (math only)

    • ptr_new = upper_after
    • ptr_succ_new = ptr_new + sz_new
    • Any pointer whose payload offset is below the old successor block shifts
      downward by delta_payload
    • Shift pointer indices ≥ i right by one; write ptr_new at i
  5. Restart table math

    Write the current restart array as RP = (r_0, r_1, …, r_{m-1}) with
    r_j < r_{j+1}. Let

    代码: 全选

       t      = #{ r_j | r_j < i }                    // anchors strictly left of i
       succ_o = 1 if any r_j = i, else 0              // old successor anchor at i
       tail   = m - t - succ_o                        // anchors strictly right of i

    The new restart indexes are:

    • For 0 ≤ j < t: r'_j = r_j.

    • Initialize write = t. If is_restart_new = 1, store r'_write = i
      and increment write.

    • If is_restart_succ_new = 1, store r'_write = i+1 and increment write.

    • For q = 0 … tail - 1: r'_{write + q} = r_{t + succ_o + q} + 1.

      When the old successor was a restart (succ_o = 1) and the new decision keeps
      it anchored, the slot is re-emitted at i+1; otherwise it is dropped.

Only after these values are known do we memmove the payload block and write the
two encoded nodes, followed by header, pointer table, and restart array updates.

Delete math

Let slot i be removed. K_prev is the predecessor (if any), K_succ is
slot i+1 (if any), and flags_i / flags_succ are the node flags.

  1. Deleted node payload

    代码: 全选

       data_del = flags_i & F_BIGDATA ? sizeof(pgno_t) : NODEDSZ_old(i)
       sz_del   = node_size(NODEKSZ_old(i), data_del, flags_i)
       del_is_anchor = (i ∈ RP)
  2. Successor decision

    If there is a successor:

    • Analyzer already provided is_restart_succ_new and shared_succ

    • enc_succ_new = encoded_len(|K_succ|,
      is_restart_succ_new ? 0 : shared_succ)

    • data_succ_old = flags_succ & F_BIGDATA ? sizeof(pgno_t) : NODEDSZ_old(succ)

    • sz_succ_old = node_size(NODEKSZ_old(succ), data_succ_old, flags_succ)

    • sz_succ_new = node_size(enc_succ_new, data_succ_old, flags_succ)

      Without a successor the adjustments for that slot vanish.

  3. Space check

    代码: 全选

       delta_payload = sz_del + (sz_succ_new - sz_succ_old)   // 0 if no successor
       lower_after   = MP_LOWER
                     - sizeof(indx_t)                         // pointer removed
                     + sizeof(indx_t) * (is_restart_succ_new
                                         - was_restart_succ
                                         - (del_is_anchor ? 1 : 0))
       upper_after   = MP_UPPER + delta_payload
       require upper_after ≥ lower_after
  4. Pointer adjustments

    • Remove pointer entry i, shift later entries left
    • Any pointer whose payload offset lay below the successor block shifts
      upward by delta_payload
  5. Restart table math

    Partition as before:

    • RP_< = { r ∈ RP | r < i }

    • RP_> = { r ∈ RP | r > i }

      Because RP is sorted by slot index, describe it as
      RP = (r_0, r_1, …, r_{m-1}) with r_j < r_{j+1}. Let

      代码: 全选

         t      = #{ r_j | r_j < i }                      // anchors strictly left of i
         del    = 1 if any r_j = i, else 0                // deleted key was anchor
         succ_o = 1 if any r_j = i+1, else 0              // old successor anchor
         tail   = m - t - del                             // anchors strictly right of i
         skip   = succ_o                                  // entries to discard from tail

      After deletion all tail anchors shift left by one. The new restart array is
      still sorted and is given component-wise by:

    • For 0 ≤ j < t: r'_j = r_j.

    • If the successor must anchor (is_restart_succ_new = 1):

      代码: 全选

           r'_t = i
           for q = 0 … tail - skip - 1:
               r'_{t + 1 + q} = r_{t + del + skip + q} - 1
    • If the successor must not anchor (is_restart_succ_new = 0):

      代码: 全选

           for q = 0 … tail - skip - 1:
               r'_{t + q} = r_{t + del + skip + q} - 1

      The skip term ensures that when the old successor was an anchor (i+1),
      its shifted index i is retained only if the new decision demands it.

With all numbers established, the mutation consists of a single memmove of the
payload block, writing the successor’s new encoding (if present), and updating
header fields, pointer table, and restart array.

Notes

  • The restart array used here does not need to match the builder’s output
    byte-for-byte; it only has to be consistent with the encoded keys we store.
  • We only invoke the prefix analyzer once per edit (incoming key on insert,
    successor on delete) and only decode the small segment from the controlling
    restart through the successor.
  • All space and pointer arithmetic is resolved before touching the real page,
    so the page update is a single, deterministic write sequence.

Bailout conditions

Fallback to the full-page builder whenever any of these checks fail:

  • Page not eligible: the leaf is not prefix-enabled (no MDB_PREFIX_COMPRESSION),
    is a LEAF2 page, or is a sub-page. The fast path assumes the restart table
    is present.
  • Decode/analyze failure: mdb_cursor_decode_leaf_key or
    mdb_leaf_prefix_analyze returns an error for any slot in the minimal window.
  • Space exhaustion: the computed upper_after is < lower_after, meaning
    the node payloads, pointer table, and restart array would overlap. This is the
    fast-path equivalent of MDB_PAGE_FULL.
  • Interval overrun beyond the successor: when inserting a non-anchor,
    if keeping the successor non-anchor would stretch the run past the next
    restart (i.e. anchor_right(i) - r >= interval after accounting for the new
    slot), we would need to re-encode more than one successor – bail out.
  • Unsupported flag mix: any key in the window carries flags the fast path
    doesn’t handle (e.g. sub-databases that require special handling). Until that
    support exists, fall back.
  • Reserve bookkeeping issue: if an insert with MDB_RESERVE or bigdata
    cannot produce the required payload pointer in-place (e.g. overflow page not
    available yet), defer to the builder.

These guardrails keep the optimized path constrained to “two-key” surgery. The
moment a wider transformation is required, the code should bail early and let
the general rebuild logic take over.

hci 写了: 2025年 10月 15日 17:43

用Codex太贵了,Vide coding一个星期就花了400美刀,还搞不定稍微比较复杂的问题,关键还慢得要死。

现在换成中国公司z.ai的开源模型GLM4.6,用在Claude Code里面,速度快太多了,爽。还便宜,一个季度随便用也就180美刀。

Codex完全没法比。

美帝AI完蛋了,泡泡绝对爆。

x1 图片
上次由 hci 在 2025年 10月 17日 18:55 修改。
原因: 未提供修改原因
Havana
论坛元老
论坛元老
帖子互动: 829
帖子: 21841
注册时间: 2022年 8月 16日 21:53

#25 Re: GLM+Claude完胜CodeX

帖子 Havana »

Claude Code不是带自己的模型么,你这个配置里面它是干嘛的?

hci 写了: 2025年 10月 15日 17:43

用Codex太贵了,Vide coding一个星期就花了400美刀,还搞不定稍微比较复杂的问题,关键还慢得要死。

现在换成中国公司z.ai的开源模型GLM4.6,用在Claude Code里面,速度快太多了,爽。还便宜,一个季度随便用也就180美刀。

Codex完全没法比。

美帝AI完蛋了,泡泡绝对爆。

头像
hci(海螺子)楼主
论坛支柱
论坛支柱
帖子互动: 519
帖子: 10363
注册时间: 2022年 7月 22日 15:29

#26 Re: GLM+Claude完胜CodeX

帖子 hci(海螺子)楼主 »

claude code可以用别的模型。自带的模型贵,limit很小。

Havana 写了: 昨天 01:58

Claude Code不是带自己的模型么,你这个配置里面它是干嘛的?

Havana
论坛元老
论坛元老
帖子互动: 829
帖子: 21841
注册时间: 2022年 8月 16日 21:53

#27 Re: GLM+Claude完胜CodeX

帖子 Havana »

你选claude code是因为它的什么特别功能,还是习惯了?

hci 写了: 昨天 11:45

claude code可以用别的模型。自带的模型贵,limit很小。

头像
hci(海螺子)楼主
论坛支柱
论坛支柱
帖子互动: 519
帖子: 10363
注册时间: 2022年 7月 22日 15:29

#28 Re: GLM+Claude完胜CodeX

帖子 hci(海螺子)楼主 »

也没选。别的我也用。其实觉得codex的功能简单的UI更好些。

Havana 写了: 昨天 23:23

你选claude code是因为它的什么特别功能,还是习惯了?

x1 图片
回复

回到 “葵花宝典(Programming)”