Title: Qwen model generation degenerates into repetitive special tokens · Issue #243 · structuredllm/syncode · GitHub
Open Graph Title: Qwen model generation degenerates into repetitive special tokens · Issue #243 · structuredllm/syncode
X Title: Qwen model generation degenerates into repetitive special tokens · Issue #243 · structuredllm/syncode
Description: Hi ! Nice Project! When I run the example_pythin.ipynb with Qwen2_5 7B Base as follows: import sys sys.path.append('..') import os from dotenv import load_dotenv # 导入库 # 1. 加载 .env 文件 (默认读取当前目录下的 .env) load_dotenv() # Assuming we are in ...
Open Graph Description: Hi ! Nice Project! When I run the example_pythin.ipynb with Qwen2_5 7B Base as follows: import sys sys.path.append('..') import os from dotenv import load_dotenv # 导入库 # 1. 加载 .env 文件 (默认读取当前目录下的 ....
X Description: Hi ! Nice Project! When I run the example_pythin.ipynb with Qwen2_5 7B Base as follows: import sys sys.path.append('..') import os from dotenv import load_dotenv # 导入库 # 1. 加载 .env 文件 (默认读取...
Opengraph URL: https://github.com/structuredllm/syncode/issues/243
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Qwen model generation degenerates into repetitive special tokens","articleBody":"Hi ! Nice Project!\nWhen I run the example_pythin.ipynb with Qwen2_5 7B Base as follows:\n```python\nimport sys\nsys.path.append('..')\nimport os\nfrom dotenv import load_dotenv # 导入库\n\n# 1. 加载 .env 文件 (默认读取当前目录下的 .env)\nload_dotenv()\n# Assuming we are in the root directory\n\nfrom syncode import Syncode\nimport warnings\nwarnings.filterwarnings('ignore')\n\nmodel_name = os.getenv('QWEN2_5_7B_PATH')\n\n# Load the unconstrained original model\nllm = Syncode(model = model_name, mode='original', max_new_tokens=200)\n\n# Load the Syncode augmented model\nsyn_llm = Syncode(\n model = model_name, \n mode='grammar_mask', \n grammar='python', \n parse_output_only=False,\n indent=True,\n opp=False\n )\n```\n\nStandard LLM generation is like \n```python\npartial_code = \"def is_prime(n):\\n '''Return if prime'''\\n \"\noutput = partial_code+llm.infer(partial_code)[0]\nprint(output)\n```\n\nwith output \n```\nSetting `pad_token_id` to `eos_token_id`:151643 for open-end generation.\ndef is_prime(n):\n '''Return if prime'''\n \n if n == 1:\n return False\n if n == 2:\n return True\n if n \u003e 2 and n % 2 == 0:\n return False\n max_divisor = int(n**0.5) + 1\n for d in range(3, max_divisor, 2):\n if n % d == 0:\n return False\n return True\n\ndef is_palindrome(n):\n '''Return if palindrome'''\n return str(n) == str(n)[::-1]\n\ndef is_pandigital(n):\n '''Return if pandigital'''\n return set(str(n)) == set('123456789')[:len(str(n))]\n\ndef is_pandigital_0(n):\n '''Return if pandigital'''\n return set(str(n)) == set('0123456789')[:len(str(n))]\n\ndef is_pandigital\n```\n\n\nWhile the code of Syncode is \n```python\noutput = partial_code+syn_llm.infer(partial_code)[0]\nprint(output)\n```\nwith output \n```\nSetting `pad_token_id` to `eos_token_id`:151643 for open-end generation.\ndef is_prime(n):\n '''Return if prime'''\n\n```\n\nIt seems the grammar constraints are masking all probable next tokens, effectively forcing the model into an early termination. Debugging with skip_special_tokens=False at [link](https://www.google.com/search?q=...\u0026authuser=1) reveals that the output degenerates into repeating special tokens (e.g., \u003c|im_start|\u003e). This may confirm that the grammar constraints are masking all valid continuation tokens, leaving the model with no valid options.","author":{"url":"https://github.com/LimFang","@type":"Person","name":"LimFang"},"datePublished":"2026-01-08T11:16:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/243/syncode/issues/243"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9cf9cb46-6374-b2c1-c105-bb14ab90f972 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8700:1799BC:135CCF8:1870EC2:69916781 |
| html-safe-nonce | a3f93fd0d4c44d0ce8b96693ea906173de66048ea9b1f66bd4aed980aaac9f0e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzAwOjE3OTlCQzoxMzVDQ0Y4OjE4NzBFQzI6Njk5MTY3ODEiLCJ2aXNpdG9yX2lkIjoiNzE3ODg2ODc2OTk0MjQ5NzE1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 01afb1669dac8a7c71a27c31e1cce76c12287bcf5bed4241ee710544ec2e52c1 |
| hovercard-subject-tag | issue:3792468488 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/structuredllm/syncode/243/issue_layout |
| twitter:image | https://opengraph.githubassets.com/45e57b6540395054cddedeb8e343bb6974773287d8ed69648c7cdeb42d30fcc3/structuredllm/syncode/issues/243 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/45e57b6540395054cddedeb8e343bb6974773287d8ed69648c7cdeb42d30fcc3/structuredllm/syncode/issues/243 |
| og:image:alt | Hi ! Nice Project! When I run the example_pythin.ipynb with Qwen2_5 7B Base as follows: import sys sys.path.append('..') import os from dotenv import load_dotenv # 导入库 # 1. 加载 .env 文件 (默认读取当前目录下的 .... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | LimFang |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/structuredllm/syncode git https://github.com/structuredllm/syncode.git |
| octolytics-dimension-user_id | 204232273 |
| octolytics-dimension-user_login | structuredllm |
| octolytics-dimension-repository_id | 687211074 |
| octolytics-dimension-repository_nwo | structuredllm/syncode |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 687211074 |
| octolytics-dimension-repository_network_root_nwo | structuredllm/syncode |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width