richarderkhov/arise-sustech_-_llm4decompile-1.3b-gguf overview
Quantization made by Richard Erkhov. Github Discord Request more models llm4decompile-1.3b - GGUF | Name | Quant method | Size | | ---- | ---- | ---- | | llm4decompile-1.3b.Q2K.gguf | Q2K | 0.52GB | | llm4decompile-1.3b.IQ3XS.gguf | IQ3XS | 0.57GB | | llm4decompile-1.3b.IQ3S.gguf | IQ3S | 0.6GB | | llm4decompile-1.3b.Q3KS.gguf | Q3KS | 0.6GB | | llm4decompile-1.3b.IQ3M.gguf | IQ3M | 0.63GB | | llm4decompile-1.3b.Q3K.gguf | Q3K | 0.66GB | | llm4decompile-1.3b.Q3KM.gguf | Q3KM | 0.66GB | | llm4decompile-1.3b.Q3KL.gguf | Q3KL | 0.69GB | | llm4decompile-1.3b.IQ4XS.gguf | IQ4XS | 0.7GB | | llm4decompile-1.3b.Q40.gguf | Q40 | 0.72GB | | llm4decompile-1.3b.IQ4NL.gguf | IQ4NL | 0.73GB | | llm4decompile-1.3b.Q4KS.gguf | Q4KS | 0.76GB | | llm4decompile-1.3b.Q4K.gguf | Q4K | 0.81GB | | llm4decompile-1.3b.Q4KM.gguf | Q4KM | 0.81GB | | llm4decompile-1.3b.Q41.gguf | Q41 | 0.8GB | | llm4decompile-1.3b.Q50.gguf | Q50 | 0.87GB | | llm4decompile-1.3b.Q5KS.gguf | Q5KS | 0.89GB | | llm4decompile-1.3b.Q5K.gguf | Q5K | 0.93GB | | llm4decompile-1.3b.Q5KM.gguf | Q5KM | 0.93GB | | llm4decompile-1.3b.Q51.gguf | Q51 | 0.95GB | | llm4decompile-1.3b.Q6K.gguf | Q6K | 1.09GB | | llm4decompile-1.3b.Q80.gguf | Q80 | 1.33GB | Original model description: --- language: code # {outputfile}.s'#disassemble the binary file into assembly instructions subprocess.run(compilecommand, shell=True, check=True) inputasm = '' with open(outputfile+'.s') as f:#asm file asm= f.read() asm = asm.split('Disassembly of section .text:')[-1].strip() for tmp in asm.split('\n'): tmpasm = tmp.split('\t')[-1]#remove the binary code tmpasm = tmpasm.split('#')[0].strip()#remove the comments inputasm+=tmpasm+'\n' inputasm = re.sub(zerospattern, '', inputasm) before = f"# This is the assembly code with {optstate} optimization:\n"#prompt after = "\n# What is the source code?\n"#prompt inputasmprompt = before+inputasm.strip()+after with open(fileName +'' + optstate +'.asm','w',encoding='utf-8') as f: f.write(inputasmprompt) python from transformers import AutoTokenizer, AutoModelForCausalLM import torch modelpath = 'arise-sustech/llm4decompile-1.3b' tokenizer = AutoTokenizer.frompretrained(modelpath) model = AutoModelForCausalLM.frompretrained(modelpath,torchdtype=torch.bfloat16).cuda() with open(fileName +'' + optstate +'.asm','r') as f:#original file asmfunc = f.read() inputs = tokenizer(asmfunc, returntensors="pt").to(model.device) with torch.nograd(): outputs = model.generate(inputs, maxnewtokens=512) cfuncdecompile = tokenizer.decode(outputs[0][len(inputs[0]):-1]) @misc{tan2024llm4decompile, title={LLM4Decompile: Decompiling Binary Code with Large Language Models}, author={Hanzhuo Tan and Qi Luo and Jing Li and Yuqun Zhang}, year={2024}, eprint={2403.05286}, archivePrefix={arXiv}, primaryClass={cs.PL} }
Repository Files & Downloads
| File | Type | Quantization | Size | Link |
|---|---|---|---|---|
| llm4decompile-1.3b.IQ3_M.gguf | GGUF | IQ3_M | 641.62 MB | Download |
| llm4decompile-1.3b.IQ3_S.gguf | GGUF | IQ3_S | 612.09 MB | Download |
| llm4decompile-1.3b.IQ3_XS.gguf | GGUF | IQ3_XS | 584.95 MB | Download |
| llm4decompile-1.3b.IQ4_NL.gguf | GGUF | IQ4_NL | 746.04 MB | Download |
| llm4decompile-1.3b.IQ4_XS.gguf | GGUF | IQ4_XS | 715.94 MB | Download |
| llm4decompile-1.3b.Q2_K.gguf | GGUF | Q2_K | 533.79 MB | Download |
| llm4decompile-1.3b.Q3_K.gguf | GGUF | Q3_K | 671.51 MB | Download |
| llm4decompile-1.3b.Q3_K_L.gguf | GGUF | Q3_K_L | 709.97 MB | Download |
| llm4decompile-1.3b.Q3_K_M.gguf | GGUF | Q3_K_M | 671.51 MB | Download |
| llm4decompile-1.3b.Q3_K_S.gguf | GGUF | Q3_K_S | 612.09 MB | Download |
| llm4decompile-1.3b.Q4_0.gguf | GGUF | — | 739.99 MB | Download |
| llm4decompile-1.3b.Q4_1.gguf | GGUF | — | 816.30 MB | Download |
| llm4decompile-1.3b.Q4_K.gguf | GGUF | Q4_K | 832.99 MB | Download |
| llm4decompile-1.3b.Q4_K_M.gguf | GGUF | Q4_K_M | 832.99 MB | Download |
| llm4decompile-1.3b.Q4_K_S.gguf | GGUF | Q4_K_S | 776.26 MB | Download |
| llm4decompile-1.3b.Q5_0.gguf | GGUF | — | 892.61 MB | Download |
| llm4decompile-1.3b.Q5_1.gguf | GGUF | — | 968.93 MB | Download |
| llm4decompile-1.3b.Q5_K.gguf | GGUF | Q5_K | 955.43 MB | Download |
| llm4decompile-1.3b.Q5_K_M.gguf | GGUF | Q5_K_M | 955.43 MB | Download |
| llm4decompile-1.3b.Q5_K_S.gguf | GGUF | Q5_K_S | 908.74 MB | Download |
| llm4decompile-1.3b.Q6_K.gguf | GGUF | Q6_K | 1.09 GB | Download |
| llm4decompile-1.3b.Q8_0.gguf | GGUF | — | 1.33 GB | Download |
Model Details Live
Metadata Inspector
Normalized metadata (stored in metadata_json)
{
"metadata": {},
"card_data": {
"frontmatter": {},
"hero_image_url": "",
"summary": "Quantization made by Richard Erkhov. Github Discord Request more models llm4decompile-1.3b - GGUF | Name | Quant method | Size | | ---- | ---- | ---- | | llm4decompile-1.3b.Q2_K.gguf | Q2_K | 0.52GB | | llm4decompile-1.3b.IQ3_XS.gguf | IQ3_XS | 0.57GB | | llm4decompile-1.3b.IQ3_S.gguf | IQ3_S | 0.6GB | | llm4decompile-1.3b.Q3_K_S.gguf | Q3_K_S | 0.6GB | | llm4decompile-1.3b.IQ3_M.gguf | IQ3_M | 0.63GB | | llm4decompile-1.3b.Q3_K.gguf | Q3_K | 0.66GB | | llm4decompile-1.3b.Q3_K_M.gguf | Q3_K_M | 0.66GB | | llm4decompile-1.3b.Q3_K_L.gguf | Q3_K_L | 0.69GB | | llm4decompile-1.3b.IQ4_XS.gguf | IQ4_XS | 0.7GB | | llm4decompile-1.3b.Q4_0.gguf | Q4_0 | 0.72GB | | llm4decompile-1.3b.IQ4_NL.gguf | IQ4_NL | 0.73GB | | llm4decompile-1.3b.Q4_K_S.gguf | Q4_K_S | 0.76GB | | llm4decompile-1.3b.Q4_K.gguf | Q4_K | 0.81GB | | llm4decompile-1.3b.Q4_K_M.gguf | Q4_K_M | 0.81GB | | llm4decompile-1.3b.Q4_1.gguf | Q4_1 | 0.8GB | | llm4decompile-1.3b.Q5_0.gguf | Q5_0 | 0.87GB | | llm4decompile-1.3b.Q5_K_S.gguf | Q5_K_S | 0.89GB | | llm4decompile-1.3b.Q5_K.gguf | Q5_K | 0.93GB | | llm4decompile-1.3b.Q5_K_M.gguf | Q5_K_M | 0.93GB | | llm4decompile-1.3b.Q5_1.gguf | Q5_1 | 0.95GB | | llm4decompile-1.3b.Q6_K.gguf | Q6_K | 1.09GB | | llm4decompile-1.3b.Q8_0.gguf | Q8_0 | 1.33GB | Original model description: --- language: code # {output_file}.s'#disassemble the binary file into assembly instructions subprocess.run(compile_command, shell=True, check=True) input_asm = '' with open(output_file+'.s') as f:#asm file asm= f.read() asm = asm.split('Disassembly of section .text:')[-1].strip() for tmp in asm.split('\\n'): tmp_asm = tmp.split('\\t')[-1]#remove the binary code tmp_asm = tmp_asm.split('#')[0].strip()#remove the comments input_asm+=tmp_asm+'\\n' input_asm = re.sub(zeros_pattern, '', input_asm) before = f\"# This is the assembly code with {opt_state} optimization:\\n\"#prompt after = \"\\n# What is the source code?\\n\"#prompt input_asm_prompt = before+input_asm.strip()+after with open(fileName +'_' + opt_state +'.asm','w',encoding='utf-8') as f: f.write(input_asm_prompt) ` Then use LLM4Decompile to translate the assembly instructions into C: `python from transformers import AutoTokenizer, AutoModelForCausalLM import torch model_path = 'arise-sustech/llm4decompile-1.3b' tokenizer = AutoTokenizer.from_pretrained(model_path) model = AutoModelForCausalLM.from_pretrained(model_path,torch_dtype=torch.bfloat16).cuda() with open(fileName +'_' + opt_state +'.asm','r') as f:#original file asm_func = f.read() inputs = tokenizer(asm_func, return_tensors=\"pt\").to(model.device) with torch.no_grad(): outputs = model.generate(**inputs, max_new_tokens=512) c_func_decompile = tokenizer.decode(outputs[0][len(inputs[0]):-1]) ` ### 4. License This code repository is licensed under the DeepSeek License. ### 5. Contact If you have any questions, please raise an issue. ### 6. Citation ` @misc{tan2024llm4decompile, title={LLM4Decompile: Decompiling Binary Code with Large Language Models}, author={Hanzhuo Tan and Qi Luo and Jing Li and Yuqun Zhang}, year={2024}, eprint={2403.05286}, archivePrefix={arXiv}, primaryClass={cs.PL} } ``",
"quick_links": [],
"benchmark_table_html": "",
"readme_markdown": "Quantization made by Richard Erkhov.\n\n[Github](https://github.com/RichardErkhov)\n\n[Discord](https://discord.gg/pvy7H8DZMG)\n\n[Request more models](https://github.com/RichardErkhov/quant_request)\n\n\nllm4decompile-1.3b - GGUF\n- Model creator: https://huggingface.co/arise-sustech/\n- Original model: https://huggingface.co/arise-sustech/llm4decompile-1.3b/\n\n\n| Name | Quant method | Size |\n| ---- | ---- | ---- |\n| [llm4decompile-1.3b.Q2_K.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q2_K.gguf) | Q2_K | 0.52GB |\n| [llm4decompile-1.3b.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.IQ3_XS.gguf) | IQ3_XS | 0.57GB |\n| [llm4decompile-1.3b.IQ3_S.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.IQ3_S.gguf) | IQ3_S | 0.6GB |\n| [llm4decompile-1.3b.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q3_K_S.gguf) | Q3_K_S | 0.6GB |\n| [llm4decompile-1.3b.IQ3_M.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.IQ3_M.gguf) | IQ3_M | 0.63GB |\n| [llm4decompile-1.3b.Q3_K.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q3_K.gguf) | Q3_K | 0.66GB |\n| [llm4decompile-1.3b.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q3_K_M.gguf) | Q3_K_M | 0.66GB |\n| [llm4decompile-1.3b.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q3_K_L.gguf) | Q3_K_L | 0.69GB |\n| [llm4decompile-1.3b.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.IQ4_XS.gguf) | IQ4_XS | 0.7GB |\n| [llm4decompile-1.3b.Q4_0.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q4_0.gguf) | Q4_0 | 0.72GB |\n| [llm4decompile-1.3b.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.IQ4_NL.gguf) | IQ4_NL | 0.73GB |\n| [llm4decompile-1.3b.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q4_K_S.gguf) | Q4_K_S | 0.76GB |\n| [llm4decompile-1.3b.Q4_K.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q4_K.gguf) | Q4_K | 0.81GB |\n| [llm4decompile-1.3b.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q4_K_M.gguf) | Q4_K_M | 0.81GB |\n| [llm4decompile-1.3b.Q4_1.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q4_1.gguf) | Q4_1 | 0.8GB |\n| [llm4decompile-1.3b.Q5_0.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q5_0.gguf) | Q5_0 | 0.87GB |\n| [llm4decompile-1.3b.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q5_K_S.gguf) | Q5_K_S | 0.89GB |\n| [llm4decompile-1.3b.Q5_K.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q5_K.gguf) | Q5_K | 0.93GB |\n| [llm4decompile-1.3b.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q5_K_M.gguf) | Q5_K_M | 0.93GB |\n| [llm4decompile-1.3b.Q5_1.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q5_1.gguf) | Q5_1 | 0.95GB |\n| [llm4decompile-1.3b.Q6_K.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q6_K.gguf) | Q6_K | 1.09GB |\n| [llm4decompile-1.3b.Q8_0.gguf](https://huggingface.co/RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf/blob/main/llm4decompile-1.3b.Q8_0.gguf) | Q8_0 | 1.33GB |\n\n\n\n\nOriginal model description:\n---\nlanguage: code # <-- my language\nwidget:\n - text: \"# This is the assembly code with O0 optimization:\\n<func0>:\\nendbr64\\nlea (%rdi,%rsi,1),%eax\\nretq\\n# What is the source code?\\n\"\nlicense: other\ntags:\n- decompile\n- binary\n---\n\n### 1. Introduction of LLM4Decompile\n\nLLM4Decompile aims to decompile x86 assembly instructions into C. It is finetuned from Deepseek-Coder on 4B tokens of assembly-C pairs compiled from AnghaBench.\n\n- **Github Repository:** [LLM4Decompile](https://github.com/albertan017/LLM4Decompile)\n\n- **Paper link:** For more details check out the [paper](https://arxiv.org/abs/2403.05286).\n\n### 2. Evaluation Results\n| Model | Re-compilability | | | | | Re-executability | | | | |\n|--------------------|:----------------:|:---------:|:---------:|:---------:|:---------:|:----------------:|-----------|-----------|-----------|:---------:|\n| Optimization-level | O0 | O1 | O2 | O3 | Avg. | O0 | O1 | O2 | O3 | Avg. |\n| GPT4 | 0.92 | 0.94 | 0.88 | 0.84 | 0.895 | 0.1341 | 0.1890 | 0.1524 | 0.0854 | 0.1402 |\n| DeepSeek-Coder-33B | 0.0659 | 0.0866 | 0.1500 | 0.1463 | 0.1122 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |\n| LLM4Decompile-1b | 0.8780 | 0.8732 | 0.8683 | 0.8378 | 0.8643 | 0.1573 | 0.0768 | 0.1000 | 0.0878 | 0.1055 |\n| LLM4Decompile-6b | 0.8817 | 0.8951 | 0.8671 | 0.8476 | 0.8729 | 0.3000 | 0.1732 | 0.1988 | 0.1841 | 0.2140 |\n| LLM4Decompile-33b | 0.8134 | 0.8195 | 0.8183 | 0.8305 | 0.8204 | 0.3049 | 0.1902 | 0.1817 | 0.1817 | 0.2146 |\n\n\n\n### 3. How to Use\nHere give an example of how to use our model.\nFirst compile the C code into binary, disassemble the binary into assembly instructions:\n```python\nimport subprocess\nimport os\nimport re\n\ndigit_pattern = r'\\b0x[a-fA-F0-9]+\\b'# binary codes in Hexadecimal\nzeros_pattern = r'^0+\\s'#0s\nOPT = [\"O0\", \"O1\", \"O2\", \"O3\"]\nfileName = 'path/to/file'\nwith open(fileName+'.c','r') as f:#original file\n c_func = f.read()\nfor opt_state in OPT:\n output_file = fileName +'_' + opt_state\n input_file = fileName+'.c'\n compile_command = f'gcc -c -o {output_file}.o {input_file} -{opt_state} -lm'#compile the code with GCC on Linux\n subprocess.run(compile_command, shell=True, check=True)\n compile_command = f'objdump -d {output_file}.o > {output_file}.s'#disassemble the binary file into assembly instructions\n subprocess.run(compile_command, shell=True, check=True)\n \n input_asm = ''\n with open(output_file+'.s') as f:#asm file\n asm= f.read()\n asm = asm.split('Disassembly of section .text:')[-1].strip()\n for tmp in asm.split('\\n'):\n tmp_asm = tmp.split('\\t')[-1]#remove the binary code\n tmp_asm = tmp_asm.split('#')[0].strip()#remove the comments\n input_asm+=tmp_asm+'\\n'\n input_asm = re.sub(zeros_pattern, '', input_asm)\n before = f\"# This is the assembly code with {opt_state} optimization:\\n\"#prompt\n after = \"\\n# What is the source code?\\n\"#prompt\n input_asm_prompt = before+input_asm.strip()+after\n with open(fileName +'_' + opt_state +'.asm','w',encoding='utf-8') as f:\n f.write(input_asm_prompt)\n```\n\nThen use LLM4Decompile to translate the assembly instructions into C:\n```python\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\nimport torch\n\nmodel_path = 'arise-sustech/llm4decompile-1.3b'\ntokenizer = AutoTokenizer.from_pretrained(model_path)\nmodel = AutoModelForCausalLM.from_pretrained(model_path,torch_dtype=torch.bfloat16).cuda()\n\nwith open(fileName +'_' + opt_state +'.asm','r') as f:#original file\n asm_func = f.read()\ninputs = tokenizer(asm_func, return_tensors=\"pt\").to(model.device)\nwith torch.no_grad():\n outputs = model.generate(**inputs, max_new_tokens=512)\nc_func_decompile = tokenizer.decode(outputs[0][len(inputs[0]):-1])\n```\n\n### 4. License\nThis code repository is licensed under the DeepSeek License.\n\n### 5. Contact\n\nIf you have any questions, please raise an issue.\n\n### 6. Citation\n```\n@misc{tan2024llm4decompile,\n title={LLM4Decompile: Decompiling Binary Code with Large Language Models}, \n author={Hanzhuo Tan and Qi Luo and Jing Li and Yuqun Zhang},\n year={2024},\n eprint={2403.05286},\n archivePrefix={arXiv},\n primaryClass={cs.PL}\n}\n```\n\n",
"related_quantizations": []
},
"tags": [
"gguf",
"arxiv:2403.05286",
"endpoints_compatible",
"region:us"
],
"likes": 0,
"downloads": 111,
"gated": false,
"private": false,
"last_modified": "2024-06-30T00:27:37.000Z",
"created_at": "2024-06-29T23:42:23.000Z",
"pipeline_tag": "",
"library_name": ""
}
Source payload excerpt (from Hugging Face API)
{
"_id": "66809bdf81998a6a089fa2ec",
"id": "RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf",
"modelId": "RichardErkhov/arise-sustech_-_llm4decompile-1.3b-gguf",
"sha": "66a91c63356d1c04f551c7098b8920c3ac630c49",
"createdAt": "2024-06-29T23:42:23.000Z",
"lastModified": "2024-06-30T00:27:37.000Z",
"author": "RichardErkhov",
"downloads": 111,
"likes": 0,
"gated": false,
"private": false,
"pipeline_tag": "",
"library_name": "",
"siblings_count": 24
}