Review · updated OCT 11

Gemma 4 26B A4B review: decent, with trade-offs

It scored 70 out of 100, #23 of 56. It solved 25 of 30 coding jobs and scored 58 on reading documents. Runs on a 24 GB graphics card or a Mac with 32 GB.

The short version
  • Gemma 4 26B A4B is a free model from Google that you can run on your own computer. In our tests it's decent, with trade-offs: 70 out of 100, #23 of 56.
  • It solved 25 of 30 coding jobs and scored 58 on reading documents. On our hardest tasks it scored 50.
  • Runs on a 24 GB graphics card or a Mac with 32 GB.

Coding

Our coding test is 30 programming jobs, from small ones like reading time durations or cleaning up messy data to harder ones like a config-file parser or a double-entry ledger. We run each answer against tests the model never sees, and a job only counts if everything passes. Gemma 4 26B A4B got 25 of 30 right. The best local coders solved 29 of 30.

Reading documents

The second test hands the model things like an expense claim thread, a pay stub or an insurance statement, and asks for specific numbers and dates. Many questions need a bit of math, or noticing a correction further down the email. Gemma 4 26B A4B scored 58; the best model scored 100.

TestScorePublic questionsSecret questions
Coding837187
Reading documents587952
Decisions928993

On the 18 hardest tasks (included in the scores above) it scored 50. This number separates the top models.

This model did much better on our public questions than on the secret ones. Sometimes that's luck; it can also mean the model has seen the public questions before.

We tested the full-size version online. The smaller versions you download usually score a little lower.

Can your computer run it?

You can download Gemma 4 26B A4B in several sizes. Smaller versions fit on more computers and lose a little quality, so pick the biggest one that fits.

Your computerRuns it?Version to download
Graphics card, 8 GBNo–
Graphics card, 12 GBNo–
Graphics card, 16 GBNo–
Graphics card, 24 GBYesQ5
Graphics card, 32 GBYesQ8
Mac, 16 GBNo–
Mac, 24 GBNo–
Mac, 32 GBYesQ5
Mac, 48 GBYesQ8
Mac, 64 GBYesQ8
Mac, 96 GBYesQ8
Mac, 128 GBYesQ8

For normal-length chats. Long documents need more memory. Q4 or Q8? · How we worked this out

How to try it

Search for "Gemma 4 26B A4B GGUF" in LM Studio or on Hugging Face and pick the version that fits your computer. New to this? Start with our Ollama guide.

Want the strongest all-rounder instead? Qwen3.6 27B scored 97.

Its actual answers

What Gemma 4 26B A4B wrote for our public questions, word for word.

