Qwen2.5-1.5B-Instruct-TS-GQL
A LoRA adapter for TypeScript and Apollo Client code generation
2 min readupdated
This PEFT (parameter-efficient fine-tuning method) adapter was trained on the apollo-state-sync repository codebase and is designed to work with the base Qwen 2.5 1.5B Instruct model. The model helps write TypeScript and TSX implementations while accounting for a specific project's architecture and code conventions, including cache handling and reactive variables. The adapter is useful for developers using Apollo Client who need a local assistant to generate typed code and tests.
Key features
- Specialization in TypeScript and TSX code tailored to Apollo Client architecture.
- Trained on 444 examples from a real repository (symbols, Vitest and Playwright tests, diff commits).
- Built on an efficient 4-bit quantized model using the Unsloth library.
- Compact size (1.5 billion parameters) for fast execution on local hardware.
What you can do
- Generate TypeScript types, interfaces, and aliases for state management in Apollo Client.
- Write code for cache management, reactive variables, and data synchronization.
- Create unit tests in Vitest or e2e tests in Playwright matching the style of the source repository.
- Integrate the adapter into a local IDE assistant or inference scripts for code generation.
Example
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model = "unsloth/Qwen2.5-1.5B-Instruct-unsloth-bnb-4bit"
adapter = "sdevbuildz/Qwen2.5-1.5B-Instruct-TS-GQL"
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(base_model)
model = PeftModel.from_pretrained(model, adapter)
messages = [
{"role": "system", "content": "You are an expert TypeScript developer trained on this specific repository."},
{"role": "user", "content": "Write an Apollo Client type alias for a user profile."},
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))
Read more
DetailsBase model: unsloth/Qwen2.5-1.5B-Instruct-unsloth-bnb-4bit
LoRA parameters: rank 16, alpha 16, trained on an NVIDIA T4 GPU
Limitations: may generate plausible-looking but non-working code or hallucinate APIs
License: Apache-2.0










Comments