> ## Documentation Index
> Fetch the complete documentation index at: https://docs.liquid.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LFM2-350M-ENJP-MT

> 350M parameter model for bidirectional English-Japanese translation

<a href="/lfm/models/liquid-nanos" className="back-button">← Back to Liquid Nanos</a>

LFM2-350M-ENJP-MT is a specialized translation model for near real-time bidirectional Japanese/English translation. Optimized for short-to-medium text with low latency.

<div style={{display: 'flex', gap: '0.5rem', margin: '0.5rem 0 1.5rem 0'}}>
  <a href="https://huggingface.co/LiquidAI/LFM2-350M-ENJP-MT" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#fbbf24'}}><span style={{color: '#000'}}>HF</span></a>
  <a href="https://huggingface.co/LiquidAI/LFM2-350M-ENJP-MT-GGUF" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#60a5fa'}}><span style={{color: '#000'}}>GGUF</span></a>
  <a href="https://huggingface.co/mlx-community/LFM2-350M-ENJP-MT-8bit" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#c4b5fd'}}><span style={{color: '#000'}}>MLX</span></a>
  <a href="https://huggingface.co/onnx-community/LFM2-350M-ENJP-MT-ONNX" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#86efac'}}><span style={{color: '#000'}}>ONNX</span></a>
</div>

## Specifications

| Property       | Value               |
| -------------- | ------------------- |
| Parameters     | 350M                |
| Context Length | 32K tokens          |
| Task           | Machine Translation |
| Languages      | English ↔ Japanese  |

<div className="use-cases">
  <CardGroup cols={3}>
    <Card title="Real-time Translation" icon="bolt">
      Low-latency inference
    </Card>

    <Card title="Bidirectional" icon="arrows-left-right">
      EN→JP and JP→EN
    </Card>

    <Card title="Edge Deployment" icon="microchip">
      Compact model size
    </Card>
  </CardGroup>
</div>

## Prompting Recipe

<Warning>
  This model requires a specific system prompt to specify translation direction. Single-turn conversations only.
</Warning>

**System Prompts:**

* `"Translate to Japanese."` — English → Japanese
* `"Translate to English."` — Japanese → English

## Quick Start

<Tabs>
  <Tab title="Transformers">
    **Install:**

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    pip install "transformers>=5.2.0" torch accelerate
    ```

    **English to Japanese:**

    ```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    from transformers import AutoTokenizer, AutoModelForCausalLM

    model_id = "LiquidAI/LFM2-350M-ENJP-MT"
    tokenizer = AutoTokenizer.from_pretrained(model_id)
    model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")

    messages = [
        {"role": "system", "content": "Translate to Japanese."},
        {"role": "user", "content": "What is C. elegans?"}
    ]

    inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True).to(model.device)
    outputs = model.generate(**inputs, max_new_tokens=256)
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    print(response)
    # Output: C. elegansとは何ですか？
    ```

    **Japanese to English:**

    ```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    messages = [
        {"role": "system", "content": "Translate to English."},
        {"role": "user", "content": "今日は天気がいいですね。"}
    ]

    inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True).to(model.device)
    outputs = model.generate(**inputs, max_new_tokens=256)
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    print(response)
    # Output: The weather is nice today.
    ```
  </Tab>

  <Tab title="llama.cpp">
    **Download GGUF:**

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    hf download LiquidAI/LFM2-350M-ENJP-MT-GGUF \
      --local-dir ./LFM2-350M-ENJP-MT-GGUF
    ```

    **Run:**

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    # English to Japanese
    llama-cli -m ./LFM2-350M-ENJP-MT-GGUF/LFM2-350M-ENJP-MT-Q4_K_M.gguf \
      -sys "Translate to Japanese." \
      -p "Hello, how are you?"

    # Japanese to English
    llama-cli -m ./LFM2-350M-ENJP-MT-GGUF/LFM2-350M-ENJP-MT-Q4_K_M.gguf \
      -sys "Translate to English." \
      -p "こんにちは、元気ですか？"
    ```
  </Tab>
</Tabs>