Coding: INI parser (hard) Worked
```python
import re

def parse_ini(text: str) -> dict[str, dict[str, str]]:
    lines = text.splitlines()
    
    sections_raw = {}
    current_section = None
    last_key = None
    
    # Parsing Stage 1: Structural breakdown
    for line_idx, line in enumerate(lines):
        stripped_line = line.lstrip()
        
        # Rule 3: Skip empty or comment lines
        if not stripped_line or stripped_line[0] in (';', '#'):
            continue
            
        # Rule 1: Section headers
        section_match = re.match(r'^\[\s*(.+?)\s*\]\s*$', stripped_line)
        if section_match:
            current_section = section_match.group(1)
            if current_section not in sections_raw:
                sections_raw[current_section] = {}
            last_key = None
            continue

        # Rule 6: Continuation lines
        if line.startswith((' ', '\t')) and last_key is not None and current_section is not None:
            # Handle inline comments for continuation? 
            # Rule 4 says "An inline comment starts at ; or #". 
            # We apply the stripping/comment logic to the continuation line text.
            val_part = _strip_inline_comment(line)
            prev_val = sections_raw[current_section][last_key]
            sections_raw[current_section][last_key] = f"{prev_val}\n{val_part.strip()}"
            continue

        # Rule 2 & 10: Key-Value pairs
        # Find first '=' or ':'
        match = re.search(r'[=:]', line)
        if match:
            if current_section is None:
                raise ValueError("Key before section header")
            
            split_idx = match.start()
            key_part = line[:split_idx].strip().lower()
            val_part_raw = line[split_idx + 1:]
            
            # Rule 4 & 5: Handle inline comments and quotes
            value = _parse_value(val_part_raw)
            
            if not key_part:
                raise ValueError("Empty key")
                
            sections_raw[current_section][key_part] = value
            last_key = key_part
        else:
            # If it's not a section, not a comment, not a continuation, and not a KV pair
            raise ValueError(f"Malformed line: {line}")

    # Rule 8: Setup Inheritance
    defaults = sections_raw.pop('DEFAULT', {})
    final_sections = {}
    
    # Rule 9: Interpolation logic
    def resolve_value(val: str, section_name: str, visited: tuple[str, ...]) -> str:
        if not isinstance(val, str) or '${' not in val:
            return val

        def replace_match(m):
            content = m.group(1)
            # Check if it is section:key or just key
            if ':' in content:
                target_sec, target_key = content.split(':', 1)
            else:
                target_sec, target_key = section_name, content
            
            # Check for cycles: (section, key)
            lookup_id = (target_sec, target_key)
            if lookup_id in visited:
                raise ValueError("Circular interpolation detected")
            
            # Get value from target section
            # Determine effective keys for target section
            if target_sec not in sections_raw and target_sec != 'DEFAULT':
                # If target section doesn't exist, we treat it as empty, 
                # but if it's a key in DEFAULT, we must check.
                # However, Rule 8 says DEFAULT is inherited.
                # We need to check target_sec's content + DEFAULT.
                target_keys = {}
                if target_sec in sections_raw: # This shouldn't happen given logic above
                    target_keys = sections_raw[target_sec]
                elif target_sec == 'DEFAULT':
                    target_keys = defaults
                else:
                    # Rule 9 implies target_sec must exist
                    raise KeyError(f"Section not found: {target_sec}")
            else:
                # This is a bit tricky because we need to apply inheritance during lookup
                # Let's use a helper to get the effective value
                target_keys = _get_effective_keys(target_sec)

            if target_key not in target_keys:
                raise KeyError(f"Key '{target_key}' not found in section '{target_sec}'")
            
            return resolve_value(target_keys[target_key], target_sec, visited + (lookup_id,))

        # Manual parsing of ${} to handle nested/recursive via regex substitution
        # We use a loop to handle nested ${} by resolving from inside out or simply 
        # recursively calling the resolver.
        
        # To handle nested correctly, we find the innermost ${...}
        while '${' in val:
            match = re.search(r'\${([^${}]+)}', val)
            if not match: # Should not happen with valid syntax
                break
            res = replace_match(match)
            val = val[:match.start()] + res + val[match.end():]
            
        return val

    def _get_effective_keys(sec_name):
        if sec_name == 'DEFAULT':
            return defaults
        if sec_name not in sections_raw:
            raise KeyError(f"Section not found: {sec_name}")
        # Inherit from DEFAULT
        eff = defaults.copy()
        eff.update(sections_raw[sec_name])
        return eff

    # Final assembly
    for sec_name in sections_raw:
        effective_keys = _get_effective_keys(sec_name)
        final_sections[sec_name] = {}
        for k, v in effective_keys.items():
            # Rule 9: Recursive interpolation
            # Note: We pass a tuple of (section, key) to track cycles
            final_sections[sec_name][k] = resolve_value(v, sec_name, ())

    return final_sections

def _strip_inline_comment(line: str) -> str:
    """Helper to remove inline comments while respecting quotes."""
    in_quotes = False
    for i in range(len(line)):
        if line[i] == '"':
            in_quotes = not in_quotes
        if not in_quotes:
            # Rule 4: whitespace followed by ; or #
            if i > 0 and line[i-1].isspace() and line[i] in (';', '#'):
                return line[:i]
    return line

def _parse_value(val_part: str) -> str:
    """Rule 4 & 5: Handle quotes and inline comments."""
    # First, handle the comment stripping
    # We must be careful: the comment is ' ;' or ' #'. 
    # If it's inside quotes, it's not a comment.
    
    # We need to find the first ' ;' or ' #' that is NOT in quotes.
    # But Rule 2 says split on first = or :. The value part starts after that.
    
    # Let's find the split point for comments
    stripped_val = val_part.lstrip()
    if not stripped_val:
        return ""

    # Check if value starts with a quote
    if stripped_val.startswith('"'):
        # Find the closing quote
        # Note: Rule 5 says "everything inside the quotes exactly (no stripping, comment characters allowed)"
        # We look for the next quote that isn't escaped? Rule doesn't mention escapes.
        # We'll assume simple non-escaped quotes.
        end_quote_idx = -1
        for i in range(1, len(stripped_val)):
            if stripped_val[i] == '"':
                end_quote_idx = i
                break
        if end_quote_idx != -1:
            return stripped_val[1:end_quote_idx]
        else:
            # Malformed quoted string: treat as unquoted or error? 
            # Rule 5 implies we remove the quotes. If no end, we take the rest.
            return stripped_val[1:]

    # If not starting with quote, we must strip inline comments
    # An inline comment starts at " ;" or " #"
    # Since we are looking at the value part, we look for ' ;' or ' #'
    # We need the original line context to check for whitespace before the symbol
    # but _parse_value receives the part after '=' or ':'.
    # If the original line was "key = val ; comment", val_part is " val ; comment"
    
    # Let's re-examine Rule 4: "An inline comment starts at  ; or  # (whitespace followed by ; or #)"
    # We iterate through the string and look for the pattern.
    
    i = 0
    while i < len(val_part):
        if val_part[i] in (';', '#'):
            if i > 0 and val_part[i-1].isspace():
                # Found comment. But wait, we need to handle quotes if they appeared earlier.
                # But if it's not a quoted value, we can just slice.
                break
        i += 1
    
    return val_part[:i].strip()

# Overwriting _parse_value with a more robust version to handle the "space-before-comment" rule
def _parse_value(val_part: str) -> str:
    # Rule 5: If starts with ", it's a quoted value
    s = val_part.lstrip()
    if not s:
        return ""
    
    if s[0] == '"':
        # Find the closing quote
        # Rule 5: "The quotes are removed"
        # We search for the matching quote
        end_idx = s.find('"', 1)
        if end_idx != -1:
            return s[1:end_idx]
        else:
            return s[1:]
    
    # Rule 4: Inline comment starts at " ;" or " #"
    # We look for the pattern in the raw val_part
    # Note: the whitespace must be part of the string.
    
    # We need to find the index of (' ;' or ' #')
    # This could be part of the value, so we must not trigger if it's not preceded by space.
    # However, Rule 4 says "whitespace followed by ; or #". 
    # We'll scan for that.
    
    comment_idx = -1
    for i in range(1, len(val_part)):
        if (val_part[i] == ';' or val_part[i] == '#') and val_part[i-1].isspace():
            comment_idx = i
            break
            
    if comment_idx != -1:
        return val_part[:comment_idx].strip()
    else:
        return val_part.strip()

# Re-assigning to the scope of parse_ini
parse_ini.__globals__['_parse_value'] = _parse_value
```

