CoolFace
Modelpublic

kanchisaw/oxide-compiler-model

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
Model Card

pipelinetag: text-generation libraryname: transformers tags:

  • compiler
  • code-generation
  • transformers
  • lora
  • tinyllama

SiliconMind — Neural C → Oxide-8 Compiler

SiliconMind is a research project exploring whether a small language model can learn compiler-like program translation.

The model is fine-tuned to translate simple C programs into Oxide-8 assembly language. It demonstrates that a language model can learn structured transformations such as variables, loops, and arithmetic operations.

This project is an experimental neural compiler prototype, not a production compiler.

Model Overview

Author: Kanchi Kumari Base Model: TinyLlama-1.1B Fine-tuning Method: LoRA (Low Rank Adaptation) Task: C → Oxide-8 Assembly Translation Framework: HuggingFace Transformers + PEFT

The goal of this project is to explore the intersection of:

  • programming languages
  • compilers
  • machine learning
  • neural code generation

Example

Input (C)

c
int main(){
    int i = 0;
    while(i < 5){
        print_char(65);
        i = i + 1;
    }
    return 0;
}

Generated Assembly

### OXIDE-8 ASSEMBLY ###
.org 0x2000
JMP _start

_main:
    LDI A, #0
    STD _stl0, A

_Lwhile_0:
    LDD A, _stl0
    PUSH A
    LDI A, #5
    MOV B, A
    POP A
    CMP A, B
    JC _Llt_2
    LDI A, #0
    JMP _Lltd_3

_Llt_2:
    LDI A, #1

_Lltd_3:
    CMP A, #0
    JZ _Lwend_1

    LDI A, #65
    INT 0x01

    LDD A, _stl0
    PUSH A
    LDI A, #1
    MOV B, A
    POP A
    ADD A, B
    STD _stl0, A
    JMP _Lwhile_0

_Lwend_1:
    LDI A, #0
    RET

_start:
    CALL _main
    INT 0x00
    HLT

Training Data

The model was trained on a synthetic dataset of C programs paired with Oxide-8 assembly output.

Training examples include:

  • variable assignments
  • arithmetic expressions
  • while loops
  • for loops
  • comparisons
  • function structure
  • simple I/O instructions

Approximately thousands of program pairs were used to teach the model the mapping between high-level and low-level code.

Training Configuration

Base model: TinyLlama-1.1B Fine-tuning method: LoRA Training framework: HuggingFace Transformers + PEFT

Typical configuration:

  • sequence length: 2048
  • batch size: 16 (effective)
  • epochs: 3
  • GPU: Tesla T4

Only the LoRA adapter parameters were trained while the base model remained frozen.

Architecture

C Program ↓ Tokenizer ↓ TinyLlama + LoRA Adapter ↓ Generated Oxide-8 Assembly

Intended Use

This model is intended for:

  • research in neural compilers
  • studying program translation using LLMs
  • educational demonstrations of assembly generation
  • experiments in code generation

It should not be used as a production compiler.

Limitations

Because the dataset is limited, the model may fail on:

  • large programs
  • arrays and pointer operations
  • recursion
  • complex control flow
  • advanced C features

Outputs should be treated as experimental predictions.

Future Work

Possible future improvements include:

  • expanding dataset size to 100k+ examples
  • adding arrays and pointer support
  • integrating semantic correctness evaluation
  • connecting the model to an Oxide-8 emulator
  • exploring reinforcement learning for compiler correctness

Repository

Model page https://huggingface.co/kanchisaw/oxide-compiler-model

Author

Kanchi Kumari

UI/UX Designer, Full-Stack Developer, and AI Systems Builder exploring the intersection of compilers, machine learning, and programming languages.