--- license: other license_name: lfm1.0 license_link: https://huggingface.co/LiquidAI/LFM2-1.2B-Extract/blob/main/LICENSE base_model: LiquidAI/LFM2-1.2B-Extract language: - en tags: - mlx - lfm2 - fact-extraction - structured-extraction - on-device - memory pipeline_tag: text-generation library_name: mlx --- # experience-extractor-1.2b-v1 (MLX 8-bit) A small, **on-device structured fact extractor** for memory engines, fine-tuned from [`LiquidAI/LFM2-1.2B-Extract`](https://huggingface.co/LiquidAI/LFM2-1.2B-Extract) (LoRA (rank 32) fine-tune (mlx-lm)). It reads a chat transcript and emits every storable fact as JSON in a fixed **8-field schema**: ```json {"facts": [ {"what": "...", "when": null, "where": null, "why": null, "who": ["..."], "fact_type": "world|experience", "entities": ["..."], "message_refs": ["id:m07"]} ]} ``` It powers the [`experience`](https://github.com/mindi-dev/experience) memory engine (`EXPERIENCE_EXTRACTOR=lfm25`). This repo holds the **MLX 8-bit** build for fast inference on Apple Silicon via Ollama's MLX engine or `mlx-lm`. ## Evaluation (LongMemEval-cleaned "KU", content-recall) > **Run it windowed.** Whole-transcript extraction caps a small model near 0.62; sliding a > **5-message window** and unioning the per-window facts is the recall mechanism and the > recommended deploy mode. Pairing the 350M + 1.2B as an **ensemble** reaches ~0.986 on KU. | mode | recall | mean facts/row | repeat | |---|---|---|---| | **5-msg windowed** (recommended) | **0.958** | ~45 | high (use dedup) | | 5-msg windowed + semantic dedup@0.6 | 0.931 | ~15 | ~0.16 (clean) | | whole-transcript (single pass) | 0.389 — *free decoding understates; use windowing* | low | low | > **This MLX 8-bit build, measured:** windowed **0.958** (= the GGUF), dedup@0.6 0.931. The low whole-transcript 0.389 is a free-decoding artifact, not quant loss — windowing recovers it. ## Files - MLX 8-bit model (`config.json`, `model.safetensors`, tokenizer, chat template); 1.2 GB. ## Usage **Ollama** (MLX engine, Apple Silicon): ```sh ollama run hf.co/mindi-dev/experience-extractor-1.2b-v1-mlx-8bit ``` **mlx-lm**: `mlx_lm.generate --model mindi-dev/experience-extractor-1.2b-v1-mlx-8bit --prompt ""` For the recall numbers above, drive it **windowed** (5-msg sliding window + union + dedup) — e.g. via the experience crate's `EXPERIENCE_EXTRACTION_WINDOW=5`. A single whole-transcript pass under free decoding scores lower. ## Other formats - GGUF (llama.cpp / Ollama / crate): [`mindi-dev/experience-extractor-1.2b-v1-GGUF`](https://huggingface.co/mindi-dev/experience-extractor-1.2b-v1-GGUF) ## Training Full pipeline at [mindi-dev/experience](https://github.com/mindi-dev/experience) (`training/`). Fine-tuned on real-distribution LongMemEval transcripts (leakage-safe; held-out KU never trained on) with grounded teacher-generated labels. ## License Fine-tune of [`LiquidAI/LFM2-1.2B-Extract`](https://huggingface.co/LiquidAI/LFM2-1.2B-Extract) under the **LFM Open License v1.0**. Redistribution permitted with attribution + change notice; **commercial use by entities with ≥ US$10M revenue requires a Liquid AI commercial license** (Sec. 5). The crate code is MIT and separate. See `NOTICE.md` and the full `LICENSE` in this repo.