Wait, I cannot use `__globals__` hacks in a clean solution. I will rewrite the logic into a single cohesive function.

```python
import re

def parse_ini(text: str) -> dict[str, dict[str, str]]:
    lines = text.splitlines()
    sections_raw = {}
    current_section = None
    last_key = None

    def get_value_and_strip_comment(v_part: str) -> str:
        s = v_part.lstrip()
        if not s:
            return ""
        if s[0] == '"':
            end_idx = s.find('"', 1)
            if end_idx != -1:
                return s[1:end_idx]
            return s[1:]
        
        comment_idx = -1
        for i in range(1, len(v_part)):
            if (v_part[i] == ';' or v_part[i] == '#') and v_part[i-1].isspace():
                comment_idx = i
                break
        if comment_idx != -1:
            return v_part[:comment_idx].strip()
        return v_part.strip()

    for line in lines:
        stripped_line = line.lstrip()
        if not stripped_line or stripped_line[0] in (';', '#'):
            continue

        section_match = re.match(r'^\[\s*(.+?)\s*\]\s*$', stripped_line)
        if section_match:
            current_section = section_match.group(1)
            if current_section not in sections_raw:
                sections_raw[current_section] = {}
            last_key = None
            continue

        if line.startswith((' ', '\t')) and last_key is not None and current_section is not None:
            # Continuation line: rule 6. 
            # We treat it like a value part.
            val_part = line
            # For continuation, rule 6 says "its stripped text is appended"
            # We must still handle rule 4 (comments) for the continuation line?
            # Rule 4 says "An inline comment... runs to the end of the line".
            # Usually, continuation lines don't have their own comments, 
            # but the rule doesn't forbid it. Let's strip it.
            val_part = get_value_and_strip_comment(val_part)
            prev_val = sections_raw[current_section][last_key]
            sections_raw[current_section][last_key] = f"{prev_val}\n{val_part.strip()}"
            continue

        match = re.search(r'[=:]', line)
        if match:
            if current_section is None:
                raise ValueError("Key before section header")
            split_idx = match.start()
            key_part = line[:split_idx].strip().lower()
            if not key_part:
                raise ValueError("Empty key")
            val_part = line[split_idx + 1:]
            sections_raw[current_section][key_part] = get_value_and_strip_comment(val_part)
            last_key = key_part
        else:
            raise ValueError("Malformed line")

    defaults = sections_raw.pop('DEFAULT', {})

    def get_effective_keys(sec_name):
        if sec_name == 'DEFAULT': return defaults
        if sec_name not in sections_raw: raise KeyError(f"Section {sec_name} not found")
        eff = defaults.copy()
        eff.update(sections_raw[sec_name])
        return eff

    def resolve(val, sec_name, visited):
        if not isinstance(val, str) or '${' not in val:
            return val
        
        # We must handle interpolation carefully to support nested and recursion.
        # The rule says "interpolation is recursive".
        # Use a regex to find the innermost ${...} and replace it.
        
        while True:
            # Find innermost ${...}
            match = re.search(r'\${([^${}]+)}', val)
            if not match:
                break
            
            content = match.group(1)
            if ':' in content:
                t_sec, t_key = content.split(':', 1)
            else:
                t_sec, t_key = sec_name, content
            
            lookup_id = (t_sec, t_key)
            if lookup_id in visited:
                raise ValueError("Circular interpolation")
            
            t_keys = get_effective_keys(t_sec)
            if t_key not in t_keys:
                raise KeyError(f"Key {t_key} not in {t_sec}")
            
            # Recursively resolve the found value
            res = resolve(t_keys[t_key], t_sec, visited + (lookup_id,))
            # Replace the ${...} in the string
            val = val[:match.start()] + str(res) + val[match.end():]
            
        return val

    final_sections = {}
    for sec_name in sections_raw:
        eff_keys = get_effective_keys(sec_name)
        final_sections[sec_name] = {}
        for k, v in eff_keys.items():
            final_sections[sec_name][k] = resolve(v, sec_name, ())
            
    return final_sections
```

