Skip to content

BFS path drift on vague Chinese queries: 40-node corpus, 12 unrelated nodes returned for "rate_limit_check 怎么用?" #1445

Description

@kongshan001

Summary

graphify query returns semantically unrelated nodes when a Chinese-language query is vague (doesn't name a specific symbol). This was reproduced on a 716-node real-world corpus. The same query does work in English when phrased around a named symbol.

Environment

  • graphifyy v0.8.46 (CLI)
  • Backend: claude (Anthropic API)
  • Corpus: 40 files (37 .py + 3 .md) of a real Python utility library
  • Resulting graph: 716 nodes / 1159 edges / 94 communities, 3 hyperedges

Reproduction

The query was "rate_limit_check 怎么用?" (How do I use rate_limit_check?).

The expected behavior: return nodes related to rate_limit_check (the function in src/moving_average.py).

The actual behavior: the BFS started from these two unrelated start nodes:

spec Section 4: 纯函数,不修改 text, 不依赖外部状态, 多次调用结果一致.
JWT 认证模块 — 修复 JWT Token 永久有效安全漏洞 (kb: ks128001).  正确做法:使用 exp claim 设置过期时间,默认 1

…and then returned 12 nodes, none of which were about rate_limit_check:

NODE test_caesar_cipher.py [src=tests/test_caesar_cipher.py]
NODE generate_token() [src=src/jwt_auth.py]
NODE verify_token() [src=src/jwt_auth.py]
NODE TestPureFunction [src=tests/test_caesar_cipher.py]
NODE jwt_auth.py [src=src/jwt_auth.py]
NODE _b64url_encode() [src=src/jwt_auth.py]
NODE .test_repeated_calls_return_same_result() [src=tests/test_caesar_cipher.py]
NODE .test_does_not_depend_on_call_count() [src=tests/test_caesar_cipher.py]
NODE .test_does_not_mutate_input() [src=tests/test_caesar_cipher.py]
NODE _b64url_decode() [src=src/jwt_auth.py]
NODE JWT 认证模块 — 修复 JWT Token 永久有效安全漏洞 ...
NODE spec Section 4: 纯函数,不修改 text...

For comparison, the English equivalent query How is rate_limit_check implemented? returned 0 nodes ("No matching nodes found"). And the specific query moving_average 实现 (Chinese) returned 34 correct nodes including the function and all its test methods. So the problem is specific to vague Chinese queries that don't name a target symbol.

What works (for contrast)

Query Result
moving_average 实现 (Chinese, names symbol) 34 nodes, all correct
moving_average implementation (English) 34 nodes, all correct
How does JWT authentication work? (English) 19 nodes, all correct
JWT 鉴权怎么实现的? (Chinese, names symbol) 19 nodes, all correct
What known issues are documented? (English) 29 nodes, all correct
rate_limit_check 怎么用? (Chinese, vague) 12 nodes, all wrong
滑动窗口限流器 (Chinese, vague concept) 3 nodes, partial match to median_filter
How is rate_limit_check implemented? (English, vague) 0 nodes

The pattern: queries that name a specific symbol (function name, class name) work in both Chinese and English. Queries that describe a concept without naming a symbol fail or get wrong content.

Hypothesis

The BFS seed selection appears to be doing a similarity match between the query embedding and node embeddings, and the matches are dominated by a small set of "concept-dense" nodes (pure function conventions, JWT auth lessons) when the query is vague. The target rate_limit_check has 17 edges (top-9 god node) and is in the graph, but it didn't make it into the BFS neighborhood.

This might be:

  • A query-side embedding issue (Chinese "rate_limit_check 怎么用" doesn't embed close to "rate_limit_check function" nodes)
  • A node-side issue (rate_limit_check node label doesn't include the function's Chinese description)
  • A BFS seed-selection issue (top-K similar nodes are not actually similar to the query intent)

Suggestion

Some investigation directions (not a fix, just where I'd look):

  1. Add a "Chinese concept index" to nodes — extract Chinese descriptions from docstrings and link to the function node
  2. Increase the BFS seed count for queries with low-confidence top-1 match
  3. Surface the seed nodes and let the user filter, rather than silently picking top-K

Context

I evaluated graphify on two corpora:

  • Small (9 docs synthetic): I initially reported "Chinese queries don't work" — but this was a false negative due to embedding sparsity at that scale.
  • Real (40 files, 716 nodes): Chinese queries work for symbol-named queries but fail for concept-described queries. The above reproduction is on the 40-file corpus.

The full evaluation report is here (Chinese + English, with all 10 query outputs):

Happy to provide additional reproduction data or run more queries if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions