SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.01910 · 2024

MG-Verilog: Multi-grained Dataset Towards Enhanced LLM-assisted Verilog Generation

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2407.01910.json · badge: /api/ran/2407.01910.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
luke-avionics/mg-verilog canonical (classifier label)
classifier basis: census
5 ran · 2 no recorded run
FunctionStatusWhere it lives
check_correctness Ran
ran; our contract draft was wrong, not the code
luke-avionics/mg-verilog/verilog_eval/verilog_eval/execution.py
code served (permissive licence) · get_code("f327928b4d07faf0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile

# Define a minimal problem dict that matches what check_correctness expects
problem = {
    'task_id': 'test_task_001',
    'test': '''
module test();
    initial begin
        $display("Test passed");
        $finish;
    end
endmodule
''',
    'prompt': '''
// Simple Verilog module
module simple_adder(
    input [7:0] a,
    input [7:0] b,
    output [8:0] sum
);
    assign sum = a + b;
endmodule
'''
}

# Define a simple completion that adds to the prompt
completion = '''
// Implementation of simple_adder
module simple_adder(
    input [7:0] a,
    input [7:0] b,
    output [8:0] sum
);
    assign sum = a + b;
endmodule
'''

# Timeout in seconds
timeout = 10.0

# Optional completion_id
completion_id = 1

# Optional unit_test_length for repeat statements
unit_test_length = 100

ARGS = {
    'problem': problem,
    'completion': completion,
    'timeout': timeout,
    'completion_id': completion_id,
    'unit_test_length': unit_test_length
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
estimate_pass_at_k Ran
ran; our contract draft was wrong, not the code
luke-avionics/mg-verilog/verilog_eval/verilog_eval/evaluation.py
code served (permissive licence) · get_code("0fe5b6fed06ae660")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

ARGS = {
    "num_samples": 100,
    "num_correct": np.array([50, 75, 25, 90]),
    "k": 10
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (4,) — shape (4,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
eval_file_to_part_data Ran
ran; our contract draft was wrong, not the code
luke-avionics/mg-verilog/auto_data_gen_val/verilog_eval_to_part_data.py
code served (permissive licence) · get_code("77262c8569201c83")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import json
import tempfile
from unittest.mock import patch

# Create temporary directories for the test
temp_dir = tempfile.mkdtemp()
eval_file_path = os.path.join(temp_dir, "eval.jsonl")
data_dir = os.path.join(temp_dir, "data")
meta_data_dir = os.path.join(temp_dir, "meta_data")

# Create a mock eval file with sample Verilog code data
eval_data = [
    {
        "task_id": "module_1",
        "prompt": "module top_module(input a, output b);",
        "canonical_solution": "\nassign b = a;\nendmodule"
    },
    {
        "task_id": "module_2",
        "prompt": "module top_module(input [3:0] in, output out);",
        "canonical_solution": "\nassign out = in[0];\nendmodule"
    }
]

with open(eval_file_path, 'w') as f:
    for item in eval_data:
        f.write(json.dumps(item) + '\n')

# Mock the part_verilog_module_string function that's called in eval_file_to_part_data
def mock_part_verilog_module_string(code_content):
    # Extract module name from code
    import re
    match = re.search(r'module\s+(\w+)', code_content)
    if match:
        module_name = match.group(1)
        return [code_content], [module_name]
    return [code_content], ["module_1"]

# Patch the function before defining ARGS
import sys
current_module = sys.modules[__name__]
current_module.part_verilog_module_string = mock_part_verilog_module_string

ARGS = {
    "eval_file": eval_file_path,
    "data_dir": data_dir,
    "meta_data_dir": meta_data_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gpt4_request Ran
ran; our contract draft was wrong, not the code
luke-avionics/mg-verilog/auto_data_gen_val/chain_utils.py
code served (permissive licence) · get_code("5a448926543c89fa")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned MockResponse. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import openai

# Mock the openai module since we can't make real API calls
class MockResponse:
    def __init__(self):
        self.choices = [type('Choice', (), {'message': {'content': 'Mock response from GPT-4'}})()]

def mock_create(**kwargs):
    return MockResponse()

openai.ChatCompletion = type('ChatCompletion', (), {'create': staticmethod(mock_create)})()

# Define the prompt argument as required by the function
# The function expects a 'messages' parameter, which should be a list of message dicts
prompt = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "What is the capital of France?"}
]

ARGS = {
    "prompt": prompt
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockResponse — a MockResponse output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockResponse output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_problems Ran
ran; our contract draft was wrong, not the code
luke-avionics/mg-verilog/verilog_eval/verilog_eval/data.py
code served (permissive licence) · get_code("c06721d357c61091")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import json
import os

# Create a temporary JSONL file with test data
temp_dir = tempfile.mkdtemp()
test_file = os.path.join(temp_dir, "test_problems.jsonl")

# Write some test data to the JSONL file
test_data = [
    {"task_id": "task_1", "problem": "problem 1", "entry_point": "solution"},
    {"task_id": "task_2", "problem": "problem 2", "entry_point": "solve"},
    {"task_id": "task_3", "problem": "problem 3", "entry_point": "main"}
]

with open(test_file, 'w') as f:
    for item in test_data:
        f.write(json.dumps(item) + '\n')

ARGS = {
    "evalset_file": test_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
completion_request Not yet run
unverified (harvested, no recorded run)
luke-avionics/mg-verilog/auto_data_gen_val/chain_utils.py
code served (permissive licence) · get_code("acfc201fecb4a16a")
How it ran

no invocation recorded.

gpt3_5_request Not yet run
unverified (harvested, no recorded run)
luke-avionics/mg-verilog/auto_data_gen_val/chain_utils.py
code served (permissive licence) · get_code("812adf6e1ab9441d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 1 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
estimate_pass_at_k 20 other papers
14 dated earlier, 1 the same month, 5 later
2107.03374 (2021-07)
Evaluating Large Language Models Trained on Code
2207.14255 (2022-07)
Efficient Training of Language Models to Fill in the Middle
2210.14868 (2022-10)
Multi-lingual Evaluation of Code Generation Models
and 17 more not named here
read_problems 1 other paper
1 dated earlier
2310.06830 (2023-10)
Lemur: Harmonizing Natural Language and Code for Language Agents

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large Language Models (LLMs) have recently shown promise in streamlining hardware design processes by encapsulating vast amounts of domain-specific data. In addition, they allow users to interact with the design processes through natural language instructions, thus making hardware design more accessible to developers. However, effectively leveraging LLMs in hardware design necessitates providing domain-specific data during inference (e.g., through in-context learning), fine-tuning, or pre-training. Unfortunately, existing publicly available hardware datasets are often limited in size, complexity, or detail, which hinders the effectiveness of LLMs in hardware design tasks. To address this issue, we first propose a set of criteria for creating high-quality hardware datasets that can effectively enhance LLM-assisted hardware design. Based on these criteria, we propose a Multi-Grained-Verilog (MG-Verilog) dataset, which encompasses descriptions at various levels of detail and corresponding code samples. To benefit the broader hardware design community, we have developed an open-source infrastructure that facilitates easy access, integration, and extension of the dataset to meet specific project needs. Furthermore, to fully exploit the potential of the MG-Verilog dataset, which varies in complexity and detail, we introduce a balanced fine-tuning scheme. This scheme serves as a unique use case to leverage the diverse levels of detail provided by the dataset. Extensive experiments demonstrate that the proposed dataset and fine-tuning scheme consistently improve the performance of LLMs in hardware design tasks.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2407.01910")
get_code_for_paper("2407.01910")
have("2407.01910")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2407.01910.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2407.01910.svg)](https://syntology.ai/paper/2407.01910)

Connect an agent — have() is free.