Actually, I must provide the final code block now. I'll combine it and clean it up.

```python
import re

def parse_ini(text: str) -> dict[str, dict[str, str]]:
    lines = text.splitlines()
    sections_raw = {}
    current_section = None
    last_key = None

    def get_value_and_strip_comment(v_part: str) -> str:
        s = v_part.lstrip()
        if not s:
            return ""
        if s[0] == '"':
            end_idx = s.find('"', 1)
            if end_idx != -1:
                return s[1:end_idx]
            return s[1:]
        comment_idx = -1
        for i in range(1, len(v_part)):
            if (v_part[i] == ';' or v_part[i] == '#') and v_part[i-1].isspace():
                comment_idx = i
                break
        if comment_idx != -1:
            return v_part[:comment_idx].strip()
        return v_part.strip()

    for line in lines:
        stripped_line = line.lstrip()
        if not stripped_line or stripped_line[0] in (';', '#'):
            continue
        section_match = re.match(r'^\[\s*(.+?)\s*\]\s*$', stripped_line)
        if section_match:
            current_section = section_match.group(1)
            if current_section not in sections_raw:
                sections_raw[current_section] = {}
            last_key = None
            continue
        if line.startswith((' ', '\t')) and last_key is not None and current_section is not None:
            val_part = get_value_and_strip_comment(line)
            prev_val = sections_raw[current_section][last_key]
            sections_raw[current_section][last_key] = f"{prev_val}\n{val_part.strip()}"
            continue
        match = re.search(r'[=:]', line)
        if match:
            if current_section is None:
                raise ValueError("Key before section header")
            split_idx = match.start()
            key_part = line[:split_idx].strip().lower()
            if not key_part:
                raise ValueError("Empty key")
            val_part = line[split_idx + 1:]
            sections_raw[current_section][key_part] = get_value_and_strip_comment(val_part)
            last_key = key_part
        else:
            raise ValueError("Malformed line")

    defaults = sections_raw.pop('DEFAULT', {})

    def get_effective_keys(sec_name):
        if sec_name == 'DEFAULT': return defaults
        if sec_name not in sections_raw: raise KeyError(f"Section {sec_name} not found")
        eff = defaults.copy()
        eff.update(sections_raw[sec_name])
        return eff

    def resolve(val, sec_name, visited):
        while True:
            match = re.search(r'\${([^${}]+)}', val)
            if not match:
                break
            content = match.group(1)
            if ':' in content:
                t_sec, t_key = content.split(':', 1)
            else:
                t_sec, t_key = sec_name, content
            lookup_id = (t_sec, t_key)
            if lookup_id in visited:
                raise ValueError("Circular interpolation")
            t_keys = get_effective_keys(t_sec)
            if t_key not in t_keys:
                raise KeyError(f"Key {t_key} not found")
            res = resolve(t_keys[t_key], t_sec, visited + (lookup_id,))
            val = val[:match.start()] + str(res) + val[match.end():]
        return val

    final_sections = {}
    for sec_name in sections_raw:
        eff_keys = get_effective_keys(sec_name)
        final_sections[sec_name] = {k: resolve(v, sec_name, ()) for k, v in eff_keys.items()}
    return final_sections
```
Coding: TTL LRU (hard) Didn't work
```python
from collections import OrderedDict

class TTLCache:
    def __init__(self, capacity: int, ttl: float, clock):
        self.capacity = capacity
        self.ttl = ttl
        self.clock = clock
        self.cache = OrderedDict()  # key -> (value, expiry)
        self.stats = {
            "hits": 0,
            "misses": 0,
            "evictions": 0,
            "expirations": 0
        }

    def put(self, key, value):
        if self.capacity <= 0:
            return

        now = self.clock()
        
        if key in self.cache:
            # Replacing an existing key refreshes expiry and recency
            del self.cache[key]
        else:
            # If inserting a NEW key, first remove all expired entries
            expired_keys = [k for k, (v, exp) in self.cache.items() if now >= exp]
            if expired_keys:
                for k in expired_keys:
                    del self.cache[k]
                self.stats["expirations"] += len(expired_keys)

            # If still full, evict LRU (which is the first item in OrderedDict)
            if len(self.cache) >= self.capacity:
                self.cache.popitem(last=False)
                self.stats["evictions"] += 1

        self.cache[key] = (value, now + self.ttl)

    def get(self, key, default=None):
        now = self.clock()
        
        if key not in self.cache:
            self.stats["misses"] += 1
            return default

        value, expiry = self.cache[key]

        if now >= expiry:
            # Expired entry: remove, count as expiration and miss
            del self.cache[key]
            self.stats["expirations"] += 1
            self.stats["misses"] += 1
            return default
        else:
            # Valid entry: mark most recently used
            self.cache.move_to_end(key)
            self.stats["hits"] += 1
            return value

    def __len__(self):
        now = self.clock()
        return sum(1 for k, (v, exp) in self.cache.items() if now < exp)

    def stats(self):
        return self.stats.copy()
```
Coding: Parse duration Didn't work
```python
import re

def parse_duration(s: str) -> int:
    """
    Converts a duration string into a total number of seconds.
    Supported units: h, m, s (case-insensitive).
    """
    s = s.strip()
    if not s:
        raise ValueError("Duration string cannot be empty or blank.")

    # Regex to find pairs of (number)(unit)
    # \d+ ensures we only match integers (no decimals allowed)
    # [a-zA-Z] captures the unit part
    pattern = re.compile(r'(\d+)([a-zA-Z])')
    
    # To validate the string structure, we find all matches and check if 
    # they cover the entire non-whitespace content of the string.
    # We first remove all whitespace to simplify verification.
    stripped_content = "".join(s.split())
    
    matches = list(pattern.finditer(s))
    
    # Check if there are any matches at all
    if not matches:
        raise ValueError("No valid duration parts found.")

    # Validate that the entire string is composed strictly of valid parts
    # Reconstruct the string from matches and compare with stripped content
    reconstructed = ""
    for m in matches:
        reconstructed += m.group(1) + m.group(2).lower()
    
    if reconstructed != stripped_content:
        # This handles cases like "10.5h", "10x", "1h5", etc.
        raise ValueError("Invalid format or unsupported characters.")

    unit_map = {'h': 3600, 'm': 60, 's': 1}
    order_map = {'h': 0, 'm': 1, 's': 2}
    
    total_seconds = 0
    seen_units = []

    for m in matches:
        value = int(m.group(1))
        unit = m.group(2).lower()

        if unit not in unit_map:
            raise ValueError(f"Unknown unit: {unit}")
        
        if unit in seen_units:
            raise ValueError(f"Duplicate unit: {unit}")
        
        # Check if units are in order (h -> m -> s)
        # Since we iterate through the matches, if current unit's rank 
        # is less than the previous unit's rank, it's out of order.
        current_rank = order_map[unit]
        if seen_units:
            prev_rank = order_map[seen_units[-1]]
            if current_rank <= prev_rank:
                raise ValueError("Units must appear in order: h, m, s.")

        seen_units.append(unit)
        total_seconds += value * unit_map[unit]

    return total_seconds
```
Coding: Summarize ranges Worked
```python
def summarize_ranges(nums: list[int]) -> str:
    if not nums:
        return ""

    # Sort and remove duplicates
    sorted_nums = sorted(set(nums))
    
    result_parts = []
    n = len(sorted_nums)
    i = 0
    
    while i < n:
        start = i
        # Find the end of the current consecutive run
        while i + 1 < n and sorted_nums[i + 1] == sorted_nums[i] + 1:
            i += 1
        
        end = i
        run_length = end - start + 1
        
        # Collapse runs of 3 or more into "a..b"
        if run_length >= 3:
            result_parts.append(f"{sorted_nums[start]}..{sorted_nums[end]}")
        else:
            # Otherwise, list them individually
            for j in range(start, end + 1):
                result_parts.append(str(sorted_nums[j]))
        
        i += 1
        
    return ",".join(result_parts)
```
Coding: Top customers Worked
```python
import re
from collections import defaultdict

def top_customers(rows: list[dict], n: int) -> list[tuple[str, float]]:
    """
    Calculates the top n customers based on total spending.
    """
    # totals maps lowercase name -> running total
    totals = defaultdict(float)
    # name_map maps lowercase name -> original trimmed name from first occurrence
    name_map = {}
    
    # Regex to extract numeric parts: allows leading '-', optional '$', 
    # commas, and decimal points.
    # We strip '$' and ',' manually for simplicity and reliability.
    
    for row in rows:
        raw_name = row.get("customer")
        raw_amount = row.get("amount")
        
        if not isinstance(raw_name, str) or not isinstance(raw_amount, str):
            continue
            
        trimmed_name = raw_name.strip()
        if not trimmed_name:
            continue
            
        # Parse amount
        # Remove currency symbols and thousands separators
        clean_amount = raw_amount.replace('$', '').replace(',', '')
        try:
            amount_val = float(clean_amount)
        except ValueError:
            continue
            
        lower_name = trimmed_name.lower()
        
        # If this is the first time we see this customer, store the trimmed spelling
        if lower_name not in name_map:
            name_map[lower_name] = trimmed_name
            
        totals[lower_name] += amount_val

    # Prepare results: list of (original_name, total_amount)
    # Round totals to 2 decimals as requested
    results = []
    for lower_name, total in totals.items():
        results.append((name_map[lower_name], round(total, 2)))
        
    # Sort: total descending (-x[1]), then name ascending (x[0])
    results.sort(key=lambda x: (-x[1], x[0]))
    
    return results[:n]
```
Coding: Slugify Worked
```python
import unicodedata
import re

def slugify(title: str, max_len: int = 50) -> str:
    # 1. Transliterate accented characters to ASCII and drop others
    # Normalize to decomposed form to separate accents from base characters
    normalized = unicodedata.normalize('NFKD', title)
    # Encode to ASCII, ignoring characters that cannot be converted
    ascii_bytes = normalized.encode('ascii', 'ignore')
    text = ascii_bytes.decode('ascii')

    # 2. Lowercase
    text = text.lower()

    # 3. Replace runs of non-alphanumeric characters with a single "-"
    # and strip leading/trailing "-"
    text = re.sub(r'[^a-z0-9]+', '-', text)
    text = text.strip('-')

    if not text:
        return ""

    # 4. Length management
    if len(text) <= max_len:
        return text

    # Split into words based on the delimiter
    words = text.split('-')
    
    # Try to find the longest prefix of whole words that fits
    current_slug = ""
    for i, word in enumerate(words):
        # Calculate length if we add this word (including a dash if not the first word)
        addition = len(word) + (1 if current_slug else 0)
        
        if len(current_slug) + addition <= max_len:
            if current_slug:
                current_slug += "-" + word
            else:
                current_slug = word
        else:
            # Cannot add this whole word without exceeding max_len
            break

    # 5. If even the first word is longer than max_len, hard-cut it
    if not current_slug:
        current_slug = text[:max_len].rstrip('-')
        # Ensure we don't end with a dash after a hard cut
        if current_slug.endswith('-'):
            current_slug = current_slug[:-1]

    return current_slug
```
Coding: Token bucket Worked
```python
class TokenBucket:
    def __init__(self, capacity: float, refill_per_sec: float, clock):
        self._capacity = float(capacity)
        self._refill_per_sec = float(refill_per_sec)
        self._clock = clock
        self._last_refill_time = self._clock()
        self._tokens = self._capacity

    def _refill(self) -> None:
        now = self._clock()
        elapsed = now - self._last_refill_time
        
        if elapsed > 0:
            new_tokens = elapsed * self._refill_per_sec
            self._tokens = min(self._capacity, self._tokens + new_tokens)
            self._last_refill_time = now

    def allow(self, cost: float = 1.0) -> bool:
        self._refill()
        if self._tokens >= cost:
            self._tokens -= cost
            return True
        return False

    @property
    def tokens(self) -> float:
        self._refill()
        return self._tokens
```
Decisions: Refund window (hard) 50% right
{"outcome": {"full_refund": 0.0, "partial_refund": 1.0, "store_credit": 0.0, "nothing": 0.0}, "defective": {"true": 0.0, "false": 1.0}}
Decisions: Incident matrix (hard) 100% right
{
  "severity": {
    "0": 0.0,
    "1": 0.8,
    "2": 0.2,
    "3": 0.0
  },
  "page": {
    "true": 0.0,
    "false": 1.0
  }
}
Decisions: Tool followup (hard) 100% right
{"tool": {"calendar": 1.0}, "confirm": {"true": 0.8, "false": 0.2}}
Decisions: Legit security alert (hard) 100% right
{
  "phishing": {
    "false": 0.98,
    "true": 0.02
  },
  "action_needed": {
    "false": 0.99,
    "true": 0.01
  }
}
Decisions: Meeting slot (hard) 0% right
{
  "slot": {
    "A": 0.0,
    "B": 0.0,
    "C": 1.0,
    "D": 0.0
  },
  "raj_last": {
    "true": false,
    "false": true
  }
}
Decisions: Review mixed (hard) 100% right
{"hardware": {"true": 1.0, "false": 0.0}, "support": {"true": 1.0, "false": 0.0}}
Decisions: Support checkout down 100% right
{
  "department": {
    "technical": 0.95,
    "billing": 0.04,
    "account": 0.01,
    "shipping": 0.0,
    "sales": 0.0
  },
  "urgency": {
    "3": 1.0,
    "2": 0.0,
    "1": 0.0,
    "0": 0.0
  },
  "outage": {
    "true": 1.0,
    "false": 0.0
  }
}
Decisions: Refund wrong plan 100% right
{
  "department": {
    "billing": 1.0
  },
  "refund": {
    "true": 1.0
  },
  "tone": {
    "calm": 1.0
  }
}
Decisions: Moderation doxxing 100% right
{
  "policy": {
    "harassment": 1.0
  },
  "personal_info": {
    "true": 1.0
  }
}
Decisions: Route calendar 100% right
{"tool": {"calendar": 1.0, "web_search": 0.0, "calculator": 0.0, "email": 0.0, "none": 0.0}, "confirm": {"true": 1.0, "false": 0.0}}
Decisions: Doc invoice missing due 100% right
{"doc_type": {"invoice": 1.0, "resume": 0.0, "contract": 0.0, "bank_statement": 0.0, "other": 0.0}, "missing_due_date": {"true": 1.0, "false": 0.0}}
Decisions: Phishing paypal 100% right
{
  "phishing": {
    "true": 1.0,
    "false": 0.0
  },
  "risk": {
    "0": 0.0,
    "1": 0.0,
    "2": 0.0,
    "3": 1.0
  }
}
Decisions: Pii ssn email 100% right
{"data_kind": {"none": 0.0, "contact": 0.1, "financial": 0.05, "government_id": 0.85, "health": 0.0}, "sensitive": {"true": 1.0, "false": 0.0}}
Decisions: Review mixed 100% right
{"sentiment": {"positive": 0.05, "neutral": 0.05, "negative": 0.9}, "defect": {"true": 1.0, "false": 0.0}, "recommend": {"true": 0.0, "false": 1.0}}
Documents: Saas escalator (hard) 20% right
{
  "year2_price_per_seat_month": 46.53,
  "year3_price_per_seat_month": 46.53,
  "year1_invoice": 48600.00,
  "year2_invoice": 50712.00,
  "addon_months_billed": 6,
  "addon_invoice": 39550.80,
  "year3_invoice": 100224.00,
  "year3_discount_percent": 10,
  "total_contract_value": 239086.80,
  "contract_end_date": "2027-02-28"
}
Documents: Expense thread 96% right
{
  "employee_id": "EMP-20417",
  "destination_city": "Lisbon",
  "trip_start": "2025-02-24",
  "trip_end": "2025-02-27",
  "approved_items": [
    {
      "date": "2025-02-24",
      "category": "airfare",
      "amount_usd": 1184.60
    },
    {
      "date": "2025-02-24",
      "category": "ground_transport",
      "amount_usd": 38.88
    },
    {
      "date": "2025-02-25",
      "category": "meals",
      "amount_usd": 229.39
    },
    {
      "date": "2025-02-26",
      "category": "lodging",
      "amount_usd": 466.56
    },
    {
      "date": "2025-02-27",
      "category": "ground_transport",
      "amount_usd": 44.82
    }
  ],
  "rejected_item_count": 2,
  "per_diem_days": 3,
  "per_diem_usd": 195.00,
  "total_reimbursable_usd": 2159.25,
  "approver_email": "priya.raman@corvane.com"
}
Documents: Lease amendment 100% right
{
  "tenants": [
    "Marcus Lin",
    "Sofia Lin"
  ],
  "landlord": "Ridgeline Property Group LLC",
  "zip": "97205",
  "lease_end": "2025-11-30",
  "original_monthly_rent": 2150.00,
  "monthly_rent_from_2025_06_01": 2236.00,
  "late_fee_from_2025_06_01": 111.80,
  "security_deposit": 2150.00,
  "total_pet_deposits": 800.00,
  "total_monthly_payment_july_2025": 2306.00,
  "move_in_payment": 4700.00
}
Documents: Ticket SLA 92% right
{
  "ticket_id": "48213",
  "account_id": "ACC-7731",
  "open_issue": "inventory_sync",
  "resolved_issues": [
    "billing_address",
    "invoice_pdf"
  ],
  "affected_orders": [
    "SO-99812",
    "SO-99820",
    "SO-99827"
  ],
  "priority": "P2",
  "sla_due_local": "2025-09-15T15:30",
  "sla_due_utc": "2025-09-15T20:30:00Z",
  "reissued_invoice": "INV-2025-0812"
}
Documents: Sales footnotes 89% right
{
  "q3_total_usd": 15346000,
  "q2_total_usd": 14464000,
  "q2_central_originally_reported_usd": 3047000,
  "q2_to_q3_change_pct": 6.1,
  "top_region_q3": "West",
  "fastest_growing_region_q1_to_q3": "International",
  "regions_declining_q2_to_q3": [
    "East"
  ],
  "international_q3_organic_usd": 1731000,
  "west_excluding_mountain_q3_usd": 4201000
}

Size: 26B parameters. First tested OCT 10.

Models that scored about the same

Comments

Sign in with GitHub to comment. Spam and abuse are hidden automatically.