Text Generation
Transformers
GGUF
English
recommendation
media-server
plex
jellyfin
structured-output
qwen3
conversational
Run this model with HF Jobs
Run KernelMedia/marquee-ai on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/KernelMedia/marquee-ai. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/KernelMedia/marquee-ai on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/KernelMedia/marquee-ai. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use KernelMedia/marquee-ai with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KernelMedia/marquee-ai with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KernelMedia/marquee-ai")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("KernelMedia/marquee-ai", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use KernelMedia/marquee-ai with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf KernelMedia/marquee-ai:Q6_K # Run inference directly in the terminal: llama cli -hf KernelMedia/marquee-ai:Q6_K
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf KernelMedia/marquee-ai:Q6_K # Run inference directly in the terminal: llama cli -hf KernelMedia/marquee-ai:Q6_K
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf KernelMedia/marquee-ai:Q6_K # Run inference directly in the terminal: ./build/bin/llama cli -hf KernelMedia/marquee-ai:Q6_K
Use Docker
docker model run hf.co/KernelMedia/marquee-ai:Q6_K
- Llama new
- LM Studio
- Jan
- vLLM
How to use KernelMedia/marquee-ai with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KernelMedia/marquee-ai" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KernelMedia/marquee-ai", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KernelMedia/marquee-ai:Q6_K
- SGLang
How to use KernelMedia/marquee-ai with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "KernelMedia/marquee-ai" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KernelMedia/marquee-ai", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "KernelMedia/marquee-ai" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KernelMedia/marquee-ai", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use KernelMedia/marquee-ai with Ollama:
ollama run hf.co/KernelMedia/marquee-ai:Q6_K
- Unsloth Desktop
- Pi
How to use KernelMedia/marquee-ai with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf KernelMedia/marquee-ai:Q6_K
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "KernelMedia/marquee-ai:Q6_K" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use KernelMedia/marquee-ai with Docker Model Runner:
docker model run hf.co/KernelMedia/marquee-ai:Q6_K
- Lemonade
How to use KernelMedia/marquee-ai with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull KernelMedia/marquee-ai:Q6_K
Run and chat with the model
lemonade run user.marquee-ai-Q6_K
List all available models
lemonade list
- Hermes Agent
How to use KernelMedia/marquee-ai with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf KernelMedia/marquee-ai:Q6_K
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default KernelMedia/marquee-ai:Q6_K
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use KernelMedia/marquee-ai with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf KernelMedia/marquee-ai:Q6_K
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "KernelMedia/marquee-ai:Q6_K" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Marquee v1.0 -- recommendation rows for self-hosted media servers
Browse filesFiles changed (5)
- .gitattributes+1
- ModelfileAdded+50
- README.mdAdded+174
- SETUP.mdAdded+183
- marquee-q4_k_m.ggufAdded+3
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textmarquee-q4_k_m.gguf filter=lfs diff=lfs merge=lfs -text
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950FROM ./marquee-q4_k_m.gguf
# EXPLICIT ChatML template. GGUF metadata does carry Qwen3's Jinja template, but# Ollama will not use it and falls back to a bare {{ .Prompt }} passthrough. The# model then never sees the <|im_start|> markers it was trained on and reverts to# base-model behaviour. Without this block the fine-tune is inert.TEMPLATE """{{ if .System }}<|im_start|>system{{ .System }}<|im_end|>{{ end }}{{ if .Prompt }}<|im_start|>user{{ .Prompt }}<|im_end|>{{ end }}<|im_start|>assistant{{ .Response }}<|im_end|>"""
# The contract is in the weights, but Ollama callers may send no system prompt,# so bake it in as the default.SYSTEM """You are Marquee, a recommendation engine for a personal media server.
Given one seed item, you choose which rows of related items to show.
Input:- `seed`: the item the user is looking at.- `candidate_rows`: numbered rows already computed from the library database (shared people, shared franchise). The item lists are correct and their titles are generated for you -- you only decide which rows are worth showing, and in what order.- `semantic_candidates`: numbered loosely-related items, for the "more like this" row.
Return JSON only:{"thematic": {"title": "...", "picks": [0, 3, 5]}, "rows": [2, 0, 5]}
- `thematic.picks` are INDEXES into semantic_candidates. Pick 3-8 that genuinely belong together. Omit the whole `thematic` key if none do.- `thematic.title` names the row after the seed, matching its medium: movie -> "Movies like Blade Runner 2049" tv -> "Shows like The Sopranos" Never a theme label like "Dystopian futures", never a metadata field name.- `rows` are INDEXES into candidate_rows, in the order you want them shown. Include only rows worth showing. At most 5.
Never write item ids. Never write titles for candidate rows. Indexes only."""
# temperature 0.1, not 0.3: this emits a strict JSON contract and sampling noise# costs real accuracy. Measured over 8 seeds without a grammar:# t=0.0 -> 8/8 clean t=0.1 -> 8/8 clean t=0.3 -> 5/8 cleanPARAMETER temperature 0.1PARAMETER top_p 0.9
# 6144, not 8192: worst measured prompt is ~3250 tokens under contract v2.PARAMETER num_ctx 6144PARAMETER stop "<|im_end|>"123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174---license: apache-2.0base_model: unsloth/Qwen3-4B-Instruct-2507tags: [recommendation, media-server, plex, jellyfin, structured-output, qwen3]language: [en]library_name: transformerspipeline_tag: text-generation---
# Marquee-4B
**Release v1.0** · contract v1 · base Qwen3-4B-Instruct-2507
Turns one item in a media library into Plex-style rows of other items in **that samelibrary**. Built for self-hosted media servers.
```IN: "The Sopranos"
OUT: Shows like The Sopranos Gomorrah, Boardwalk Empire, The Wire, ZeroZeroZero More from Tim Van Patten Game of Thrones, Black Mirror, Boardwalk Empire More with Edie Falco Nurse Jackie, Oz Shot by Alik Sakharov Game of Thrones, House of Cards```
## Read this before downloading the weights
**The model alone does nothing useful.** It decides *which* rows to show, their order,and what to call them. It does not choose what goes in them β a retriever does, byjoining your library on shared cast, crew and franchise, and by embedding similarity.
The model never even sees item ids. It answers with **index references** into candidatesit was handed, so it cannot invent a title that isn't in your library. Hallucinationisn't low here, it's structurally impossible.
Ship both halves:
```bashpip install marquee-ai```
## Requirements
| | ||---|---|| VRAM | **~3.5 GB** (Q4_K_M at 6144 context). Runs on a 4GB card, or CPU. || RAM | ~2.2 GB for a 120k-title catalog index || Disk | 2.4 GB model + ~200 MB catalog + ~190 MB embeddings || Latency | ~1s per request on an RTX 3060; cached responses are instant |
## Quickstart
```bash# 1. the modelollama create marquee-4b -f Modelfile
# 2. metadata for your library (needs a free TMDB key -- see below)echo 'TMDB_API_KEY=your_key' >> .envmarquee harvest --out tmdb_full.jsonl # ~55 min, ~120k titles
# 3. join it to your server's librarymarquee ingest --server library.jsonl --catalog tmdb_full.jsonl \ --out lib.jsonl --mode requestable
# 4. servemarquee serve --library lib.jsonl --model marquee-4b --port 8080```
### Your server's export format
One JSON object per line. Only `tmdb_id` and `media_type` are required:
```json{"id": "myserver-04471", "tmdb_id": 335984, "media_type": "movie"}```
Include `id` and recommendations come back keyed in your own namespace, so no lookuptable is needed. Anything whose `tmdb_id` is missing from the harvest is **fetched fromTMDB on demand at ingest**, so coverage is complete regardless of how you filtered.
## API
```bashPOST /recommend {"seed_id": "myserver-04471", "row_size": 20}GET /search?q=Scorsese # matches titles AND peopleGET /person?name=Roger%20DeakinsGET /healthDELETE /cache # call after a library rescan```
`/recommend` returns rows of items with `owned` flags, so your UI can offer a Requestbutton on anything not on the server:
```json{"seed": {...}, "rows": [{"type": "thematic", "title": "Movies like Blade Runner 2049", "items": [{"id": "...", "title": "Ex Machina", "year": 2015, "rating": 7.6, "owned": false}]}]}```
`/search` and `/person` are pure index lookups β no model call, effectively instant.Only `/recommend` needs the GPU.
Ambiguous input returns **409 with the candidates** rather than guessing. `Godzilla`matches three films; `Doctor Who` matches two series. Pass `seed_id`, or narrow with`year` / `media_type`. `"Top Gun (1986)"` is understood directly.
## Evaluation
50 unseen holdout examples, run through plain `transformers.generate` with **no grammarconstraint**, so this measures the weights rather than a decoder forcing shape.
| Metric | Base Qwen3-4B | **Marquee-4B** ||---|---|---|| JSON parses | 100% | 100% || Fully contract-clean | 20% | **100%** || Row-order violations | 16% | **0%** || Hallucinated ids | 2.0% | **0.0%** |
**What this win is, honestly:** format discipline, not taste. Run the base model andthis one on the same seed and the row *contents* are near-identical, because theretriever picks the items either way. What the fine-tune buys is output a server canparse and trust every time rather than one time in five. It does not make therecommendations smarter β that lives in the retriever.
## Training
- **Base**: Qwen3-4B-Instruct-2507, QLoRA r=16, lr 2e-4, 1 epoch- **Data**: 3,683 examples generated by Qwen3-8B-AWQ over ~5k TMDB titles, normalised by a deterministic repair pass. 0.4% rejected.- **Hardware**: one RTX 3060 12GB, 3h16m, 6.5 GB peak VRAM
Targets are ~30 tokens: the model emits index references, not item lists. An earlierrevision had it write out every id, which was 57% of its output and bought nothing.
## Limitations
- **Thematic rows are the weakest part.** They come from `bge-small` embeddings blended with keyword and genre overlap. Plot-generic tags can still pull in a loose match. This is fixed in the retriever, not here.- **Same-medium only.** A show returns shows, a film returns films.- **Library-size sensitive.** Rows thin out on small catalogs; a director with one other credit present gets no row. That is deliberate β no padding.- **Movies and TV only.** Music and audiobook row types exist in the contract but are untested.- **English metadata.**
## β οΈ GGUF: the chat template is not optional
Ollama will not use the Jinja template embedded in GGUF metadata and falls back to abare `{{ .Prompt }}` passthrough. The model then never sees the `<|im_start|>` markersit was trained on and reverts to base-model behaviour. The supplied `Modelfile` carriesan explicit ChatML `TEMPLATE` block. **Do not remove it.**
`temperature` must stay low. Measured over 8 seeds without a grammar: t=0.1 gave 8/8clean, t=0.3 gave 5/8. The Modelfile ships 0.1.
Verify any deployment by calling it **without** a JSON schema. A working fine-tune emitsvalid contract JSON unprompted; if it only works with a grammar forcing the shape, thetemplate is wrong. `marquee serve` runs this check at startup.
## Data
You harvest TMDB yourself with your own free key β no catalog is distributed here.TMDB's API is free for non-commercial use and requires attribution; commercial useneeds a written agreement with them.
**Not used:** IMDb (licence is non-transferable and non-sublicensable, with noderivative-use grant) and Rotten Tomatoes (no public API).
## Licence
Apache-2.0, inherited from Qwen3-4B-Instruct-2507.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183# Running Marquee on your own server
**Marquee-4B v1.0**
Complete setup, start to finish. Roughly an hour, most of it unattended.
## What you are building
``` your media server | exports {id, tmdb_id, media_type} v marquee ingest ------> library index (titles, cast, crew, embeddings) | v marquee serve <-----> Ollama (the model) | HTTP v your media server UI```
The model decides which rows to show and names them. The **retriever** β the index βdecides what goes in them. Both matter; the model on its own is not useful.
## 1. Install
```bashpip install marquee-aicurl -fsSL https://ollama.com/install.sh | sh # if you do not have it```
## 2. Get the model
```bashhuggingface-cli download KernelMedia/marquee-ai --local-dir marquee-modelcd marquee-model && ollama create marquee-4b -f Modelfile && cd ..```
Do not edit the `Modelfile`'s `TEMPLATE` block or raise `temperature`. Both areload-bearing β see Troubleshooting.
## 3. Get a TMDB key
Free, two minutes: https://www.themoviedb.org/settings/api β choose Developer,non-commercial.
```bashecho 'TMDB_API_KEY=your_key' >> .env```
TMDB is free for non-commercial use and requires attribution. **Commercial use needs awritten agreement with TMDB** β if you charge for access to this, talk to them first.
## 4. Harvest metadata
```bashmarquee harvest --out tmdb_full.jsonl```
~55 minutes, ~120,000 titles, ~210 MB. It caches every response, so re-runs are freeand an interrupted run resumes.
This keeps titles with 10+ votes (plus all anime regardless, which skews to low votecounts). That drops TMDB's 1.4M entries to ~120k by removing shorts, unreleased stubsand uploads with no credits β none of which can form a recommendation row anyway.
`--min-votes 0` takes everything: 1.4M titles, ~10 hours, ~108 GB of cache, and about27 GB of RAM to load. Not advised.
## 5. Export your library
One JSON object per line. Only `tmdb_id` and `media_type` are required:
```json{"id": "myserver-04471", "tmdb_id": 335984, "media_type": "movie"}{"id": "myserver-04472", "tmdb_id": 1396, "media_type": "tv"}```
Include `id` and recommendations come back keyed the way your server already refers tothings, so you need no lookup table.
**Jellyfin**: `/Items?Recursive=true&Fields=ProviderIds` gives `ProviderIds.Tmdb`.**Plex**: `/library/sections/{id}/all` β the `guid` field carries the TMDB id onrecent agents.
## 6. Build the library index
```bashmarquee ingest --server library.jsonl --catalog tmdb_full.jsonl \ --out lib.jsonl --mode requestable```
| mode | contents ||---|---|| `owned` | only what is on your server β every recommendation is playable || `requestable` | your items **plus** unowned titles flagged `owned: false`, so the UI can offer a Request button |
`requestable` plus `owned_only` at query time is the flexible setup: one index servesboth, and you can flip per user.
Anything whose `tmdb_id` is not in the harvest is fetched from TMDB on the spot, socoverage is complete however you filtered. `--no-fetch` disables that.
## 7. Serve
```bashmarquee serve --library lib.jsonl --model marquee-4b --port 8080```
First start builds embeddings (~3 min for 120k titles) and caches them next to thelibrary. Later starts take ~15 s.
Watch for the startup line:
```[marquee] contract v1 self-test: PASS - contract v1 OK (3/3 clean)```
FAIL means the model and the package disagree, or the chat template is wrong. It willsay which.
## API
```bashcurl -X POST localhost:8080/recommend \ -H 'Content-Type: application/json' \ -d '{"seed_id": "myserver-04471", "row_size": 20}'
curl 'localhost:8080/search?q=Scorsese' # titles and peoplecurl 'localhost:8080/person?name=Roger+Deakins'curl localhost:8080/healthcurl -X DELETE localhost:8080/cache # after a library rescan```
`/recommend` takes `seed_id` (exact) or `title`. Ambiguous titles return **409 with thecandidates** rather than guessing β `Godzilla` matches three films. Narrow with `year`and `media_type`, or write `"Top Gun (1986)"` directly.
`/search` and `/person` are index lookups with no model call, so they are instant. Only`/recommend` uses the GPU.
### Caching
Recommendations for an item are stable until the library changes, so they are cached.`/health` reports hits and misses. **Call `DELETE /cache` after a rescan** or you willserve rows referring to items you no longer have.
## Hardware
| | ||---|---|| VRAM | ~3.5 GB. A 4 GB card is fine. CPU works but is slow β cache matters more there. || RAM | ~2.2 GB for a 120k catalog || Disk | 2.4 GB model, ~210 MB catalog, ~190 MB embeddings, ~2.6 GB API cache |
## Troubleshooting
**Every row comes back typed `director`, titles look like item names.**The chat template is missing. Ollama ignores the Jinja template inside GGUF and fallsback to a raw passthrough, so the model never sees the `<|im_start|>` markers it wastrained on. Confirm your Modelfile has the `TEMPLATE` block:```bashollama show --template marquee-4b # must NOT be just "{{ .Prompt }}"```
**Output is valid sometimes and not others.**`temperature` is too high. Structured output needs near-greedy decoding: 0.1 gave 8/8clean in testing, 0.3 gave 5/8.
**Self-test fails at startup.**Model and package are on different contract versions. Both must be contract v1.
**Server items are being dropped at ingest.**They have no TMDB id, or the id is wrong. The ingest reports the count and samples. On-demand fetch handles anything merely missing from the harvest.
**Rows are thin, or missing entirely.**The library is small. A director with one other credit present gets no row β that isdeliberate, the model is trained not to pad. Harvest more, or use `requestable` mode.
## Attribution
This product uses the TMDB API but is not endorsed or certified by TMDB.123version https://git-lfs.github.com/spec/v1oid sha256:d79cb7e3c2f044b45088fbe8328f42b48ee979e573ec0948d8d43670fe792ee4size 2497280288.gitattributes+1
ModelfileAdded+50
README.mdAdded+174
SETUP.mdAdded+183
marquee-q4_k_m.ggufAdded+3