kennethge123 commited on
Commit
4c35d18
·
verified ·
1 Parent(s): b477d16

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +104 -0
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ base_model: Qwen/Qwen3.5-2B
6
+ tags:
7
+ - latex
8
+ - voice
9
+ - accessibility
10
+ - math
11
+ - transcription
12
+ - fine-tuned
13
+ - gguf
14
+ - quantized
15
+ datasets:
16
+ - kennethge123/latex-voice-dataset
17
+ pipeline_tag: text-generation
18
+ ---
19
+
20
+ # LaTeX Voice qwen3.5-2b (Q4_K_M GGUF)
21
+
22
+ Fine-tuned **Qwen/Qwen3.5-2B** for voice-driven LaTeX transcription and editing, designed to help people with disabilities (fine motor disabilities, blindness, low vision) participate in STEM.
23
+
24
+ This model converts natural language voice transcriptions into LaTeX notation, and can also edit existing LaTeX expressions based on voice commands. It handles messy speech-to-text output including homophones, filler words, truncations, and other real-world STT artifacts.
25
+
26
+ Based on the [Phoenix](https://arxiv.org/abs/2508.07576) and [StereoMath](https://arxiv.org/abs/2501.01404) research papers.
27
+
28
+ ## Usage (llama.cpp)
29
+
30
+ This repo contains a **Q4_K_M GGUF** file for use with [llama.cpp](https://github.com/ggerganov/llama.cpp). This is the recommended format for edge/laptop deployment with Vulkan or Metal acceleration.
31
+
32
+ ```bash
33
+ # Download the GGUF file
34
+ huggingface-cli download kennethge123/latex-voice-qwen3.5-2b-4bit qwen3.5-2b-Q4_K_M.gguf --local-dir .
35
+
36
+ # Run with llama.cpp server
37
+ ./llama-server -m qwen3.5-2b-Q4_K_M.gguf -c 2048 -ngl 99
38
+ ```
39
+
40
+ #### Example API call (with llama-server running)
41
+
42
+ ```bash
43
+ curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
44
+ "messages": [
45
+ {"role": "system", "content": "Your goal is to transcribe what the user is saying into LaTeX. Output in <latex></latex> blocks."},
46
+ {"role": "user", "content": "User Instruction: the integral from zero to infinity of e to the negative x squared dx"}
47
+ ],
48
+ "max_tokens": 256,
49
+ "temperature": 0
50
+ }'
51
+ ```
52
+
53
+ For the full-precision transformers version, see [kennethge123/latex-voice-qwen3.5-2b](https://huggingface.co/kennethge123/latex-voice-qwen3.5-2b).
54
+
55
+ ## Evaluation Results
56
+
57
+ | Configuration | Exact Match | First Match | N |
58
+ |---|---|---|---|
59
+ | Full precision (standard prompt) | 56.6% | 56.6% | 500 |
60
+ | Full precision (varied prompts) | 50.2% | 50.2% | 500 |
61
+ | 4-bit quantized (standard prompt) | 54.6% | 54.4% | 500 |
62
+ | 4-bit quantized (varied prompts) | 48.4% | 48.4% | 500 |
63
+
64
+ **Metrics:**
65
+ - **Exact Match**: Predicted LaTeX (after normalization) matches any expected output exactly
66
+ - **First Match**: First predicted output matches any expected output
67
+ - **Standard prompt**: Uses the same system prompt as training
68
+ - **Varied prompts**: Uses randomized system prompts to test generalization (more representative of real-world use)
69
+
70
+ ## Training Details
71
+
72
+ - **Base model**: Qwen/Qwen3.5-2B
73
+ - **Method**: LoRA fine-tuning (r=64, alpha=128)
74
+ - **Dataset**: ~60K examples (30K transcription, 20K editing, 10K transforms)
75
+ - **Data mix**: 55% clean voice, 45% messy/realistic STT artifacts
76
+ - **Epochs**: 2-3
77
+ - **Optimizer**: AdamW with cosine schedule
78
+ - **Quantization**: Q4_K_M (GGUF) — converted from full-precision merged weights via llama.cpp
79
+
80
+ ## Intended Use
81
+
82
+ This model is designed for:
83
+ - Voice-to-LaTeX transcription for accessibility tools
84
+ - Editing LaTeX expressions via natural language commands
85
+ - Mathematical transformations (simplify, factor, differentiate, etc.)
86
+ - Integration with voice-powered math workspaces like Phoenix
87
+
88
+ ## Limitations
89
+
90
+ - Exact match is a strict metric; the model may produce mathematically equivalent but syntactically different LaTeX
91
+ - Performance on very advanced (PhD-level) notation may be lower
92
+ - The model works best with the context engine pattern from Phoenix
93
+ - Voice transcription artifacts not in the training distribution may cause issues
94
+
95
+ ## Citation
96
+
97
+ ```bibtex
98
+ @article{ge2025phoenix,
99
+ title={Phoenix: A Novel Context-Aware Voice-Powered Math Equation Workspace and Editor},
100
+ author={Ge, Kenneth and Paul, Ryan and Zhang, Priscilla and Seo, JooYoung},
101
+ journal={arXiv preprint arXiv:2508.07576},
102
+ year={2025}
103
+ }
104
+ ```